Update of /cvsroot/audacity/audacity-src/src/toolbars
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv13060/toolbars

Modified Files:
        ToolBar.cpp ToolBar.h ToolManager.cpp ToolManager.h 
Log Message:
Add handling of mouse capture lost events.

Index: ToolManager.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/toolbars/ToolManager.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ToolManager.h       15 May 2007 05:50:14 -0000      1.9
+++ ToolManager.h       25 Jul 2008 03:39:51 -0000      1.10
@@ -72,6 +72,7 @@
 
    void OnTimer( wxTimerEvent & event );
    void OnMouse( wxMouseEvent & event );
+   void OnCaptureLost( wxMouseCaptureLostEvent & event );
    void OnGrabber( GrabberEvent & event );
 
    void OnIndicatorCreate( wxWindowCreateEvent & event );

Index: ToolManager.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/toolbars/ToolManager.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- ToolManager.cpp     28 Jun 2008 21:10:52 -0000      1.17
+++ ToolManager.cpp     25 Jul 2008 03:39:51 -0000      1.18
@@ -257,6 +257,14 @@
       }
    }
 
+   void OnCaptureLost( wxMouseCaptureLostEvent & event )
+   {
+      if( HasCapture() )
+      {
+         ReleaseMouse();
+      }
+   }
+
    //
    // Do not allow the window to close through keyboard accelerators
    // (like ALT+F4 on Windows)
@@ -285,6 +293,7 @@
    EVT_GRABBER( wxID_ANY, ToolFrame::OnGrabber )
    EVT_PAINT( ToolFrame::OnPaint )
    EVT_MOUSE_EVENTS( ToolFrame::OnMotion )
+   EVT_MOUSE_CAPTURE_LOST( ToolFrame::OnCaptureLost )
    EVT_CLOSE( ToolFrame::OnClose )
    EVT_COMMAND( wxID_ANY, EVT_TOOLBAR_UPDATED, ToolFrame::OnToolBarUpdate )
 END_EVENT_TABLE()
@@ -380,6 +389,10 @@
                      wxMouseEventHandler( ToolManager::OnMouse ),
                      NULL,
                      this );
+   mParent->Connect( wxEVT_MOUSE_CAPTURE_LOST,
+                     wxMouseCaptureLostEventHandler( 
ToolManager::OnCaptureLost ),
+                     NULL,
+                     this );
 
    // Create the top and bottom docks
    mTopDock = new ToolDock( this, mParent, TopDockID );
@@ -419,6 +432,10 @@
                         wxMouseEventHandler( ToolManager::OnMouse ),
                         NULL,
                         this );
+   mParent->Disconnect( wxEVT_MOUSE_CAPTURE_LOST,
+                        wxMouseCaptureLostEventHandler( 
ToolManager::OnCaptureLost ),
+                        NULL,
+                        this );
 
    // Remove our event handlers
    mIndicator->Disconnect( wxEVT_CREATE,
@@ -992,6 +1009,26 @@
 }
 
 //
+// Deal with new capture lost event
+//
+void ToolManager::OnCaptureLost( wxMouseCaptureLostEvent & event )
+{
+   // Can't do anything if we're not dragging.  This also prevents
+   // us from intercepting events that don't belong to us from the
+   // parent since we're Connect()ed to a couple.
+   if( !mDragWindow )
+   {
+      event.Skip();
+      return;
+   }
+
+   // Simulate button up
+   wxMouseEvent e(wxEVT_LEFT_UP);
+   e.SetEventObject(mParent);
+   OnMouse(e);
+}
+
+//
 // Watch for shift key changes
 //
 void ToolManager::OnTimer( wxTimerEvent & event )

Index: ToolBar.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/toolbars/ToolBar.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ToolBar.h   23 May 2008 05:54:01 -0000      1.7
+++ ToolBar.h   25 Jul 2008 03:39:51 -0000      1.8
@@ -153,6 +153,7 @@
    void OnLeftDown(wxMouseEvent & event);
    void OnLeftUp(wxMouseEvent & event);
    void OnMotion(wxMouseEvent & event);
+   void OnCaptureLost(wxMouseCaptureLostEvent & event);
 
  private:
 

Index: ToolBar.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/toolbars/ToolBar.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- ToolBar.cpp 28 Jun 2008 21:10:52 -0000      1.12
+++ ToolBar.cpp 25 Jul 2008 03:39:51 -0000      1.13
@@ -79,6 +79,7 @@
    EVT_LEFT_DOWN( ToolBar::OnLeftDown )
    EVT_LEFT_UP( ToolBar::OnLeftUp )
    EVT_MOTION( ToolBar::OnMotion )
+   EVT_MOUSE_CAPTURE_LOST( ToolBar::OnCaptureLost )
 END_EVENT_TABLE()  
 
 //
@@ -685,6 +686,14 @@
    }
 }
 
+void ToolBar::OnCaptureLost( wxMouseCaptureLostEvent & event )
+{
+   if( HasCapture() )
+   {
+      ReleaseCapture();
+   }
+}
+
 // Indentation settings for Vim and Emacs and unique identifier for Arch, a
 // version control system. Please do not modify past this point.
 //


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to