1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01:00

Remove "skiplinked" argument of old track iterators

This commit is contained in:
Paul Licameli
2016-11-03 22:10:57 -04:00
parent d19695022a
commit 89748cbe3c
7 changed files with 79 additions and 137 deletions

View File

@@ -469,7 +469,7 @@ Track *TrackListIterator::First(TrackList * val)
return nullptr;
}
Track *TrackListIterator::Last(bool skiplinked)
Track *TrackListIterator::Last()
{
if (l == NULL) {
return NULL;
@@ -479,20 +479,10 @@ Track *TrackListIterator::Last(bool skiplinked)
if ( l->isNull( cur ) )
return nullptr;
// With skiplinked set, we won't return the second channel of a linked pair
if (skiplinked) {
auto prev = l->getPrev( cur );
if ( !l->isNull( prev ) &&
!(*cur.first)->GetLinked() &&
(*cur.first)->GetLink()
)
cur = prev;
}
return cur.first->get();
}
Track *TrackListIterator::Next(bool skipLinked)
Track *TrackListIterator::Next()
{
#ifdef DEBUG_TLI // if we are debugging this bit
wxASSERT_MSG((!cur || (*l).Contains((*cur).t)), wxT("cur invalid at start of Next(). List changed since iterator created?")); // check that cur is in the list
@@ -501,16 +491,7 @@ Track *TrackListIterator::Next(bool skipLinked)
if (!l || l->isNull(cur))
return nullptr;
if (skipLinked &&
(*cur.first)->GetLinked())
cur = l->getNext( cur );
#ifdef DEBUG_TLI // if we are debugging this bit
wxASSERT_MSG((!cur || (*l).Contains((*cur).t)), wxT("cur invalid after skipping linked tracks.")); // check that cur is in the list
#endif
if (!l->isNull(cur))
cur = l->getNext( cur );
cur = l->getNext( cur );
#ifdef DEBUG_TLI // if we are debugging this bit
wxASSERT_MSG((!cur || (*l).Contains((*cur).t)), wxT("cur invalid after moving to next track.")); // check that cur is in the list if it is not null
@@ -522,7 +503,7 @@ Track *TrackListIterator::Next(bool skipLinked)
return nullptr;
}
Track *TrackListIterator::Prev(bool skiplinked)
Track *TrackListIterator::Prev()
{
if (!l || l->isNull(cur))
return nullptr;
@@ -531,12 +512,6 @@ Track *TrackListIterator::Prev(bool skiplinked)
if ( l->isNull( cur ) )
return nullptr;
if ( skiplinked ) {
auto prev = l->getPrev( cur );
if( !l->isNull( prev ) && (*prev.first)->GetLinked() )
cur = prev;
}
return cur.first->get();
}
@@ -601,9 +576,9 @@ Track *TrackListCondIterator::First(TrackList *val)
return t;
}
Track *TrackListCondIterator::Next(bool skiplinked)
Track *TrackListCondIterator::Next()
{
while (Track *t = TrackListIterator::Next(skiplinked)) {
while (Track *t = TrackListIterator::Next()) {
if (this->Condition(t)) {
return t;
}
@@ -612,9 +587,9 @@ Track *TrackListCondIterator::Next(bool skiplinked)
return NULL;
}
Track *TrackListCondIterator::Prev(bool skiplinked)
Track *TrackListCondIterator::Prev()
{
while (Track *t = TrackListIterator::Prev(skiplinked))
while (Track *t = TrackListIterator::Prev())
{
if (this->Condition(t)) {
return t;
@@ -624,12 +599,12 @@ Track *TrackListCondIterator::Prev(bool skiplinked)
return NULL;
}
Track *TrackListCondIterator::Last(bool skiplinked)
Track *TrackListCondIterator::Last()
{
Track *t = TrackListIterator::Last(skiplinked);
Track *t = TrackListIterator::Last();
while (t && !this->Condition(t)) {
t = TrackListIterator::Prev(skiplinked);
t = TrackListIterator::Prev();
}
return t;
@@ -734,9 +709,9 @@ bool SyncLockedTracksIterator::IsGoodNextTrack(const Track *t) const
return true;
}
Track *SyncLockedTracksIterator::Next(bool skiplinked)
Track *SyncLockedTracksIterator::Next()
{
Track *t = TrackListIterator::Next(skiplinked);
Track *t = TrackListIterator::Next();
if (!t)
return nullptr;
@@ -751,9 +726,9 @@ Track *SyncLockedTracksIterator::Next(bool skiplinked)
return t;
}
Track *SyncLockedTracksIterator::Prev(bool skiplinked)
Track *SyncLockedTracksIterator::Prev()
{
Track *t = TrackListIterator::Prev(skiplinked);
Track *t = TrackListIterator::Prev();
//
// Ways to end a sync-locked group in reverse
@@ -781,17 +756,17 @@ Track *SyncLockedTracksIterator::Prev(bool skiplinked)
return t;
}
Track *SyncLockedTracksIterator::Last(bool skiplinked)
Track *SyncLockedTracksIterator::Last()
{
if ( !l || l->isNull( cur ) )
return nullptr;
Track *t = cur.first->get();
while (const auto next = l->GetNext(t, skiplinked)) {
while (const auto next = l->GetNext(t)) {
if ( ! IsGoodNextTrack(next) )
break;
t = Next(skiplinked);
t = Next();
}
return t;