From 6e97fc04aa23723077c138b7cb028a5a8793ddf6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 22 Mar 2023 20:28:56 +0300 Subject: common nick list drawing code removed from DlgProc() --- include/m_srmm_int.h | 1 + plugins/Scriver/src/msgdialog.cpp | 44 +----------------- plugins/Scriver/src/msgs.h | 1 + plugins/Scriver/src/msgutils.cpp | 38 ++++++++++++++++ plugins/TabSRMM/src/msgdialog.cpp | 89 +------------------------------------ plugins/TabSRMM/src/msgdlgother.cpp | 86 +++++++++++++++++++++++++++++++++++ plugins/TabSRMM/src/msgs.h | 1 + src/core/stdmsg/src/msgdialog.cpp | 80 ++++++++++++++++----------------- src/core/stdmsg/src/msgs.h | 1 + src/mir_app/src/chat.h | 1 + src/mir_app/src/chat_manager.cpp | 4 +- src/mir_app/src/srmm_base.cpp | 14 +++++- 12 files changed, 187 insertions(+), 173 deletions(-) diff --git a/include/m_srmm_int.h b/include/m_srmm_int.h index ce5c7c5845..27dc5d0ebf 100644 --- a/include/m_srmm_int.h +++ b/include/m_srmm_int.h @@ -248,6 +248,7 @@ public: virtual void AddLog(); virtual void CloseTab() {} + virtual void DrawNickList(USERINFO *ui, DRAWITEMSTRUCT *dis) PURE; virtual void EventAdded(MEVENT, const DBEVENTINFO &dbei) PURE; virtual bool GetFirstEvent() PURE; virtual bool IsActive() const PURE; diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 90a248965b..d918961932 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -1240,50 +1240,8 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) DeleteDC(hdcMem); return TRUE; } - - if (dis->CtlID == IDC_SRMM_NICKLIST) { - int index = dis->itemID; - USERINFO *ui = g_chatApi.SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index); - if (ui) { - int x_offset = 2; - - int height = dis->rcItem.bottom - dis->rcItem.top; - if (height & 1) - height++; - - int offset = (height == 10) ? 0 : height / 2 - 5; - HFONT hFont = (ui->iStatusEx == 0) ? g_Settings.UserListFont : g_Settings.UserListHeadingsFont; - HFONT hOldFont = (HFONT)SelectObject(dis->hDC, hFont); - SetBkMode(dis->hDC, TRANSPARENT); - - if (dis->itemAction == ODA_FOCUS && dis->itemState & ODS_SELECTED) - FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListSelectedBkgBrush); - else //if (dis->itemState & ODS_INACTIVE) - FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListBkgBrush); - - if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) { - HICON hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus); - DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, nullptr, DI_NORMAL); - IcoLib_ReleaseIcon(hIcon); - x_offset += 18; - } - DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, g_chatApi.SM_GetStatusIcon(m_si, ui), 10, 10, 0, nullptr, DI_NORMAL); - x_offset += 12; - if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) { - HICON hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus); - DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, nullptr, DI_NORMAL); - IcoLib_ReleaseIcon(hIcon); - x_offset += 18; - } - - SetTextColor(dis->hDC, ui->iStatusEx == 0 ? g_Settings.crUserListColor : g_Settings.crUserListHeadingsColor); - TextOut(dis->hDC, dis->rcItem.left + x_offset, dis->rcItem.top, ui->pszNick, (int)mir_wstrlen(ui->pszNick)); - SelectObject(dis->hDC, hOldFont); - } - return TRUE; - } } - return Menu_DrawItem(lParam); + break; case WM_COMMAND: switch (LOWORD(wParam)) { diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index 44d53eebd6..679a0eaa6b 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -172,6 +172,7 @@ public: void onType(CTimer *); void CloseTab() override; + void DrawNickList(USERINFO *ui, DRAWITEMSTRUCT *dis) override; void EventAdded(MEVENT, const DBEVENTINFO &dbei) override; bool GetFirstEvent() override; void LoadSettings() override; diff --git a/plugins/Scriver/src/msgutils.cpp b/plugins/Scriver/src/msgutils.cpp index 4f7223c28d..b982bc5326 100644 --- a/plugins/Scriver/src/msgutils.cpp +++ b/plugins/Scriver/src/msgutils.cpp @@ -36,6 +36,44 @@ void CMsgDialog::CloseTab() Close(); } +void CMsgDialog::DrawNickList(USERINFO *ui, DRAWITEMSTRUCT *dis) +{ + int x_offset = 2; + + int height = dis->rcItem.bottom - dis->rcItem.top; + if (height & 1) + height++; + + int offset = (height == 10) ? 0 : height / 2 - 5; + HFONT hFont = (ui->iStatusEx == 0) ? g_Settings.UserListFont : g_Settings.UserListHeadingsFont; + HFONT hOldFont = (HFONT)SelectObject(dis->hDC, hFont); + SetBkMode(dis->hDC, TRANSPARENT); + + if (dis->itemAction == ODA_FOCUS && dis->itemState & ODS_SELECTED) + FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListSelectedBkgBrush); + else //if (dis->itemState & ODS_INACTIVE) + FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListBkgBrush); + + if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) { + HICON hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus); + DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, nullptr, DI_NORMAL); + IcoLib_ReleaseIcon(hIcon); + x_offset += 18; + } + DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, g_chatApi.SM_GetStatusIcon(m_si, ui), 10, 10, 0, nullptr, DI_NORMAL); + x_offset += 12; + if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) { + HICON hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus); + DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, nullptr, DI_NORMAL); + IcoLib_ReleaseIcon(hIcon); + x_offset += 18; + } + + SetTextColor(dis->hDC, ui->iStatusEx == 0 ? g_Settings.crUserListColor : g_Settings.crUserListHeadingsColor); + TextOut(dis->hDC, dis->rcItem.left + x_offset, dis->rcItem.top, ui->pszNick, (int)mir_wstrlen(ui->pszNick)); + SelectObject(dis->hDC, hOldFont); +} + void CMsgDialog::EventAdded(MEVENT hDbEvent, const DBEVENTINFO &dbei) { if (m_hDbEventFirst == 0) diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index ecab7d8cf4..34bd740ff2 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -2650,93 +2650,8 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return Menu_DrawItem(lParam); } - if (dis->CtlID == IDC_SRMM_NICKLIST) { - int x_offset = 0; - int index = dis->itemID; - - USERINFO *ui = g_chatApi.UM_FindUserFromIndex(m_si, index); - if (ui == nullptr) - return TRUE; - - int height = dis->rcItem.bottom - dis->rcItem.top; - if (height & 1) - height++; - int offset = (height == 10) ? 0 : height / 2; - - HICON hIcon = g_chatApi.SM_GetStatusIcon(m_si, ui); - HFONT hFont = g_Settings.UserListFonts[ui->iStatusEx]; - HFONT hOldFont = (HFONT)SelectObject(dis->hDC, hFont); - SetBkMode(dis->hDC, TRANSPARENT); - - int nickIndex = 0; - for (int i = 0; i < STATUSICONCOUNT; i++) { - if (hIcon == g_chatApi.hStatusIcons[i]) { - nickIndex = i; - break; - } - } - - if (dis->itemState & ODS_SELECTED) { - FillRect(dis->hDC, &dis->rcItem, g_Settings.SelectionBGBrush); - SetTextColor(dis->hDC, g_Settings.nickColors[6]); - } - else { - FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListBkgBrush); - if (g_Settings.bColorizeNicks && nickIndex != 0) - SetTextColor(dis->hDC, g_Settings.nickColors[nickIndex - 1]); - else - SetTextColor(dis->hDC, g_Settings.UserListColors[ui->iStatusEx]); - } - x_offset = 2; - - if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) { - HICON icon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus); - DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, icon, 16, 16, 0, nullptr, DI_NORMAL); - IcoLib_ReleaseIcon(icon); - x_offset += 18; - } - - if (g_Settings.bClassicIndicators) { - char szTemp[3]; - szTemp[1] = 0; - szTemp[0] = szIndicators[nickIndex]; - if (szTemp[0]) { - SIZE szUmode; - GetTextExtentPoint32A(dis->hDC, szTemp, 1, &szUmode); - TextOutA(dis->hDC, x_offset, dis->rcItem.top, szTemp, 1); - x_offset += szUmode.cx + 2; - } - else x_offset += 8; - } - else { - DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 5, hIcon, 10, 10, 0, nullptr, DI_NORMAL); - x_offset += 12; - } - - if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) { - HICON icon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus); - DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, icon, 16, 16, 0, nullptr, DI_NORMAL); - IcoLib_ReleaseIcon(icon); - x_offset += 18; - } - - SIZE sz; - if (m_iSearchItem != -1 && m_iSearchItem == index && m_wszSearch[0]) { - COLORREF clr_orig = GetTextColor(dis->hDC); - GetTextExtentPoint32(dis->hDC, ui->pszNick, (int)mir_wstrlen(m_wszSearch), &sz); - SetTextColor(dis->hDC, RGB(250, 250, 0)); - TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, (int)mir_wstrlen(m_wszSearch)); - SetTextColor(dis->hDC, clr_orig); - x_offset += sz.cx; - TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick + mir_wstrlen(m_wszSearch), int(mir_wstrlen(ui->pszNick) - mir_wstrlen(m_wszSearch))); - } - else { - GetTextExtentPoint32(dis->hDC, ui->pszNick, (int)mir_wstrlen(ui->pszNick), &sz); - TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, (int)mir_wstrlen(ui->pszNick)); - SelectObject(dis->hDC, hOldFont); - } - return TRUE; - } + if (dis->CtlID == IDC_SRMM_NICKLIST) + break; } return MsgWindowDrawHandler((DRAWITEMSTRUCT *)lParam); diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index 1634e5712e..b7dd977c2d 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -433,6 +433,92 @@ BOOL CMsgDialog::DoRtfToTags(CMStringW &pszText) const ///////////////////////////////////////////////////////////////////////////////////////// +void CMsgDialog::DrawNickList(USERINFO *ui, DRAWITEMSTRUCT *dis) +{ + int x_offset = 0; + int index = dis->itemID; + + int height = dis->rcItem.bottom - dis->rcItem.top; + if (height & 1) + height++; + int offset = (height == 10) ? 0 : height / 2; + + HICON hIcon = g_chatApi.SM_GetStatusIcon(m_si, ui); + HFONT hFont = g_Settings.UserListFonts[ui->iStatusEx]; + HFONT hOldFont = (HFONT)SelectObject(dis->hDC, hFont); + SetBkMode(dis->hDC, TRANSPARENT); + + int nickIndex = 0; + for (int i = 0; i < STATUSICONCOUNT; i++) { + if (hIcon == g_chatApi.hStatusIcons[i]) { + nickIndex = i; + break; + } + } + + if (dis->itemState & ODS_SELECTED) { + FillRect(dis->hDC, &dis->rcItem, g_Settings.SelectionBGBrush); + SetTextColor(dis->hDC, g_Settings.nickColors[6]); + } + else { + FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListBkgBrush); + if (g_Settings.bColorizeNicks && nickIndex != 0) + SetTextColor(dis->hDC, g_Settings.nickColors[nickIndex - 1]); + else + SetTextColor(dis->hDC, g_Settings.UserListColors[ui->iStatusEx]); + } + x_offset = 2; + + if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) { + HICON icon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus); + DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, icon, 16, 16, 0, nullptr, DI_NORMAL); + IcoLib_ReleaseIcon(icon); + x_offset += 18; + } + + if (g_Settings.bClassicIndicators) { + char szTemp[3]; + szTemp[1] = 0; + szTemp[0] = szIndicators[nickIndex]; + if (szTemp[0]) { + SIZE szUmode; + GetTextExtentPoint32A(dis->hDC, szTemp, 1, &szUmode); + TextOutA(dis->hDC, x_offset, dis->rcItem.top, szTemp, 1); + x_offset += szUmode.cx + 2; + } + else x_offset += 8; + } + else { + DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 5, hIcon, 10, 10, 0, nullptr, DI_NORMAL); + x_offset += 12; + } + + if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) { + HICON icon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus); + DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, icon, 16, 16, 0, nullptr, DI_NORMAL); + IcoLib_ReleaseIcon(icon); + x_offset += 18; + } + + SIZE sz; + if (m_iSearchItem != -1 && m_iSearchItem == index && m_wszSearch[0]) { + COLORREF clr_orig = GetTextColor(dis->hDC); + GetTextExtentPoint32(dis->hDC, ui->pszNick, (int)mir_wstrlen(m_wszSearch), &sz); + SetTextColor(dis->hDC, RGB(250, 250, 0)); + TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, (int)mir_wstrlen(m_wszSearch)); + SetTextColor(dis->hDC, clr_orig); + x_offset += sz.cx; + TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick + mir_wstrlen(m_wszSearch), int(mir_wstrlen(ui->pszNick) - mir_wstrlen(m_wszSearch))); + } + else { + GetTextExtentPoint32(dis->hDC, ui->pszNick, (int)mir_wstrlen(ui->pszNick), &sz); + TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, (int)mir_wstrlen(ui->pszNick)); + SelectObject(dis->hDC, hOldFont); + } +} + +///////////////////////////////////////////////////////////////////////////////////////// + void CMsgDialog::EnableSendButton(bool bMode) const { SendDlgItemMessage(m_hwnd, IDOK, BUTTONSETASNORMAL, bMode, 0); diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 15bbd42352..6d05b1a25f 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -631,6 +631,7 @@ public: void AddLog() override; void CloseTab() override; + void DrawNickList(USERINFO *ui, DRAWITEMSTRUCT *dis) override; void EventAdded(MEVENT, const DBEVENTINFO &dbei) override; bool GetFirstEvent() override; bool IsActive() const override; diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 691afe4cc6..ff1cb96e1e 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -623,46 +623,6 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) CallService(MS_AV_DRAWAVATAR, 0, (LPARAM)&adr); return TRUE; } - - if (dis->CtlID == IDC_SRMM_NICKLIST) { - int index = dis->itemID; - USERINFO *ui = g_chatApi.SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, index); - if (ui) { - int x_offset = 2; - - int height = dis->rcItem.bottom - dis->rcItem.top; - if (height & 1) - height++; - - int offset = (height == 10) ? 0 : height / 2 - 4; - HFONT hFont = (ui->iStatusEx == 0) ? g_Settings.UserListFont : g_Settings.UserListHeadingsFont; - HFONT hOldFont = (HFONT)SelectObject(dis->hDC, hFont); - SetBkMode(dis->hDC, TRANSPARENT); - - if (dis->itemAction == ODA_FOCUS && dis->itemState & ODS_SELECTED) - FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListSelectedBkgBrush); - else //if (dis->itemState & ODS_INACTIVE) - FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListBkgBrush); - - if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) { - HICON hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus); - DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, nullptr, DI_NORMAL); - x_offset += 18; - } - DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, g_chatApi.SM_GetStatusIcon(m_si, ui), 10, 10, 0, nullptr, DI_NORMAL); - x_offset += 12; - if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) { - HICON hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus); - DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, nullptr, DI_NORMAL); - x_offset += 18; - } - - SetTextColor(dis->hDC, ui->iStatusEx == 0 ? g_Settings.crUserListColor : g_Settings.crUserListHeadingsColor); - TextOut(dis->hDC, dis->rcItem.left + x_offset, dis->rcItem.top, ui->pszNick, (int)mir_wstrlen(ui->pszNick)); - SelectObject(dis->hDC, hOldFont); - } - return TRUE; - } } break; @@ -1251,6 +1211,46 @@ void CMsgDialog::CloseTab() else SendMessage(m_hwndParent, WM_CLOSE, 0, 0); } +///////////////////////////////////////////////////////////////////////////////////////// + +void CMsgDialog::DrawNickList(USERINFO *ui, DRAWITEMSTRUCT *dis) +{ + int x_offset = 2; + + int height = dis->rcItem.bottom - dis->rcItem.top; + if (height & 1) + height++; + + int offset = (height == 10) ? 0 : height / 2 - 4; + HFONT hFont = (ui->iStatusEx == 0) ? g_Settings.UserListFont : g_Settings.UserListHeadingsFont; + HFONT hOldFont = (HFONT)SelectObject(dis->hDC, hFont); + SetBkMode(dis->hDC, TRANSPARENT); + + if (dis->itemAction == ODA_FOCUS && dis->itemState & ODS_SELECTED) + FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListSelectedBkgBrush); + else //if (dis->itemState & ODS_INACTIVE) + FillRect(dis->hDC, &dis->rcItem, g_chatApi.hListBkgBrush); + + if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) { + HICON hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus); + DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, nullptr, DI_NORMAL); + x_offset += 18; + } + DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, g_chatApi.SM_GetStatusIcon(m_si, ui), 10, 10, 0, nullptr, DI_NORMAL); + x_offset += 12; + if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) { + HICON hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus); + DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, nullptr, DI_NORMAL); + x_offset += 18; + } + + SetTextColor(dis->hDC, ui->iStatusEx == 0 ? g_Settings.crUserListColor : g_Settings.crUserListHeadingsColor); + TextOut(dis->hDC, dis->rcItem.left + x_offset, dis->rcItem.top, ui->pszNick, (int)mir_wstrlen(ui->pszNick)); + SelectObject(dis->hDC, hOldFont); +} + +///////////////////////////////////////////////////////////////////////////////////////// + void CMsgDialog::EventAdded(MEVENT hDbEvent, const DBEVENTINFO &dbei) { if (m_hDbEventFirst == 0) diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 7a3656500a..080a335328 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -152,6 +152,7 @@ public: } void CloseTab() override; + void DrawNickList(USERINFO *ui, DRAWITEMSTRUCT *dis) override; void EventAdded(MEVENT, const DBEVENTINFO &dbei) override; bool GetFirstEvent() override; bool IsActive() const override; diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h index 1168fc2815..bf406fe434 100644 --- a/src/mir_app/src/chat.h +++ b/src/mir_app/src/chat.h @@ -84,6 +84,7 @@ SESSION_INFO* SM_FindSessionByIndex(const char *pszModule, int iItem); STATUSINFO* TM_AddStatus(STATUSINFO **ppStatusList, const wchar_t *pszStatus, int *iCount); uint16_t TM_StringToWord(STATUSINFO *pStatusList, const wchar_t *pszStatus); +USERINFO* UM_FindUserFromIndex(SESSION_INFO *si, int index); BOOL UM_RemoveAll(SESSION_INFO *si); BOOL UM_SetStatusEx(SESSION_INFO *si, const wchar_t* pszText, int flags); void UM_SortKeys(SESSION_INFO *si); diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index be26a50a5b..a448c77be0 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -305,7 +305,7 @@ BOOL SM_RemoveUser(SESSION_INFO *pSI, const wchar_t *pszUID) static USERINFO* SM_GetUserFromIndex(const wchar_t *pszID, const char *pszModule, int index) { SESSION_INFO *si = Chat_Find(pszID, pszModule); - return (si == nullptr) ? nullptr : g_chatApi.UM_FindUserFromIndex(si, index); + return (si == nullptr) ? nullptr : UM_FindUserFromIndex(si, index); } BOOL SM_GiveStatus(SESSION_INFO *si, const wchar_t *pszUID, const wchar_t *pszStatus) @@ -707,7 +707,7 @@ static int UM_CompareItem(const USERINFO *u1, const USERINFO *u2) return mir_wstrcmpi(u1->pszNick, u2->pszNick); } -static USERINFO* UM_FindUserFromIndex(SESSION_INFO *si, int index) +USERINFO* UM_FindUserFromIndex(SESSION_INFO *si, int index) { if (!si) return nullptr; diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index 191bcf1980..2f0fc7e044 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -553,6 +553,18 @@ INT_PTR CSrmmBaseDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) } break; + case WM_DRAWITEM: + { + DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam; + if (dis->CtlID == IDC_SRMM_NICKLIST) { + USERINFO *ui = UM_FindUserFromIndex(m_si, dis->itemID); + if (ui != nullptr) + DrawNickList(ui, dis); + return TRUE; + } + } + break; + case WM_CBD_RECREATE: Srmm_CreateToolbarIcons(m_hwnd, isChat() ? BBBF_ISCHATBUTTON : BBBF_ISIMBUTTON); break; @@ -773,7 +785,7 @@ void CSrmmBaseDialog::onDblClick_List(CCtrlListBox *pList) ScreenToClient(pList->GetHwnd(), &hti.pt); int item = LOWORD(pList->SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y))); - USERINFO *ui = g_chatApi.UM_FindUserFromIndex(m_si, item); + USERINFO *ui = UM_FindUserFromIndex(m_si, item); if (ui == nullptr) return; -- cgit v1.2.3