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

Modified Files:
        TrackPanel.cpp LabelTrack.cpp 
Log Message:
Fix dragging of label handles to when mouse passes left/right boundaries.

Index: LabelTrack.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/LabelTrack.cpp,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- LabelTrack.cpp      23 May 2007 23:31:19 -0000      1.80
+++ LabelTrack.cpp      27 May 2007 16:37:37 -0000      1.81
@@ -1095,12 +1095,22 @@
       //just reset its value and redraw.
       if(mIsAdjustingLabel )  // This guard is necessary but hides another 
bug.  && mSelIndex != -1)
       {
+         // LL:  Constrain to inside track rectangle for now.  Should be 
changed
+         //      to allow scrolling while dragging labels
+         int x = evt.m_x + mxMouseDisplacement - r.x;
+         if (x < 0) {
+            x = 0;
+         }
+         else if (x > r.width - 2) {
+            x = r.width - 2;
+         }
+
          //Adjust boundary and make sure that t < t1 on any dragged labels.
          //This code pushes both of them in one direction, instead of swapping
          //bounds like happens for the selection region.
          if(mMouseOverLabelLeft>=0)
          {
-            mLabels[mMouseOverLabelLeft]->t  = h + 
(evt.m_x+mxMouseDisplacement - r.x)/pps;
+            mLabels[mMouseOverLabelLeft]->t  = h + x / pps;
             if( mLabels[mMouseOverLabelLeft]->t > 
mLabels[mMouseOverLabelLeft]->t1)
             {
                mLabels[mMouseOverLabelLeft]->t1  = 
mLabels[mMouseOverLabelLeft]->t;
@@ -1109,7 +1119,7 @@
          }
          if (mMouseOverLabelRight>=0)
          {
-            mLabels[mMouseOverLabelRight]->t1 = h + 
(evt.m_x+mxMouseDisplacement - r.x)/pps;
+            mLabels[mMouseOverLabelRight]->t1 = h + x / pps;
             if( mLabels[mMouseOverLabelRight]->t > 
mLabels[mMouseOverLabelRight]->t1)
             {
                mLabels[mMouseOverLabelRight]->t  = 
mLabels[mMouseOverLabelRight]->t1;

Index: TrackPanel.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/TrackPanel.cpp,v
retrieving revision 1.355
retrieving revision 1.356
diff -u -d -r1.355 -r1.356
--- TrackPanel.cpp      23 May 2007 22:02:23 -0000      1.355
+++ TrackPanel.cpp      27 May 2007 16:37:37 -0000      1.356
@@ -3887,6 +3887,9 @@
    case IsZooming:
       HandleZoom(event);
       break;
+   case IsAdjustingLabel:
+      HandleLabelTrackMouseEvent((LabelTrack *)mCapturedTrack, mCapturedRect, 
event);
+      break;
    default: //includes case of IsUncaptured
       HandleTrackSpecificMouseEvent(event);
       break;
@@ -4036,6 +4039,9 @@
       if(lTrack->OverGlyph(event.m_x, event.m_y))
       {
          SetCapturedTrack(lTrack, IsAdjustingLabel);
+         mCapturedRect = r; 
+         mCapturedRect.x += kLeftInset;
+         mCapturedRect.width -= kLeftInset;
       }
    } else if (event.Dragging()) {
       ;
@@ -4043,7 +4049,7 @@
       SetCapturedTrack( NULL );
    }
    
-   if (lTrack->HandleMouse(event, r,//mCapturedRect,
+   if (lTrack->HandleMouse(event, mCapturedRect,
       mViewInfo->h, mViewInfo->zoom, &mViewInfo->sel0, &mViewInfo->sel1)) {
 
       MakeParentPushState(_("Modified Label"),


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to