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

Modified Files:
        AButton.cpp AButton.h ASlider.cpp ASlider.h Ruler.cpp Ruler.h 
Log Message:
Add handling of mouse capture lost events.

Index: ASlider.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/ASlider.cpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- ASlider.cpp 28 Jun 2008 21:10:53 -0000      1.63
+++ ASlider.cpp 25 Jul 2008 03:39:51 -0000      1.64
@@ -1073,6 +1073,7 @@
 BEGIN_EVENT_TABLE(ASlider, wxWindow)
    EVT_CHAR(ASlider::OnKeyEvent)
    EVT_MOUSE_EVENTS(ASlider::OnMouseEvent)
+   EVT_MOUSE_CAPTURE_LOST(ASlider::OnCaptureLost)
    EVT_PAINT(ASlider::OnPaint)
    EVT_SIZE(ASlider::OnSize)
    EVT_ERASE_BACKGROUND(ASlider::OnErase)
@@ -1168,6 +1169,12 @@
    mLWSlider->OnMouseEvent(event);
 }
 
+void ASlider::OnCaptureLost(wxMouseCaptureLostEvent &event)
+{
+   wxMouseEvent e(wxEVT_LEFT_UP);
+   mLWSlider->OnMouseEvent(e);
+}
+
 void ASlider::OnKeyEvent(wxKeyEvent &event)
 {
    mLWSlider->OnKeyEvent(event);

Index: Ruler.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/Ruler.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- Ruler.cpp   13 Jul 2008 22:58:08 -0000      1.53
+++ Ruler.cpp   25 Jul 2008 03:39:51 -0000      1.54
@@ -1432,6 +1432,7 @@
    EVT_PAINT(AdornedRulerPanel::OnPaint)
    EVT_SIZE(AdornedRulerPanel::OnSize)
    EVT_MOUSE_EVENTS(AdornedRulerPanel::OnMouseEvents)
+   EVT_MOUSE_CAPTURE_LOST(AdornedRulerPanel::OnCaptureLost)
 END_EVENT_TABLE()
 
 AdornedRulerPanel::AdornedRulerPanel(wxWindow* parent,
@@ -1562,7 +1563,9 @@
 {
    bool isWithinStart = IsWithinMarker(evt.GetX(), mPlayRegionStart);
    bool isWithinEnd = IsWithinMarker(evt.GetX(), mPlayRegionEnd);
-   
+
+   mLastMouseX = evt.GetX();
+
    if (isWithinStart || isWithinEnd)
       SetCursor(wxCursor(wxCURSOR_SIZEWE));
    else
@@ -1664,6 +1667,13 @@
    }
 }
 
+void AdornedRulerPanel::OnCaptureLost(wxMouseCaptureLostEvent &evt)
+{
+   wxMouseEvent e(wxEVT_LEFT_UP);
+   e.m_x = mLastMouseX;
+   OnMouseEvents(e);
+}
+
 void AdornedRulerPanel::DoDrawPlayRegion(wxDC * dc)
 {
    double start, end;

Index: Ruler.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/Ruler.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- Ruler.h     13 Jul 2008 22:58:08 -0000      1.25
+++ Ruler.h     25 Jul 2008 03:39:51 -0000      1.26
@@ -257,6 +257,7 @@
    void OnPaint(wxPaintEvent &evt);
    void OnSize(wxSizeEvent &evt);
    void OnMouseEvents(wxMouseEvent &evt);
+   void OnCaptureLost(wxMouseCaptureLostEvent &evt);
 
    void DoDrawBorder(wxDC * dc);
    void DoDrawMarks(wxDC * dc, bool /*text */ );
@@ -299,6 +300,7 @@
    
    MouseEventState mMouseEventState;
    int mButtonDownMousePos;
+   int mLastMouseX;
 
    DECLARE_EVENT_TABLE()
 };

Index: ASlider.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/ASlider.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- ASlider.h   1 Apr 2007 07:41:07 -0000       1.26
+++ ASlider.h   25 Jul 2008 03:39:51 -0000      1.27
@@ -217,6 +217,7 @@
    void OnPaint(wxPaintEvent & event);
    void OnSize(wxSizeEvent & event);
    void OnMouseEvent(wxMouseEvent & event);
+   void OnCaptureLost(wxMouseCaptureLostEvent & event);
    void OnKeyEvent(wxKeyEvent &event);
    void OnSlider(wxCommandEvent &event);
    void OnSetFocus(wxFocusEvent & event);

Index: AButton.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/AButton.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- AButton.cpp 7 Jan 2008 23:39:16 -0000       1.43
+++ AButton.cpp 25 Jul 2008 03:39:51 -0000      1.44
@@ -37,6 +37,7 @@
 
 BEGIN_EVENT_TABLE(AButton, wxWindow)
    EVT_MOUSE_EVENTS(AButton::OnMouseEvent)
+   EVT_MOUSE_CAPTURE_LOST(AButton::OnCaptureLost)
    EVT_KEY_DOWN(AButton::OnKeyDown)
    EVT_SET_FOCUS(AButton::OnSetFocus)
    EVT_KILL_FOCUS(AButton::OnKillFocus)
@@ -310,6 +311,14 @@
    }
 }
 
+void AButton::OnCaptureLost(wxMouseCaptureLostEvent & event)
+{
+   wxMouseEvent e(wxEVT_LEFT_UP);
+   e.m_x = -1;
+   e.m_y = -1;
+   OnMouseEvent(e);
+}
+
 void AButton::OnKeyDown(wxKeyEvent & event)
 {
    switch( event.GetKeyCode() )

Index: AButton.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/AButton.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- AButton.h   7 Jan 2008 23:39:16 -0000       1.17
+++ AButton.h   25 Jul 2008 03:39:51 -0000      1.18
@@ -78,6 +78,7 @@
    virtual void OnPaint(wxPaintEvent & event);
    virtual void OnSize(wxSizeEvent & event);
    virtual void OnMouseEvent(wxMouseEvent & event);
+   virtual void OnCaptureLost(wxMouseCaptureLostEvent & event );
    virtual void OnKeyDown(wxKeyEvent & event);
    virtual void OnSetFocus(wxFocusEvent & event);
    virtual void OnKillFocus(wxFocusEvent & event);


-------------------------------------------------------------------------
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