From 09e90f29d43694f401d80d8d86140eb96c21558a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 22 May 2018 22:40:02 +0300 Subject: merge with master till VKontakte: update VK_API to 5.76 --- src/core/stdmsg/src/chat_options.cpp | 13 ++++++++----- src/core/stdmsg/src/msgdialog.cpp | 35 +++++++++++++++++++++++------------ src/core/stdmsg/src/msgs.cpp | 4 ++-- src/core/stdmsg/src/msgs.h | 2 +- src/core/stdmsg/src/stdafx.h | 2 ++ src/core/stdmsg/src/tabs.cpp | 18 +++++++++++------- 6 files changed, 47 insertions(+), 27 deletions(-) (limited to 'src/core/stdmsg') diff --git a/src/core/stdmsg/src/chat_options.cpp b/src/core/stdmsg/src/chat_options.cpp index 2764e3c528..9d7080484b 100644 --- a/src/core/stdmsg/src/chat_options.cpp +++ b/src/core/stdmsg/src/chat_options.cpp @@ -212,7 +212,7 @@ static void InitSetting(wchar_t** ppPointer, char* pszSetting, wchar_t* pszDefau class COptMainDlg : public CDlgBase { - HTREEITEM hListHeading1, hListHeading2, hListHeading3, hListHeading4, hListHeading5, hListHeading6; + HTREEITEM hListHeading1, hListHeading2, hListHeading3, hListHeading4, hListHeading5, hListHeading6 = 0; CCtrlTreeView checkBoxes; @@ -327,7 +327,8 @@ class COptMainDlg : public CDlgBase CheckHeading(hListHeading3); CheckHeading(hListHeading4); CheckHeading(hListHeading5); - CheckHeading(hListHeading6); + if (PopupInstalled) + CheckHeading(hListHeading6); } public: @@ -347,15 +348,17 @@ public: hListHeading3 = InsertBranch(LPGEN("Default events to show in new chat rooms if the 'event filter' is enabled"), db_get_b(0, CHAT_MODULE, "Branch3Exp", 0) ? TRUE : FALSE); hListHeading4 = InsertBranch(LPGEN("Icons to display in the message log"), db_get_b(0, CHAT_MODULE, "Branch4Exp", 0) ? TRUE : FALSE); hListHeading5 = InsertBranch(LPGEN("Icons to display in the tray"), db_get_b(0, CHAT_MODULE, "Branch5Exp", 0) ? TRUE : FALSE); - if (PopupInstalled) - hListHeading6 = InsertBranch(LPGEN("Popups to display"), db_get_b(0, CHAT_MODULE, "Branch6Exp", 0) ? TRUE : FALSE); FillBranch(hListHeading1, branch1, _countof(branch1), 0); FillBranch(hListHeading2, branch2, _countof(branch2), 0); FillBranch(hListHeading3, branch3, _countof(branch3), 0x03E0); FillBranch(hListHeading4, branch4, _countof(branch4), 0x0000); FillBranch(hListHeading5, branch5, _countof(branch5), 0x1000); - FillBranch(hListHeading6, branch6, _countof(branch6), 0x0000); + + if (PopupInstalled) { + hListHeading6 = InsertBranch(LPGEN("Popups to display"), db_get_b(0, CHAT_MODULE, "Branch6Exp", 0) ? TRUE : FALSE); + FillBranch(hListHeading6, branch6, _countof(branch6), 0x0000); + } FixHeadings(); } diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index d1d63b4562..3413431016 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -548,19 +548,22 @@ void CSrmmWindow::ShowAvatar() SendMessage(m_hwnd, DM_AVATARSIZECHANGE, 0, 0); } -void CSrmmWindow::ShowTime() +void CSrmmWindow::ShowTime(bool bForce) { - if (m_hTimeZone) { - SYSTEMTIME st; - GetSystemTime(&st); - if (m_wMinute != st.wMinute) { + if (!m_hTimeZone) + return; + + SYSTEMTIME st; + GetSystemTime(&st); + if (m_wMinute != st.wMinute || bForce) { + if (m_pOwner->m_tab.GetActivePage() == this) { wchar_t buf[32]; unsigned i = g_dat.bShowReadChar ? 2 : 1; TimeZone_PrintDateTime(m_hTimeZone, L"t", buf, _countof(buf), 0); SendMessage(m_pOwner->m_hwndStatus, SB_SETTEXT, i, (LPARAM)buf); - m_wMinute = st.wMinute; } + m_wMinute = st.wMinute; } } @@ -586,7 +589,7 @@ void CSrmmWindow::SetupStatusBar() SendMessage(m_pOwner->m_hwndStatus, SB_SETPARTS, i, (LPARAM)statwidths); UpdateReadChars(); - ShowTime(); + ShowTime(true); SendMessage(m_hwnd, DM_STATUSICONCHANGE, 0, 0); } @@ -659,10 +662,12 @@ void CSrmmWindow::UpdateTitle() } else mir_wstrncpy(newtitle, TranslateT("Message session"), _countof(newtitle)); - wchar_t oldtitle[256]; - GetWindowText(m_pOwner->GetHwnd(), oldtitle, _countof(oldtitle)); - if (mir_wstrcmp(newtitle, oldtitle)) //swt() flickers even if the title hasn't actually changed - SetWindowText(m_pOwner->GetHwnd(), newtitle); + if (this == m_pOwner->CurrPage()) { + wchar_t oldtitle[256]; + GetWindowText(m_pOwner->GetHwnd(), oldtitle, _countof(oldtitle)); + if (mir_wstrcmp(newtitle, oldtitle)) //swt() flickers even if the title hasn't actually changed + SetWindowText(m_pOwner->GetHwnd(), newtitle); + } } ///////////////////////////////////////////////////////////////////////////////////////// @@ -1192,7 +1197,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) m_nFlash++; } else if (wParam == TIMERID_TYPE) { - ShowTime(); + ShowTime(false); if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON && GetTickCount() - m_nLastTyping > TIMEOUT_TYPEOFF) NotifyTyping(PROTOTYPE_SELFTYPING_OFF); @@ -1386,6 +1391,12 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) break; case DM_UPDATETITLE: + if (lParam != 0) { + bool bIsMe = (lParam == m_hContact) || (m_bIsMeta && db_mc_getMeta(lParam) == m_hContact); + if (!bIsMe) + break; + } + UpdateIcon(wParam); UpdateTitle(); break; diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index a95501bf69..0901f60c96 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -225,14 +225,14 @@ static int MessageSettingChanged(WPARAM hContact, LPARAM lParam) return 0; if (!strcmp(cws->szModule, "CList")) - Srmm_Broadcast(DM_UPDATETITLE, (WPARAM)cws, 0); + Srmm_Broadcast(DM_UPDATETITLE, (WPARAM)cws, hContact); else if (hContact) { if (cws->szSetting && !strcmp(cws->szSetting, "Timezone")) Srmm_Broadcast(DM_NEWTIMEZONE, (WPARAM)cws, 0); else { char *szProto = GetContactProto(hContact); if (szProto && !strcmp(cws->szModule, szProto)) - Srmm_Broadcast(DM_UPDATETITLE, (WPARAM)cws, 0); + Srmm_Broadcast(DM_UPDATETITLE, (WPARAM)cws, hContact); } } return 0; diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index a1853a08a2..07917e2736 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -81,7 +81,7 @@ class CSrmmWindow : public CMsgDialog void NotifyTyping(int mode); void ProcessFileDrop(HDROP hDrop); void ShowAvatar(void); - void ShowTime(void); + void ShowTime(bool bForce); void SetupStatusBar(void); void StreamInEvents(MEVENT hDbEventFirst, int count, bool bAppend); void UpdateIcon(WPARAM wParam); diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index 7d19e3b7a9..099a07c086 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -156,6 +156,8 @@ public: CTabbedWindow(); CTabbedWindow* AddPage(MCONTACT hContact, wchar_t *pwszText = nullptr, int iActivate = -1); + CMsgDialog* CurrPage() const; + void AddPage(SESSION_INFO*, int insertAt = -1); void FixTabIcons(CMsgDialog*); void SetMessageHighlight(CChatRoomDlg*); diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp index f185a1de1f..8f4595fc1a 100644 --- a/src/core/stdmsg/src/tabs.cpp +++ b/src/core/stdmsg/src/tabs.cpp @@ -279,6 +279,11 @@ void CTabbedWindow::AddPage(SESSION_INFO *si, int insertAt) m_tab.ActivatePage(indexfound); } +CMsgDialog* CTabbedWindow::CurrPage() const +{ + return (m_pEmbed != nullptr) ? m_pEmbed : (CMsgDialog*)m_tab.GetActivePage(); +} + void CTabbedWindow::FixTabIcons(CMsgDialog *pDlg) { if (pDlg == nullptr) @@ -287,7 +292,7 @@ void CTabbedWindow::FixTabIcons(CMsgDialog *pDlg) int image = pDlg->GetImageId(); // if tabs are turned off, simply change the window's icon, otherwise set the tab's icon first - if (pDlg != m_pEmbed) { + if (m_pEmbed == nullptr) { int idx = m_tab.GetDlgIndex(pDlg); if (idx == -1) return; @@ -299,14 +304,13 @@ void CTabbedWindow::FixTabIcons(CMsgDialog *pDlg) tci.iImage = image; TabCtrl_SetItem(m_tab.GetHwnd(), idx, &tci); } - - // set the container's icon only if we're processing the current page - if (pDlg != m_tab.GetActivePage()) - return; } - Window_FreeIcon_IcoLib(m_hwnd); - Window_SetProtoIcon_IcoLib(m_hwnd, pDlg->GetProto(), pDlg->GetStatus()); + // set the container's icon only if we're processing the current page + if (pDlg == CurrPage()) { + Window_FreeIcon_IcoLib(m_hwnd); + Window_SetProtoIcon_IcoLib(m_hwnd, pDlg->GetProto(), pDlg->GetStatus()); + } } void CTabbedWindow::SaveWindowPosition(bool bUpdateSession) -- cgit v1.2.3