mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-23 09:20:16 +01:00
Rewrite some iterations over tracks and channels in TrackPanel
This commit is contained in:
@@ -62,9 +62,7 @@ std::shared_ptr<Track> TrackPanelAx::GetFocus()
|
||||
focusedTrack = FindTrack(mNumFocusedTrack);
|
||||
}
|
||||
if (!focusedTrack) {
|
||||
|
||||
TrackListIterator iter( mTrackPanel->GetTracks() );
|
||||
focusedTrack = Track::Pointer( iter.First() );
|
||||
focusedTrack = Track::Pointer( *mTrackPanel->GetTracks()->Any().first );
|
||||
// only call SetFocus if the focus has changed to avoid
|
||||
// unnecessary focus events
|
||||
if (focusedTrack)
|
||||
@@ -99,10 +97,7 @@ std::shared_ptr<Track> TrackPanelAx::SetFocus( std::shared_ptr<Track> track )
|
||||
#endif
|
||||
|
||||
if( !track )
|
||||
{
|
||||
TrackListIterator iter( mTrackPanel->GetTracks() );
|
||||
track = Track::Pointer( iter.First() );
|
||||
}
|
||||
track = Track::Pointer( *mTrackPanel->GetTracks()->Any().begin() );
|
||||
|
||||
mFocusedTrack = track;
|
||||
mNumFocusedTrack = TrackNum(track);
|
||||
@@ -252,24 +247,7 @@ wxAccStatus TrackPanelAx::GetChild( int childId, wxAccessible** child )
|
||||
// Gets the number of children.
|
||||
wxAccStatus TrackPanelAx::GetChildCount( int* childCount )
|
||||
{
|
||||
TrackListIterator iter( mTrackPanel->GetTracks() );
|
||||
Track *t = iter.First();
|
||||
int cnt = 0;
|
||||
|
||||
while( t != NULL )
|
||||
{
|
||||
cnt++;
|
||||
|
||||
if( t->GetLink() != NULL )
|
||||
{
|
||||
t = iter.Next();
|
||||
}
|
||||
|
||||
t = iter.Next();
|
||||
}
|
||||
|
||||
*childCount = cnt;
|
||||
|
||||
*childCount = mTrackPanel->GetTrackCount();
|
||||
return wxACC_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user