Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv10436/src
Modified Files:
Track.cpp Track.h TrackPanel.cpp
Log Message:
-Fix problem of dragging tracks stop dragging after a bit.
-Safety belt for crash when dragging tracks - to be verified by Julian on Linux.
Index: Track.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Track.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- Track.cpp 20 May 2007 20:03:15 -0000 1.38
+++ Track.cpp 24 Aug 2007 14:00:34 -0000 1.39
@@ -383,6 +383,28 @@
return NULL;
}
+/// For mono track height of track
+/// For stereo track combined height of track and linked track.
+/// Assumes we are on the first track of the pair.
+int TrackList::GetGroupHeight( Track*t ) const
+{
+ wxASSERT( t );
+ int height=t->GetHeight();
+ if( !t->GetLinked() )
+ return height;
+
+ TrackListNode *p = head;
+ while (p) {
+ if (p->t == t) {
+ if( p->next )
+ return height + p->next->t->GetHeight();
+ }
+ p = p->next;
+ }
+ wxASSERT( false );
+ return 0;
+}
+
bool TrackList::CanMoveUp(Track * t) const
{
TrackListNode *p = head;
@@ -474,6 +496,12 @@
if (first->prev && first->prev->t->GetLinked())
first = first->prev;
+ // first could be NULL if we've tried to move up a track
+ // and there wasn't a track above.
+ wxASSERT( first );
+ if( !first )
+ return false;
+
Swap(first, second);
return true;
@@ -500,6 +528,12 @@
else
second = p->next;
+ // Second could be NULL if we've tried to move down a track
+ // and there wasn't a track below.
+ wxASSERT( second );
+ if( !second )
+ return false;
+
Swap(first, second);
return true;
}
Index: Track.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Track.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- Track.h 25 Jun 2007 23:12:34 -0000 1.39
+++ Track.h 24 Aug 2007 14:00:34 -0000 1.40
@@ -211,6 +211,7 @@
Track *GetPrev(Track * t, bool linked = false) const;
Track *GetNext(Track * t, bool linked = false) const;
+ int GetGroupHeight( Track*t ) const;
bool CanMoveUp(Track * t) const;
bool CanMoveDown(Track * t) const;
Index: TrackPanel.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/TrackPanel.cpp,v
retrieving revision 1.370
retrieving revision 1.371
diff -u -d -r1.370 -r1.371
--- TrackPanel.cpp 23 Aug 2007 11:24:08 -0000 1.370
+++ TrackPanel.cpp 24 Aug 2007 14:00:34 -0000 1.371
@@ -3401,7 +3401,9 @@
dir = _("down");
}
else
+ {
return;
+ }
MakeParentPushState(wxString::Format(_("Moved '%s' %s"),
mCapturedTrack->GetName().c_str(),
@@ -3424,15 +3426,17 @@
// user.
if (mTracks->CanMoveUp(mCapturedTrack))
mMoveUpThreshold =
- event.m_y - mTracks->GetPrev(mCapturedTrack)->GetHeight();
+ event.m_y - mTracks->GetGroupHeight(
mTracks->GetPrev(mCapturedTrack,true) );
else
mMoveUpThreshold = INT_MIN;
if (mTracks->CanMoveDown(mCapturedTrack))
mMoveDownThreshold =
- event.m_y + mTracks->GetNext(mCapturedTrack)->GetHeight();
+ event.m_y + mTracks->GetGroupHeight(
mTracks->GetNext(mCapturedTrack,true) );
else
mMoveDownThreshold = INT_MAX;
+// wxLogDebug(wxT("Y:%i, Up:%i, Down:%i"),
+// event.m_y, mMoveUpThreshold-event.m_y, mMoveDownThreshold-event.m_y );
}
bool TrackPanel::GainFunc(Track * t, wxRect r, wxMouseEvent &event,
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs