OSDN Git Service

PATCH: [ 1865220 ] Close Tab OnMButtonDown
authorKimmo Varis <kimmov@gmail.com>
Tue, 8 Jan 2008 17:41:18 +0000 (17:41 +0000)
committerKimmo Varis <kimmov@gmail.com>
Tue, 8 Jan 2008 17:41:18 +0000 (17:41 +0000)
 - submitted by Dmitry Maslov

Docs/Users/ChangeLog.txt
Src/Common/MDITabBar.cpp
Src/Common/MDITabBar.h

index 2015790..f2d408c 100644 (file)
@@ -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 
index 41ad2bb..956a34d 100644 (file)
@@ -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);
+}
index 01cef17..5e001c4 100644 (file)
@@ -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()
 };