diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 20 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 28 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 17 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.h | 66 | ||||
-rw-r--r-- | src/core/stdmsg/src/tabs.cpp | 42 |
5 files changed, 87 insertions, 86 deletions
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 4767d84312..222792be60 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -58,7 +58,7 @@ void CChatRoomDlg::OnInitDialog() if (g_Settings.bTabsEnable) SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) | WS_EX_APPWINDOW); else - onActivate(); + OnActivate(); m_log.SendMsg(EM_AUTOURLDETECT, 1, 0); @@ -86,7 +86,7 @@ void CChatRoomDlg::OnDestroy() CSuper::OnDestroy(); } -void CChatRoomDlg::onActivate() +void CChatRoomDlg::OnActivate() { WINDOWPLACEMENT wp = {}; wp.length = sizeof(wp); @@ -286,9 +286,6 @@ void CChatRoomDlg::UpdateOptions() hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon; } - if (g_Settings.bTabsEnable) - g_pTabDialog->FixTabIcons(nullptr); - SendMessage(m_pOwner->m_hwndStatus, SB_SETICON, 0, (LPARAM)hIcon); Window_SetIcon_IcoLib(m_pOwner->GetHwnd(), GetIconHandle("window")); @@ -341,10 +338,6 @@ void CChatRoomDlg::UpdateStatusBar() } SendMessage(m_pOwner->m_hwndStatus, SB_SETICON, 0, (LPARAM)hIcon); - - if (g_Settings.bTabsEnable) - g_pTabDialog->FixTabIcons(nullptr); - SendMessage(m_pOwner->m_hwndStatus, SB_SETTEXT, 0, (LPARAM)ptszDispName); SendMessage(m_pOwner->m_hwndStatus, SB_SETTEXT, 1, (LPARAM)(m_si->ptszStatusbarText ? m_si->ptszStatusbarText : L"")); SendMessage(m_pOwner->m_hwndStatus, SB_SETTIPTEXT, 1, (LPARAM)(m_si->ptszStatusbarText ? m_si->ptszStatusbarText : L"")); @@ -1110,17 +1103,8 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (g_Settings.bTabsEnable) { m_si->wState &= ~GC_EVENT_HIGHLIGHT; m_si->wState &= ~STATE_TALK; - g_pTabDialog->FixTabIcons(nullptr); } - break; } - if (LOWORD(wParam) == WA_ACTIVE) - onActivate(); - break; - - case WM_MOUSEACTIVATE: - onActivate(); - SetFocus(m_message.GetHwnd()); break; case WM_NOTIFY: diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index df810752a3..d62015dbcc 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -308,6 +308,18 @@ void CSrmmWindow::OnDestroy() db_delete_contact(m_hContact);
}
+void CSrmmWindow::OnActivate()
+{
+ SetupStatusBar();
+ SetFocus(m_message.GetHwnd());
+ UpdateTitle();
+ UpdateLastMessage();
+ if (KillTimer(m_hwnd, TIMERID_FLASHWND))
+ FlashWindow(m_pOwner->GetHwnd(), FALSE);
+ if (g_dat.bUseStatusWinIcon)
+ SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
void CSrmmWindow::onClick_Ok(CCtrlButton *pButton)
@@ -1078,22 +1090,6 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) }
break;
- case WM_ACTIVATE:
- if (LOWORD(wParam) != WA_ACTIVE)
- break;
-
- __fallthrough;
-
- case WM_MOUSEACTIVATE:
- SetFocus(m_message.GetHwnd());
- UpdateTitle();
- UpdateLastMessage();
- if (KillTimer(m_hwnd, TIMERID_FLASHWND))
- FlashWindow(m_pOwner->GetHwnd(), FALSE);
- if (g_dat.bUseStatusWinIcon)
- SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
- break;
-
case WM_CBD_LOADICONS:
Srmm_UpdateToolbarIcons(m_hwnd);
break;
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index eac78a6b84..a95501bf69 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -41,6 +41,23 @@ void CMsgDialog::CloseTab() else SendMessage(m_hwndParent, WM_CLOSE, 0, 0);
}
+INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch (uMsg) {
+ case WM_ACTIVATE:
+ if (LOWORD(wParam) == WA_ACTIVE)
+ OnActivate();
+ break;
+
+ case WM_MOUSEACTIVATE:
+ OnActivate();
+ SetFocus(m_message.GetHwnd());
+ break;
+ }
+
+ return CSuper::DlgProc(uMsg, wParam, lParam);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
int OnCheckPlugins(WPARAM, LPARAM);
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 75c64c69cb..3d5e443517 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -53,8 +53,12 @@ protected: CMsgDialog(int idDialog, SESSION_INFO *si = nullptr);
+ virtual void OnActivate() PURE;
+
+ INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
+
public:
- virtual void CloseTab() override;
+ void CloseTab() override;
__forceinline SESSION_INFO* getChat() const { return m_si; }
};
@@ -63,8 +67,8 @@ class CSrmmWindow : public CMsgDialog {
typedef CMsgDialog CSuper;
- virtual LRESULT WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam) override;
- virtual LRESULT WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) override;
+ LRESULT WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam) override;
+ LRESULT WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) override;
CCtrlBase m_avatar;
CSplitter m_splitter;
@@ -114,16 +118,17 @@ public: public:
CSrmmWindow(CTabbedWindow*, MCONTACT hContact);
- virtual void OnInitDialog() override;
- virtual void OnDestroy() override;
+ void OnInitDialog() override;
+ void OnDestroy() override;
+ void OnActivate() override;
- virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
- virtual int Resizer(UTILRESIZECONTROL *urc) override;
+ INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
+ int Resizer(UTILRESIZECONTROL *urc) override;
- virtual void LoadSettings() override {}
- virtual void ScrollToBottom() override;
- virtual void SetStatusText(const wchar_t*, HICON) override;
- virtual void UpdateTitle() override;
+ void LoadSettings() override {}
+ void ScrollToBottom() override;
+ void SetStatusText(const wchar_t*, HICON) override;
+ void UpdateTitle() override;
void OnSplitterMoved(CSplitter*);
@@ -152,9 +157,9 @@ class CChatRoomDlg : public CMsgDialog static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
- virtual LRESULT WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam) override;
- virtual LRESULT WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) override;
- virtual LRESULT WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam) override;
+ LRESULT WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam) override;
+ LRESULT WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) override;
+ LRESULT WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam) override;
wchar_t szTabSave[20];
@@ -164,26 +169,25 @@ class CChatRoomDlg : public CMsgDialog int m_iSplitterX, m_iSplitterY;
- void onActivate(void);
-
public:
CChatRoomDlg(CTabbedWindow*, SESSION_INFO*);
- virtual void OnInitDialog() override;
- virtual void OnDestroy() override;
-
- virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
- virtual int Resizer(UTILRESIZECONTROL *urc) override;
-
- virtual void LoadSettings() override;
- virtual void RedrawLog() override;
- virtual void StreamInEvents(LOGINFO *lin, bool bRedraw) override;
- virtual void ScrollToBottom() override;
- virtual void ShowFilterMenu() override;
- virtual void UpdateNickList() override;
- virtual void UpdateOptions() override;
- virtual void UpdateStatusBar() override;
- virtual void UpdateTitle() override;
+ void OnInitDialog() override;
+ void OnDestroy() override;
+ void OnActivate() override;
+
+ INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
+ int Resizer(UTILRESIZECONTROL *urc) override;
+
+ void LoadSettings() override;
+ void RedrawLog() override;
+ void StreamInEvents(LOGINFO *lin, bool bRedraw) override;
+ void ScrollToBottom() override;
+ void ShowFilterMenu() override;
+ void UpdateNickList() override;
+ void UpdateOptions() override;
+ void UpdateStatusBar() override;
+ void UpdateTitle() override;
void onClick_Ok(CCtrlButton*);
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp index c244f0dd24..c6d0f21f14 100644 --- a/src/core/stdmsg/src/tabs.cpp +++ b/src/core/stdmsg/src/tabs.cpp @@ -283,31 +283,31 @@ void CTabbedWindow::AddPage(SESSION_INFO *si, int insertAt) void CTabbedWindow::FixTabIcons(CSrmmBaseDialog *pDlg) { - if (pDlg != nullptr) { - int idx = m_tab.GetDlgIndex(pDlg); - if (idx == -1) - return; + if (pDlg == nullptr) + 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; - if (si->wState & STATE_TALK) - image++; - } - } - else image = g_iMessageIconIndex; + int idx = m_tab.GetDlgIndex(pDlg); + if (idx == -1) + return; - 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); + 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; + if (si->wState & STATE_TALK) + image++; } } - else RedrawWindow(m_tab.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); + else image = g_iMessageIconIndex; + + 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); + } } void CTabbedWindow::SaveWindowPosition(bool bUpdateSession) |