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

Modified Files:
        ASlider.h ASlider.cpp 
Log Message:
Prevent value change upon click

Index: ASlider.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/ASlider.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- ASlider.cpp 14 Jul 2006 03:25:08 -0000      1.51
+++ ASlider.cpp 5 Nov 2006 07:41:53 -0000       1.52
@@ -662,9 +662,21 @@
    {
       mParent->SetFocus();
 
-      //This jumps the thumb to clicked position
-      if (!mIsDragging) {
-         mCurrentValue = PositionToValue(event.m_x, event.ShiftDown());
+      // Figure out the thumb position
+      wxRect r;
+      r.x = mLeft + ValueToPosition(mCurrentValue);
+      r.y = mTop + (mCenterY - (mThumbHeight / 2));
+      r.width = mThumbWidth;
+      r.height = mThumbHeight;
+
+      // Thumb clicked?
+      //
+      // Do not change position until first drag.  This helps
+      // with unintended value changes.
+      if( r.Inside( event.GetPosition() ) )
+      {
+         // Remember mouse offset within thumb
+         mClickX = event.m_x - r.x - mLeftX;
 
          mIsDragging = true;
          mParent->CaptureMouse();
@@ -673,9 +685,11 @@
          SetPopWinPosition();
          mPopWin->Show();
       }
-
-      // Don't generate notification yet
-      return;
+      // Left or right hand side clicked?
+      else
+      {
+         mCurrentValue = PositionToValue(event.m_x, event.ShiftDown());
+      }
    }
    else if( event.ButtonUp() && mIsDragging )
    {
@@ -686,8 +700,8 @@
    }
    else if( event.Dragging() && mIsDragging )
    {
-      mCurrentValue = PositionToValue(event.m_x, event.ShiftDown());
-   } 
+      mCurrentValue = PositionToValue(event.m_x - mClickX, event.ShiftDown());
+   }
    else if( event.m_wheelRotation != 0 )
    {
 
@@ -920,7 +934,9 @@
                   const wxPoint & pos, 
                   const wxSize & size,
                   int style,
-                  bool popup ):
+                  bool popup,
+                  bool canUseShift,
+                  float stepValue ):
    wxPanel( parent, id, pos, size, wxWANTS_CHARS )
 {
    mLWSlider = new LWSlider( this,
@@ -928,8 +944,9 @@
                              wxPoint(0,0),
                              size,
                              style,
-                             true,
+                             canUseShift,
                              popup );
+   mLWSlider->mStepValue = stepValue;
    mLWSlider->SetId( id );
    SetName( name );
 

Index: ASlider.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/ASlider.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- ASlider.h   14 Jul 2006 03:25:08 -0000      1.23
+++ ASlider.h   5 Nov 2006 07:41:53 -0000       1.24
@@ -191,9 +191,11 @@
             const wxPoint & pos, 
             const wxSize & size,
             int style = FRAC_SLIDER,
-            bool popup = true );
+            bool popup = true,
+            bool canUseShift = true,
+            float stepValue = STEP_CONTINUOUS );
    virtual ~ASlider();
-   
+
    float Get( bool convert = true );
    void Set(float value);
 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to