diff options
author | George Hazan <ghazan@miranda.im> | 2017-03-11 16:33:16 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-03-11 16:33:16 +0300 |
commit | 2b419ed6e80f65138a198f32a3ffe85bf39a5fcb (patch) | |
tree | dbae4aba940cebfffb67d79d9b27501f20476b98 /plugins | |
parent | 03445a3f1a04fcff892832b928308d37aeeea3cb (diff) |
GC_CLOSEWINDOW -> CloseTab()
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Scriver/src/chat/window.cpp | 4 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.cpp | 5 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.h | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_window.cpp | 94 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 4 |
5 files changed, 59 insertions, 52 deletions
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index 4b1e6006db..740b4ff579 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -1670,10 +1670,6 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) DestroyMenu(hMenu);
}
break;
-
- case GC_CLOSEWINDOW:
- Close();
- break;
}
return CScriverWindow::DlgProc(uMsg, wParam, lParam);
}
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index fa0f0a6265..98908c14ee 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -366,6 +366,11 @@ CScriverWindow::CScriverWindow(int iDialog, SESSION_INFO *si) m_autoClose = CLOSE_ON_CANCEL;
}
+void CScriverWindow::CloseTab(bool)
+{
+ Close();
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// status icons processing
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index 873fd5ab90..55a97e5a83 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -91,6 +91,8 @@ protected: CScriverWindow(int iDialog, SESSION_INFO* = nullptr);
public:
+ virtual void CloseTab(bool bForced = false) override;
+
ParentWindowData *m_pParent;
int m_minLogBoxHeight, m_minEditBoxHeight;
HWND m_hwndIeview;
@@ -148,6 +150,7 @@ public: virtual void OnInitDialog() override;
virtual void OnDestroy() override;
+
virtual void UpdateTitle() override;
virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
@@ -190,6 +193,7 @@ public: virtual void OnDestroy() override;
virtual INT_PTR DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) override;
+
virtual void UpdateTitle() override;
void onChange_Message(CCtrlEdit*);
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index 219613964d..d688d2ca85 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -595,7 +595,7 @@ LRESULT CALLBACK CChatRoomDlg::MessageSubclassProc(HWND hwnd, UINT msg, WPARAM w bool isShift, isAlt, isCtrl; mwdat->KbdState(isShift, isCtrl, isAlt); - if (PluginConfig.m_bSoundOnTyping && !isAlt &&!isCtrl&&!(mwdat->m_pContainer->dwFlags & CNT_NOSOUND) && wParam != VK_ESCAPE&&!(wParam == VK_TAB && PluginConfig.m_bAllowTab)) + if (PluginConfig.m_bSoundOnTyping && !isAlt && !isCtrl && !(mwdat->m_pContainer->dwFlags & CNT_NOSOUND) && wParam != VK_ESCAPE && !(wParam == VK_TAB && PluginConfig.m_bAllowTab)) SkinPlaySound("SoundOnTyping"); if (isCtrl && !isAlt && !isShift) { @@ -1950,6 +1950,50 @@ void CChatRoomDlg::onDblClick_List(CCtrlListBox*) ///////////////////////////////////////////////////////////////////////////////////////// +void CChatRoomDlg::CloseTab(bool bForced) +{ + int iTabs = TabCtrl_GetItemCount(m_hwndParent); + if (iTabs == 1 && CMimAPI::m_shutDown == 0) { + SendMessage(m_pContainer->hwnd, WM_CLOSE, 0, 1); + return; + } + + m_pContainer->iChilds--; + int i = GetTabIndexFromHWND(m_hwndParent, m_hwnd); + + // after closing a tab, we need to activate the tab to the left side of + // the previously open tab. + // normally, this tab has the same index after the deletion of the formerly active tab + // unless, of course, we closed the last (rightmost) tab. + if (!m_pContainer->bDontSmartClose && iTabs > 1 && !bForced) { + if (i == iTabs - 1) + i--; + else + i++; + TabCtrl_SetCurSel(m_hwndParent, i); + + TCITEM item = {}; + item.mask = TCIF_PARAM; + TabCtrl_GetItem(m_hwndParent, i, &item); // retrieve dialog hwnd for the now active tab... + m_pContainer->hwndActive = (HWND)item.lParam; + + RECT rc; + SendMessage(m_pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc); + SetWindowPos(m_pContainer->hwndActive, HWND_TOP, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_SHOWWINDOW); + ShowWindow((HWND)item.lParam, SW_SHOW); + SetForegroundWindow(m_pContainer->hwndActive); + SetFocus(m_pContainer->hwndActive); + SendMessage(m_pContainer->hwnd, WM_SIZE, 0, 0); + } + + if (iTabs == 1) + SendMessage(m_pContainer->hwnd, WM_CLOSE, 0, 1); + else { + PostMessage(m_pContainer->hwnd, WM_SIZE, 0, 0); + DestroyWindow(m_hwnd); + } +} + void CChatRoomDlg::UpdateTitle() { m_wStatus = m_si->wStatus; @@ -2915,53 +2959,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) } _dlgReturn(m_hwnd, TRUE); } - SendMessage(m_hwnd, GC_CLOSEWINDOW, 0, 1); - return 0; - - case GC_CLOSEWINDOW: - { - bool bForced = (lParam == 2); - - int iTabs = TabCtrl_GetItemCount(m_hwndParent); - if (iTabs == 1 && CMimAPI::m_shutDown == 0) { - SendMessage(m_pContainer->hwnd, WM_CLOSE, 0, 1); - return 1; - } - - m_pContainer->iChilds--; - int i = GetTabIndexFromHWND(m_hwndParent, m_hwnd); - - // after closing a tab, we need to activate the tab to the left side of - // the previously open tab. - // normally, this tab has the same index after the deletion of the formerly active tab - // unless, of course, we closed the last (rightmost) tab. - if (!m_pContainer->bDontSmartClose && iTabs > 1 && !bForced) { - if (i == iTabs - 1) - i--; - else - i++; - TabCtrl_SetCurSel(m_hwndParent, i); - - TCITEM item = {}; - item.mask = TCIF_PARAM; - TabCtrl_GetItem(m_hwndParent, i, &item); // retrieve dialog hwnd for the now active tab... - m_pContainer->hwndActive = (HWND)item.lParam; - - SendMessage(m_pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc); - SetWindowPos(m_pContainer->hwndActive, HWND_TOP, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), SWP_SHOWWINDOW); - ShowWindow((HWND)item.lParam, SW_SHOW); - SetForegroundWindow(m_pContainer->hwndActive); - SetFocus(m_pContainer->hwndActive); - SendMessage(m_pContainer->hwnd, WM_SIZE, 0, 0); - } - - if (iTabs == 1) - SendMessage(m_pContainer->hwnd, WM_CLOSE, 0, 1); - else { - PostMessage(m_pContainer->hwnd, WM_SIZE, 0, 0); - DestroyWindow(m_hwnd); - } - } + CloseTab(true); return 0; case DM_SAVESIZE: diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index a2777ce4aa..7dc383a505 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -455,6 +455,8 @@ public: virtual void OnDestroy() override;
virtual int Resizer(UTILRESIZECONTROL *urc) override;
+
+ virtual void CloseTab(bool) override {};
virtual void UpdateTitle() override;
virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
@@ -496,6 +498,8 @@ public: virtual void OnDestroy() override;
virtual int Resizer(UTILRESIZECONTROL *urc) override;
+
+ virtual void CloseTab(bool bForced = false) override;
virtual void UpdateTitle() override;
virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
|