diff options
author | George Hazan <ghazan@miranda.im> | 2017-03-11 12:27:21 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-03-11 12:27:21 +0300 |
commit | e02f1e05b363226a48fe9a4b151748a5cbb295d9 (patch) | |
tree | e49e428ab703459d65ef7829187dd17b9af4154c /src | |
parent | 432b115c1eaf6f74d7d4d8ac580f5de39c16a533 (diff) |
GC_UPDATETITLE replaced with CSrmmBaseDlg::UpdateTitle
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 47 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.h | 1 | ||||
-rw-r--r-- | src/core/stdmsg/src/stdafx.h | 1 | ||||
-rw-r--r-- | src/core/stdmsg/src/tabs.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/chat_svc.cpp | 2 |
5 files changed, 28 insertions, 25 deletions
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 53123a88da..587084f34c 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -920,7 +920,7 @@ void CChatRoomDlg::OnInitDialog() SendMessage(m_hwnd, GC_SETWNDPROPS, 0, 0); SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0); - SendMessage(m_hwnd, GC_UPDATETITLE, 0, 0); + UpdateTitle(); SetWindowPosition(); SendMessage(m_hwnd, WM_SIZE, 0, 0); @@ -1207,6 +1207,28 @@ void CChatRoomDlg::SaveWindowPosition(bool bUpdateSession) } } +void CChatRoomDlg::UpdateTitle() +{ + wchar_t szTemp[100]; + switch (m_si->iType) { + case GCW_CHATROOM: + mir_snwprintf(szTemp, + (m_si->nUsersInNicklist == 1) ? TranslateT("%s: chat room (%u user)") : TranslateT("%s: chat room (%u users)"), + m_si->ptszName, m_si->nUsersInNicklist); + break; + case GCW_PRIVMESS: + mir_snwprintf(szTemp, + (m_si->nUsersInNicklist == 1) ? TranslateT("%s: message session") : TranslateT("%s: message session (%u users)"), + m_si->ptszName, m_si->nUsersInNicklist); + break; + case GCW_SERVER: + mir_snwprintf(szTemp, L"%s: Server", m_si->ptszName); + break; + } + + SetWindowText(getCaptionWindow(), szTemp); +} + INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { SESSION_INFO *s; @@ -1267,27 +1289,6 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) SendMessage(m_hwnd, GC_REDRAWLOG2, 0, 0); break; - case GC_UPDATETITLE: - wchar_t szTemp[100]; - switch (m_si->iType) { - case GCW_CHATROOM: - mir_snwprintf(szTemp, - (m_si->nUsersInNicklist == 1) ? TranslateT("%s: chat room (%u user)") : TranslateT("%s: chat room (%u users)"), - m_si->ptszName, m_si->nUsersInNicklist); - break; - case GCW_PRIVMESS: - mir_snwprintf(szTemp, - (m_si->nUsersInNicklist == 1) ? TranslateT("%s: message session") : TranslateT("%s: message session (%u users)"), - m_si->ptszName, m_si->nUsersInNicklist); - break; - case GCW_SERVER: - mir_snwprintf(szTemp, L"%s: Server", m_si->ptszName); - break; - } - - SetWindowText(getCaptionWindow(), szTemp); - break; - case WM_CBD_LOADICONS: Srmm_UpdateToolbarIcons(m_hwnd); break; @@ -1489,8 +1490,8 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) int i = SendDlgItemMessage(m_hwnd, IDC_LIST, LB_GETTOPINDEX, 0, 0); SendDlgItemMessage(m_hwnd, IDC_LIST, LB_SETCOUNT, m_si->nUsersInNicklist, 0); SendDlgItemMessage(m_hwnd, IDC_LIST, LB_SETTOPINDEX, i, 0); - SendMessage(m_hwnd, GC_UPDATETITLE, 0, 0); } + UpdateTitle(); break; case GC_CLOSEWINDOW: diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 56344e490a..83765176ef 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -98,6 +98,7 @@ public: virtual void OnDestroy() override;
virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
+ virtual void UpdateTitle() override {}
void OnSplitterMoved(CSplitter*);
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index 5821959568..897a1bb93e 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -204,6 +204,7 @@ public: virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
virtual int Resizer(UTILRESIZECONTROL *urc) override;
+ virtual void UpdateTitle() override;
void OnClick_Bold(CCtrlButton*);
void OnClick_Color(CCtrlButton*);
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp index 5a4a904096..bcb691f467 100644 --- a/src/core/stdmsg/src/tabs.cpp +++ b/src/core/stdmsg/src/tabs.cpp @@ -545,7 +545,7 @@ void ShowRoom(SESSION_INFO *si) if (si->iType != GCW_SERVER) SendMessage(si->pDlg->GetHwnd(), GC_UPDATENICKLIST, 0, 0); else - SendMessage(si->pDlg->GetHwnd(), GC_UPDATETITLE, 0, 0); + si->pDlg->UpdateTitle(); SendMessage(si->pDlg->GetHwnd(), GC_REDRAWLOG, 0, 0); SendMessage(si->pDlg->GetHwnd(), GC_UPDATESTATUSBAR, 0, 0); } diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index 8bfb9d684d..2becb12910 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -624,7 +624,7 @@ MIR_APP_DLL(int) Chat_ChangeSessionName(const char *szModule, const wchar_t *wsz replaceStrW(si->ptszName, wszNewName);
db_set_ws(si->hContact, szModule, "Nick", wszNewName);
if (si->pDlg)
- SendMessage(si->pDlg->GetHwnd(), GC_UPDATETITLE, 0, 0);
+ si->pDlg->UpdateTitle();
}
return 0;
}
|