1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-02 00:29:41 +02:00

Change details of focusing of tracks in presence of pending ones...

... Don't focus a pending changed track but remap it to the original.

You can focus a pending added track.
This commit is contained in:
Paul Licameli 2018-01-12 16:24:54 -05:00
parent 4ccb695c61
commit 7d57a17ff4
2 changed files with 14 additions and 6 deletions

View File

@ -2865,15 +2865,15 @@ void TrackPanel::SetFocusedTrack( Track *t )
if (t && !t->GetLinked() && t->GetLink())
t = (WaveTrack*)t->GetLink();
if (t && AudacityProject::GetKeyboardCaptureHandler()) {
if ( !mAx->SetFocus( Track::Pointer( t ) ) )
return;
if (t && AudacityProject::GetKeyboardCaptureHandler())
AudacityProject::ReleaseKeyboard(this);
}
if (t) {
if (t)
AudacityProject::CaptureKeyboard(this);
}
mAx->SetFocus( Track::Pointer( t ) );
Refresh( false );
}

View File

@ -131,8 +131,14 @@ bool TrackPanelAx::IsFocused( Track *track )
if( !focusedTrack )
focusedTrack = SetFocus();
// Remap track pointer if there are oustanding pending updates
auto origTrack =
mTrackPanel->GetTracks()->FindById( track->GetId() );
if (origTrack)
track = origTrack;
if( ( track == focusedTrack.get() ) ||
( track == focusedTrack->GetLink() ) )
( focusedTrack && track == focusedTrack->GetLink() ) )
{
return true;
}
@ -142,6 +148,8 @@ bool TrackPanelAx::IsFocused( Track *track )
int TrackPanelAx::TrackNum( const std::shared_ptr<Track> &target )
{
// Find 1-based position of the target in the visible tracks, or 0 if not
// found
TrackListIterator iter( mTrackPanel->GetTracks() );
Track *t = iter.First();
int ndx = 0;