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

Move responsibilities from Track to TrackView classes...

... And Track no longer inherits TrackPanelCell, so be careful to rewrite
some dynamic_casts too to check instead for TrackView.  Those casts won't fail
to recompile if not rewritten.
This commit is contained in:
Paul Licameli
2019-06-18 00:00:35 -04:00
parent e0b8bd78eb
commit e581fa60d9
26 changed files with 190 additions and 186 deletions

View File

@@ -2023,7 +2023,7 @@ void TrackPanel::ScrollIntoView(int x)
void TrackPanel::OnTrackMenu(Track *t)
{
CellularPanel::DoContextMenu( t );
CellularPanel::DoContextMenu( &TrackView::Get( *t ) );
}
Track * TrackPanel::GetFirstSelectedTrack()
@@ -2198,7 +2198,8 @@ struct VRulerAndChannel final : TrackPanelGroup {
return { Axis::X, Refinement{
{ rect.GetLeft(),
TrackVRulerControls::Get( *mpChannel ).shared_from_this() },
{ mLeftOffset, mpChannel }
{ mLeftOffset,
TrackView::Get( *mpChannel ).shared_from_this() }
} };
}
std::shared_ptr< Track > mpChannel;
@@ -2368,12 +2369,18 @@ void TrackPanel::DisplaySelection()
TrackPanelCell *TrackPanel::GetFocusedCell()
{
return mAx->GetFocus().get();
auto pTrack = mAx->GetFocus().get();
if (pTrack)
return &TrackView::Get( *pTrack );
return nullptr;
}
Track *TrackPanel::GetFocusedTrack()
{
return static_cast<Track*>( GetFocusedCell() );
auto pView = dynamic_cast<TrackView *>( GetFocusedCell() );
if (pView)
return pView->FindTrack().get();
return nullptr;
}
void TrackPanel::SetFocusedCell()