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

Modified Files:
        TrackPanel.cpp TrackPanel.h 
Log Message:
Use wxInt64 for all position coordinates in PositionToTime() and 
TimeToPosition(), might fix zoom issues

Index: TrackPanel.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/TrackPanel.cpp,v
retrieving revision 1.348
retrieving revision 1.349
diff -u -d -r1.348 -r1.349
--- TrackPanel.cpp      28 Mar 2007 04:14:03 -0000      1.348
+++ TrackPanel.cpp      28 Mar 2007 18:57:44 -0000      1.349
@@ -1323,8 +1323,8 @@
    if (!t || !t->GetSelected()) 
       return;
 
-   int leftSel = TimeToPosition(mViewInfo->sel0, r.x);
-   int rightSel = TimeToPosition(mViewInfo->sel1, r.x);
+   wxInt64 leftSel = TimeToPosition(mViewInfo->sel0, r.x);
+   wxInt64 rightSel = TimeToPosition(mViewInfo->sel1, r.x);
 
    // Something is wrong if right edge comes before left edge
    wxASSERT(!(rightSel < leftSel));
@@ -1639,8 +1639,8 @@
       }  
    //Make sure you are within the selected track
    if (pTrack && pTrack->GetSelected()) {
-      int leftSel = TimeToPosition(mViewInfo->sel0, r.x);
-      int rightSel = TimeToPosition(mViewInfo->sel1, r.x);
+      wxInt64 leftSel = TimeToPosition(mViewInfo->sel0, r.x);
+      wxInt64 rightSel = TimeToPosition(mViewInfo->sel1, r.x);
       wxASSERT(leftSel <= rightSel);
       // Adjusting selection edges can be turned off in the
       // preferences now
@@ -1813,7 +1813,7 @@
    // Can someone make this value of '5' configurable in
    // preferences?
    const int minimumSizedSelection = 5; //measured in pixels
-   int SelStart=TimeToPosition( mSelStart, r.x); //cvt time to pixels.
+   wxInt64 SelStart=TimeToPosition( mSelStart, r.x); //cvt time to pixels.
    // Abandon this drag if selecting < 5 pixels.
    if(abs( SelStart-x) < minimumSizedSelection)
        return;
@@ -1844,7 +1844,8 @@
 /// Converts a position (mouse X coordinate) to 
 /// project time, in seconds.  Needs the left edge of
 /// the track as an additional parameter.
-double TrackPanel::PositionToTime(int mouseXCoordinate, int trackLeftEdge) 
const
+double TrackPanel::PositionToTime(wxInt64 mouseXCoordinate,
+                                  wxInt64 trackLeftEdge) const
 {
    return mViewInfo->h + ((mouseXCoordinate - trackLeftEdge)
                           / mViewInfo->zoom);
@@ -1852,11 +1853,12 @@
 
 
 /// STM: Converts a project time to screen x position.
-int TrackPanel::TimeToPosition(double projectTime, int trackLeftEdge) const
+wxInt64 TrackPanel::TimeToPosition(double projectTime,
+                                   wxInt64 trackLeftEdge) const
 {
    return static_cast <
-       int >(mViewInfo->zoom * (projectTime - mViewInfo->h) +
-             trackLeftEdge);
+       wxInt64 >(mViewInfo->zoom * (projectTime - mViewInfo->h) +
+                 trackLeftEdge);
 }
 
 /// HandleEnvelope gets called when the user is changing the
@@ -4508,9 +4510,9 @@
    if (mSnapManager && (mSnapLeft >= 0 || mSnapRight >= 0)) {
       AColor::SnapGuidePen(dc);
       if (mSnapLeft >= 0)
-         dc->DrawLine(mSnapLeft, 0, mSnapLeft, 30000);
+         dc->DrawLine((int)mSnapLeft, 0, mSnapLeft, 30000);
       if (mSnapRight >= 0)
-         dc->DrawLine(mSnapRight, 0, mSnapRight, 30000);
+         dc->DrawLine((int)mSnapRight, 0, mSnapRight, 30000);
    }
 }
 

Index: TrackPanel.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/TrackPanel.h,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- TrackPanel.h        17 Mar 2007 04:21:36 -0000      1.113
+++ TrackPanel.h        28 Mar 2007 18:57:44 -0000      1.114
@@ -473,8 +473,8 @@
    // are the horizontal index of pixels to display user feedback
    // guidelines so the user knows when such snapping is taking place.
    SnapManager *mSnapManager;
-   int mSnapLeft;
-   int mSnapRight;
+   wxInt64 mSnapLeft;
+   wxInt64 mSnapRight;
    bool mSnapPreferRightEdge;
 
    Track * mDrawingTrack;          // Keeps track of which track you are 
drawing on between events cf. HandleDraw()
@@ -485,10 +485,10 @@
    float mDrawingLastDragSampleValue;  // value of last drag-over
    wxRect mLastDrawnTrackRect;
  
-   double PositionToTime(int mouseXCoordinate,
-                         int trackLeftEdge) const;
-   int TimeToPosition(double time,
-                      int trackLeftEdge) const;
+   double PositionToTime(wxInt64 mouseXCoordinate,
+                         wxInt64 trackLeftEdge) const;
+   wxInt64 TimeToPosition(double time,
+                          wxInt64 trackLeftEdge) const;
 
    int mInitialTrackHeight;
    int mInitialUpperTrackHeight;


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to