From: Kimmo Varis Date: Tue, 8 Jan 2008 17:41:18 +0000 (+0000) Subject: PATCH: [ 1865220 ] Close Tab OnMButtonDown X-Git-Tag: 2.16.5~3750 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=2ad38d696522c846a843b06d9b4c039ab1385794;p=winmerge-jp%2Fwinmerge-jp.git PATCH: [ 1865220 ] Close Tab OnMButtonDown - submitted by Dmitry Maslov --- diff --git a/Docs/Users/ChangeLog.txt b/Docs/Users/ChangeLog.txt index 2015790f5..f2d408c03 100644 --- a/Docs/Users/ChangeLog.txt +++ b/Docs/Users/ChangeLog.txt @@ -8,6 +8,7 @@ WinMerge 2.7.7.2 Horizontal scrolling with Shift + MouseWheel (#1865795) Installer: Add support for integration with latest version of TortoiseCVS and TortoiseSVN x64 (#1865168) + Close file compare tab with middle mouse button (#1865220) BugFix: Crash when using TrackPoint middle-button scrolling (#1864040) BugFix: WinMerge didn't show the contents of the symbolic link target (#1864978) BugFix: Unused registry key HKCU\Thingamahoochie\WinMerge was created diff --git a/Src/Common/MDITabBar.cpp b/Src/Common/MDITabBar.cpp index 41ad2bb89..956a34dba 100644 --- a/Src/Common/MDITabBar.cpp +++ b/Src/Common/MDITabBar.cpp @@ -3,7 +3,7 @@ * * @brief Implementation of the MDITabBar class */ -// RCS ID line follows -- this is updated by CVS +// ID line follows -- this is updated by SVN // $Id$ #include "stdafx.h" @@ -24,6 +24,7 @@ IMPLEMENT_DYNAMIC(CMDITabBar, CControlBar) BEGIN_MESSAGE_MAP(CMDITabBar, CControlBar) //{{AFX_MSG_MAP(CMDITabBar) + ON_WM_MBUTTONDOWN() ON_WM_CONTEXTMENU() ON_WM_PAINT() ON_NOTIFY_REFLECT_EX(TCN_SELCHANGE, OnSelchange) @@ -195,3 +196,22 @@ void CMDITabBar::UpdateTabs() } } } + +/** + * @brief Called when middle mouse button is pressed. + * This function closes the tab when the middle mouse button is pressed. + */ +void CMDITabBar::OnMButtonDown(UINT nFlags, CPoint point) +{ + TCHITTESTINFO hit; + hit.pt = point; + int index = HitTest(&hit); + if (index < 0) + return; + + TCITEM tci; + tci.mask = TCIF_PARAM; + GetItem(index, &tci); + CWnd* pMDIChild = FromHandle((HWND)tci.lParam); + pMDIChild->SendMessage(WM_SYSCOMMAND, SC_CLOSE); +} diff --git a/Src/Common/MDITabBar.h b/Src/Common/MDITabBar.h index 01cef176a..5e001c439 100644 --- a/Src/Common/MDITabBar.h +++ b/Src/Common/MDITabBar.h @@ -4,7 +4,7 @@ * @brief Declaration file for MDITabBar * */ -// RCS ID line follows -- this is updated by CVS +// ID line follows -- this is updated by SVN // $Id$ #ifndef MDITABBAR_H @@ -52,6 +52,7 @@ protected: afx_msg void OnPaint(); afx_msg BOOL OnSelchange(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); + afx_msg void OnMButtonDown(UINT nFlags, CPoint point); //}}AFX_MSG DECLARE_MESSAGE_MAP() };