summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-14 12:19:39 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-14 12:19:39 +0300
commitabf4069c2e3473da8f1d468e46c19951935a912f (patch)
tree2043f9159bf5f9ae9bd71ae7285c38f8ec1b4fd5 /plugins/TabSRMM
parent28664fa2341425bd0ece0ee457b0fa0982226a3a (diff)
fixes #744
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r--plugins/TabSRMM/src/chat_log.cpp2
-rw-r--r--plugins/TabSRMM/src/chat_main.cpp6
-rw-r--r--plugins/TabSRMM/src/chat_window.cpp8
-rw-r--r--plugins/TabSRMM/src/container.cpp18
-rw-r--r--plugins/TabSRMM/src/controls.cpp4
-rw-r--r--plugins/TabSRMM/src/functions.h1
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp19
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp12
-rw-r--r--plugins/TabSRMM/src/msgs.cpp22
-rw-r--r--plugins/TabSRMM/src/msgs.h1
10 files changed, 36 insertions, 57 deletions
diff --git a/plugins/TabSRMM/src/chat_log.cpp b/plugins/TabSRMM/src/chat_log.cpp
index a33c74b442..78831bd9ac 100644
--- a/plugins/TabSRMM/src/chat_log.cpp
+++ b/plugins/TabSRMM/src/chat_log.cpp
@@ -854,7 +854,7 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, bool bRedraw)
SCROLLINFO scroll = {};
scroll.cbSize = sizeof(SCROLLINFO);
scroll.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
- GetScrollInfo(GetDlgItem(m_hwnd, IDC_LOG), SB_VERT, &scroll);
+ GetScrollInfo(m_log.GetHwnd(), SB_VERT, &scroll);
POINT point = { 0 };
m_log.SendMsg(EM_GETSCROLLPOS, 0, (LPARAM)&point);
diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp
index 5df84402de..3c0c487821 100644
--- a/plugins/TabSRMM/src/chat_main.cpp
+++ b/plugins/TabSRMM/src/chat_main.cpp
@@ -64,16 +64,14 @@ static void OnNewUser(SESSION_INFO *si, USERINFO*)
{
if (si->pDlg) {
si->pDlg->UpdateNickList();
- if (si->pDlg)
- si->pDlg->GetMyNick();
+ si->pDlg->GetMyNick();
}
}
static void OnChangeNick(SESSION_INFO *si)
{
if (si->pDlg) {
- if (si->pDlg)
- si->pDlg->GetMyNick();
+ si->pDlg->GetMyNick();
si->pDlg->UpdateStatusBar();
}
}
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp
index a329b85f59..74c634b913 100644
--- a/plugins/TabSRMM/src/chat_window.cpp
+++ b/plugins/TabSRMM/src/chat_window.cpp
@@ -1585,7 +1585,7 @@ void CChatRoomDlg::OnInitDialog()
m_log.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
m_log.SendMsg(EM_AUTOURLDETECT, 1, 0);
SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_PANELSPLITTER), GWLP_WNDPROC, (LONG_PTR)SplitterSubclassProc);
- TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPENING, 0);
+ FireEvent(MSG_WINDOW_EVT_OPENING, 0);
m_log.SendMsg(EM_SETEVENTMASK, 0, m_log.SendMsg(EM_GETEVENTMASK, 0, 0) | ENM_LINK | ENM_MOUSEEVENTS | ENM_KEYEVENTS);
m_log.SendMsg(EM_LIMITTEXT, 0x7FFFFFFF, 0);
@@ -1640,7 +1640,7 @@ void CChatRoomDlg::OnInitDialog()
ShowWindow(m_hwnd, SW_SHOW);
UpdateNickList();
m_pContainer->hwndActive = m_hwnd;
- TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPEN, 0);
+ FireEvent(MSG_WINDOW_EVT_OPEN, 0);
}
void CChatRoomDlg::OnDestroy()
@@ -1656,7 +1656,7 @@ void CChatRoomDlg::OnDestroy()
m_si->pDlg = nullptr;
m_si = nullptr;
- TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING, 0);
+ FireEvent(MSG_WINDOW_EVT_CLOSING, 0);
DM_FreeTheme();
@@ -1685,7 +1685,7 @@ void CChatRoomDlg::OnDestroy()
M.RemoveWindow(m_hwnd);
- TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSE, 0);
+ FireEvent(MSG_WINDOW_EVT_CLOSE, 0);
memset((void*)&m_pContainer->mOld, -1000, sizeof(MARGINS));
PostMessage(m_pContainer->hwnd, WM_SIZE, 0, 1);
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index 5fe3659af7..c4614cd6ec 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -98,19 +98,11 @@ void TSAPI SetAeroMargins(TContainerData *pContainer)
if (!dat)
return;
- RECT rcWnd;
- if (!dat->isChat()) {
- if (dat->m_pPanel.isActive())
- GetWindowRect(GetDlgItem(dat->GetHwnd(), IDC_LOG), &rcWnd);
- else
- GetWindowRect(dat->GetHwnd(), &rcWnd);
- }
- else {
- if (dat->m_pPanel.isActive())
- GetWindowRect(GetDlgItem(dat->GetHwnd(), IDC_LOG), &rcWnd);
- else
- GetWindowRect(dat->GetHwnd(), &rcWnd);
- }
+ RECT rcWnd;
+ if (dat->m_pPanel.isActive())
+ GetWindowRect(GetDlgItem(dat->GetHwnd(), IDC_LOG), &rcWnd);
+ else
+ GetWindowRect(dat->GetHwnd(), &rcWnd);
POINT pt = { rcWnd.left, rcWnd.top };
ScreenToClient(pContainer->hwnd, &pt);
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp
index b28bfd6f17..ce9153185f 100644
--- a/plugins/TabSRMM/src/controls.cpp
+++ b/plugins/TabSRMM/src/controls.cpp
@@ -479,13 +479,13 @@ void CMenuBar::configureMenu() const
{
CSrmmWindow *dat = (CSrmmWindow*)::GetWindowLongPtr(m_pContainer->hwndActive, GWLP_USERDATA);
if (dat) {
- bool fChat = (dat->isChat());
+ bool fChat = dat->isChat();
::SendMessage(m_hwndToolbar, TB_SETSTATE, 103, fChat ? TBSTATE_HIDDEN : TBSTATE_ENABLED);
::SendMessage(m_hwndToolbar, TB_SETSTATE, 104, fChat ? TBSTATE_ENABLED : TBSTATE_HIDDEN);
::SendMessage(m_hwndToolbar, TB_SETSTATE, 105, fChat ? TBSTATE_HIDDEN : TBSTATE_ENABLED);
- if (!dat->isChat())
+ if (!fChat)
::EnableWindow(GetDlgItem(dat->GetHwnd(), IDC_TIME), TRUE);
}
}
diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h
index 2071898080..1f5dd03cc0 100644
--- a/plugins/TabSRMM/src/functions.h
+++ b/plugins/TabSRMM/src/functions.h
@@ -97,7 +97,6 @@ void TSAPI ApplyContainerSetting(TContainerData *pContainer, DWORD flags, UINT
void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WPARAM wParam, LPARAM lParam);
void TSAPI GetDefaultContainerTitleFormat();
void TSAPI SetAeroMargins(TContainerData *pContainer);
-int TABSRMM_FireEvent(MCONTACT hContact, HWND hwnd, unsigned int type, unsigned int subType);
INT_PTR MessageWindowOpened(WPARAM wParam, LPARAM lParam);
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index 40bcd17ce3..19571031e5 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -941,20 +941,15 @@ void CTabBaseDlg::DM_ThemeChanged()
m_hTheme = OpenThemeData(m_hwnd, L"EDIT");
- if (!isChat()) {
- if (m_hTheme != 0 || (CSkin::m_skinEnabled && !item_log->IGNORED))
- SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_EXSTYLE) & ~WS_EX_STATICEDGE);
- if (m_hTheme != 0 || (CSkin::m_skinEnabled && !item_msg->IGNORED))
- SetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE) & ~WS_EX_STATICEDGE);
- }
- else {
- if (m_hTheme != 0 || (CSkin::m_skinEnabled && !item_log->IGNORED)) {
- SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_EXSTYLE) & ~WS_EX_STATICEDGE);
+ if (m_hTheme != 0 || (CSkin::m_skinEnabled && !item_log->IGNORED)) {
+ SetWindowLongPtr(m_log.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_log.GetHwnd(), GWL_EXSTYLE) & ~WS_EX_STATICEDGE);
+ if (isChat())
SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LIST), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LIST), GWL_EXSTYLE) & ~(WS_EX_CLIENTEDGE | WS_EX_STATICEDGE));
- }
- if (m_hTheme != 0 || (CSkin::m_skinEnabled && !item_msg->IGNORED))
- SetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE) & ~WS_EX_STATICEDGE);
}
+
+ if (m_hTheme != 0 || (CSkin::m_skinEnabled && !item_msg->IGNORED))
+ SetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE) & ~WS_EX_STATICEDGE);
+
m_hThemeIP = M.isAero() ? OpenThemeData(m_hwnd, L"ButtonStyle") : 0;
m_hThemeToolbar = (M.isAero() || (!CSkin::m_skinEnabled && M.isVSThemed())) ? OpenThemeData(m_hwnd, L"REBAR") : 0;
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 9968b46906..0ad090b764 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -335,7 +335,7 @@ void CSrmmWindow::MsgWindowUpdateState(UINT msg)
RECT rcRTF;
POINT pt;
- GetWindowRect(GetDlgItem(m_hwnd, IDC_LOG), &rcRTF);
+ GetWindowRect(m_log.GetHwnd(), &rcRTF);
rcRTF.left += 20;
rcRTF.top += 20;
pt.x = rcRTF.left;
@@ -1078,7 +1078,7 @@ void CSrmmWindow::OnInitDialog()
SendDlgItemMessage(m_hwnd, IDC_TOGGLESIDEBAR, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0);
SendDlgItemMessage(m_hwnd, IDC_TOGGLESIDEBAR, BUTTONSETASTOOLBARBUTTON, TRUE, 0);
- TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPENING, 0);
+ FireEvent(MSG_WINDOW_EVT_OPENING);
for (int i = 0; i < _countof(tooltips); i++)
SendDlgItemMessage(m_hwnd, tooltips[i].id, BUTTONADDTOOLTIP, (WPARAM)TranslateW(tooltips[i].text), BATF_UNICODE);
@@ -1217,7 +1217,7 @@ void CSrmmWindow::OnInitDialog()
mir_subclassWindow(m_hwndHPP, HPPKFSubclassProc);
m_dwFlags &= ~MWF_INITMODE;
- TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPEN, 0);
+ FireEvent(MSG_WINDOW_EVT_OPEN);
if (m_pContainer->dwFlags & CNT_CREATE_MINIMIZED) {
m_pContainer->dwFlags &= ~CNT_CREATE_MINIMIZED;
@@ -1246,7 +1246,7 @@ void CSrmmWindow::OnDestroy()
DestroyWindow(m_hwndPanelPicParent);
if (m_cache->isValid()) { // not valid means the contact was deleted
- TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING, 0);
+ FireEvent(MSG_WINDOW_EVT_CLOSING);
AddContactToFavorites(m_hContact, m_cache->getNick(), m_cache->getActiveProto(), m_wszStatus, m_wStatus,
Skin_LoadProtoIcon(m_cache->getActiveProto(), m_cache->getActiveStatus()), 1, PluginConfig.g_hMenuRecent);
if (m_hContact) {
@@ -1305,7 +1305,7 @@ void CSrmmWindow::OnDestroy()
m_iTabID = -1;
}
- TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSE, 0);
+ FireEvent(MSG_WINDOW_EVT_CLOSE);
// clean up IEView and H++ log windows
if (m_hwndIEView != 0) {
@@ -1527,7 +1527,7 @@ void CSrmmWindow::onClick_Ok(CCtrlButton*)
DeletePopupsForContact(m_hContact, PU_REMOVE_ON_SEND);
if (M.GetByte("allow_sendhook", 0)) {
- int result = TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CUSTOM, MAKELONG(flags, tabMSG_WINDOW_EVT_CUSTOM_BEFORESEND));
+ int result = FireEvent(MSG_WINDOW_EVT_CUSTOM, MAKELONG(flags, tabMSG_WINDOW_EVT_CUSTOM_BEFORESEND));
if (result)
return;
}
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 9049314a48..cd5e765b0c 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -835,33 +835,27 @@ void TSAPI CreateImageList(BOOL bInitial)
PluginConfig.g_IconTypingEvent = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING];
}
-int TABSRMM_FireEvent(MCONTACT hContact, HWND hwnd, unsigned int type, unsigned int subType)
+int CTabBaseDlg::FireEvent(unsigned int type, unsigned int subType)
{
- if (hContact == 0 || hwnd == nullptr)
+ if (m_hContact == 0 || m_hwnd == nullptr)
return 0;
- CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(m_hwnd, GWLP_USERDATA);
if (dat == nullptr)
return 0;
MessageWindowEventData mwe = { sizeof(mwe) };
- mwe.hContact = hContact;
- mwe.hwndWindow = hwnd;
+ mwe.hContact = m_hContact;
+ mwe.hwndWindow = m_hwnd;
mwe.szModule = "tabSRMsgW";
mwe.uType = type;
- if (!dat->isChat()) {
- mwe.hwndInput = GetDlgItem(hwnd, IDC_MESSAGE);
- mwe.hwndLog = GetDlgItem(hwnd, IDC_LOG);
- }
- else {
- mwe.hwndInput = GetDlgItem(hwnd, IDC_MESSAGE);
- mwe.hwndLog = GetDlgItem(hwnd, IDC_LOG);
- }
+ mwe.hwndInput = m_message.GetHwnd();
+ mwe.hwndLog = m_log.GetHwnd();
if (type == MSG_WINDOW_EVT_CUSTOM) {
TABSRMM_SessionInfo se = { sizeof(se) };
se.evtCode = HIWORD(subType);
- se.hwnd = hwnd;
+ se.hwnd = m_hwnd;
se.extraFlags = (unsigned int)(LOWORD(subType));
se.local = dat->m_sendBuffer;
mwe.local = &se;
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index a37b4d55a8..4f447a454d 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -246,6 +246,7 @@ protected:
void DetermineMinHeight();
void FindFirstEvent();
+ int FireEvent(unsigned int type, unsigned int subType = 0);
void GetSendFormat();
bool IsAutoSplitEnabled() const;
void LoadContactAvatar();