diff options
author | George Hazan <ghazan@miranda.im> | 2018-05-14 18:29:31 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-05-14 18:29:31 +0300 |
commit | 40086f4fc370ca92218c805fe5cee10c09f57f2c (patch) | |
tree | eca73024f9ad1d5434821061a8b8a4ca899eb748 /src | |
parent | 3f1628f127d35aa14da97e50c2a94cfd61ad52dd (diff) |
merge with master till:
fixes #1358 (StdMsg: "Send on Ctrl+Enter" setting is lost after upgrade)
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdmsg/src/chat_manager.cpp | 1 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 9 | ||||
-rw-r--r-- | src/core/stdmsg/src/globals.cpp | 3 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 8 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.h | 15 | ||||
-rw-r--r-- | src/core/stdmsg/src/stdafx.h | 22 | ||||
-rw-r--r-- | src/core/stdmsg/src/tabs.cpp | 40 |
7 files changed, 66 insertions, 32 deletions
diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp index d55671f558..fd0bf8cf8a 100644 --- a/src/core/stdmsg/src/chat_manager.cpp +++ b/src/core/stdmsg/src/chat_manager.cpp @@ -199,6 +199,7 @@ static void ShowRoom(SESSION_INFO *si) pDlg->SetParent(pContainer->GetHwnd()); pDlg->Create(); pContainer->Show(); + pContainer->FixTabIcons(pDlg); PostMessage(pContainer->GetHwnd(), WM_SIZE, 0, 0); } diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index a015311e85..61600f5619 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -197,6 +197,15 @@ void CChatRoomDlg::onSplitterY(CSplitter *pSplitter) ///////////////////////////////////////////////////////////////////////////////////////// +int CChatRoomDlg::GetImageId() const +{ + if (m_si->wState & GC_EVENT_HIGHLIGHT) + return 0; + + MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule); + return (m_si->wStatus == ID_STATUS_ONLINE) ? mi->OnlineIconIndex : mi->OfflineIconIndex; +} + void CChatRoomDlg::LoadSettings() { m_clrInputBG = db_get_dw(0, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW)); diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index 353bd8bf17..4a3632a363 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -153,6 +153,9 @@ void InitGlobals() db_unset(0, SRMMMOD, "HideNames");
}
+ if (!g_dat.bSendOnEnter && !g_dat.bSendOnDblEnter)
+ g_dat.bSendOnCtrlEnter = true;
+
HookEvent(ME_DB_EVENT_ADDED, dbaddedevent);
HookEvent(ME_PROTO_ACK, ackevent);
HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index a65857539a..d1d63b4562 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -453,6 +453,11 @@ void CSrmmWindow::OnSplitterMoved(CSplitter *pSplitter) /////////////////////////////////////////////////////////////////////////////////////////
+int CSrmmWindow::GetImageId() const
+{
+ return (WORD)pcli->pfnIconFromStatusMode(m_szProto, m_wStatus, m_hContact);
+}
+
void CSrmmWindow::NotifyTyping(int mode)
{
if (!m_hContact)
@@ -647,8 +652,9 @@ void CSrmmWindow::UpdateTitle() if (m_hContact && m_szProto) {
m_wStatus = db_get_w(m_hContact, m_szProto, "Status", ID_STATUS_OFFLINE);
wchar_t *contactName = Clist_GetContactDisplayName(m_hContact);
+ wchar_t *szStatus = Clist_GetStatusModeDescription(m_wStatus, 0);
+ mir_snwprintf(newtitle, L"%s (%s): %s", contactName, szStatus, TranslateT("Message session"));
- mir_snwprintf(newtitle, L"%s - %s", contactName, TranslateT("Message session"));
m_wOldStatus = m_wStatus;
}
else mir_wstrncpy(newtitle, TranslateT("Message session"), _countof(newtitle));
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 3d5e443517..a1853a08a2 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -53,6 +53,11 @@ protected: CMsgDialog(int idDialog, SESSION_INFO *si = nullptr);
+ virtual int GetImageId() const PURE;
+
+ virtual const char* GetProto() const PURE;
+ virtual int GetStatus() const PURE;
+
virtual void OnActivate() PURE;
INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
@@ -124,7 +129,11 @@ public: INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
int Resizer(UTILRESIZECONTROL *urc) override;
-
+
+ virtual const char* GetProto() const { return m_szProto; }
+ virtual int GetStatus() const { return m_wStatus; }
+
+ int GetImageId() const override;
void LoadSettings() override {}
void ScrollToBottom() override;
void SetStatusText(const wchar_t*, HICON) override;
@@ -179,6 +188,10 @@ public: INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
int Resizer(UTILRESIZECONTROL *urc) override;
+ virtual const char* GetProto() const { return m_si->pszModule; }
+ virtual int GetStatus() const { return m_si->wStatus; }
+
+ int GetImageId() const override;
void LoadSettings() override;
void RedrawLog() override;
void StreamInEvents(LOGINFO *lin, bool bRedraw) override;
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index c9f458a840..7d19e3b7a9 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -70,6 +70,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_popup.h>
#include <m_srmm_int.h>
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct MODULEINFO : public GCModuleInfoBase
+{
+ HICON hOnlineIcon, hOfflineIcon;
+ int OnlineIconIndex, OfflineIconIndex;
+};
+
+struct SESSION_INFO : public GCSessionInfoBase {};
+struct LOGSTREAMDATA : public GCLogStreamDataBase {};
+
#include "cmdlist.h"
#include "msgs.h"
#include "globals.h"
@@ -86,15 +97,6 @@ extern HINSTANCE g_hInst; /////////////////////////////////////////////////////////////////////////////////////////
-struct MODULEINFO : public GCModuleInfoBase
-{
- HICON hOnlineIcon, hOfflineIcon;
- int OnlineIconIndex, OfflineIconIndex;
-};
-
-struct SESSION_INFO : public GCSessionInfoBase {};
-struct LOGSTREAMDATA : public GCLogStreamDataBase {};
-
struct GlobalLogSettings : public GlobalLogSettingsBase
{
int iX, iY;
@@ -155,7 +157,7 @@ public: CTabbedWindow* AddPage(MCONTACT hContact, wchar_t *pwszText = nullptr, int iActivate = -1);
void AddPage(SESSION_INFO*, int insertAt = -1);
- void FixTabIcons(CSrmmBaseDialog*);
+ void FixTabIcons(CMsgDialog*);
void SetMessageHighlight(CChatRoomDlg*);
void SetTabHighlight(CChatRoomDlg*);
void TabClicked();
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp index ba2e2670c5..f185a1de1f 100644 --- a/src/core/stdmsg/src/tabs.cpp +++ b/src/core/stdmsg/src/tabs.cpp @@ -279,34 +279,34 @@ void CTabbedWindow::AddPage(SESSION_INFO *si, int insertAt) m_tab.ActivatePage(indexfound); } -void CTabbedWindow::FixTabIcons(CSrmmBaseDialog *pDlg) +void CTabbedWindow::FixTabIcons(CMsgDialog *pDlg) { if (pDlg == nullptr) return; - int idx = m_tab.GetDlgIndex(pDlg); - if (idx == -1) - return; + 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) { + int idx = m_tab.GetDlgIndex(pDlg); + if (idx == -1) + return; - int image = 0; - if (SESSION_INFO *si = ((CChatRoomDlg*)pDlg)->m_si) { - if (!(si->wState & GC_EVENT_HIGHLIGHT)) { - MODULEINFO *mi = pci->MM_FindModule(si->pszModule); - image = (si->wStatus == ID_STATUS_ONLINE) ? mi->OnlineIconIndex : mi->OfflineIconIndex; + TCITEM tci = {}; + tci.mask = TCIF_IMAGE; + TabCtrl_GetItem(m_tab.GetHwnd(), idx, &tci); + if (tci.iImage != image) { + tci.iImage = image; + TabCtrl_SetItem(m_tab.GetHwnd(), idx, &tci); } - } - else image = pcli->pfnIconFromStatusMode(GetContactProto(pDlg->m_hContact), Contact_GetStatus(pDlg->m_hContact), pDlg->m_hContact); - - TCITEM tci = {}; - tci.mask = TCIF_IMAGE; - TabCtrl_GetItem(m_tab.GetHwnd(), idx, &tci); - if (tci.iImage != image) { - 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; } - if (pDlg == m_tab.GetActivePage()) - SendMessage(m_hwnd, WM_SETICON, 0, (LPARAM)ImageList_GetIcon(Clist_GetImageList(), image, 0)); + Window_FreeIcon_IcoLib(m_hwnd); + Window_SetProtoIcon_IcoLib(m_hwnd, pDlg->GetProto(), pDlg->GetStatus()); } void CTabbedWindow::SaveWindowPosition(bool bUpdateSession) |