From c742199d47e3e252faf5ef7611e9edc965cd8d1a Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Wed, 3 Jul 2019 22:31:05 -0400 Subject: [PATCH] AdornedRulerPanel does not depend on TrackPanel... ... but it does assume that GetProjectPanel returns a CellularPanel --- src/AdornedRulerPanel.cpp | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/AdornedRulerPanel.cpp b/src/AdornedRulerPanel.cpp index 4b1e2846d..7528daaca 100644 --- a/src/AdornedRulerPanel.cpp +++ b/src/AdornedRulerPanel.cpp @@ -29,6 +29,8 @@ #include "AColor.h" #include "AllThemeResources.h" #include "AudioIO.h" +#include "CellularPanel.h" +#include "HitTestResult.h" #include "Menus.h" #include "Prefs.h" #include "Project.h" @@ -39,7 +41,6 @@ #include "RefreshCode.h" #include "Snap.h" #include "Track.h" -#include "TrackPanel.h" #include "TrackPanelMouseEvent.h" #include "UIHandle.h" #include "ViewInfo.h" @@ -337,8 +338,13 @@ void AdornedRulerPanel::QuickPlayIndicatorOverlay::Draw( ; // Draw indicator in all visible tracks - static_cast(panel) - .VisitCells( [&]( const wxRect &rect, TrackPanelCell &cell ) { + auto pCellularPanel = dynamic_cast( &panel ); + if ( !pCellularPanel ) { + wxASSERT( false ); + return; + } + pCellularPanel + ->VisitCells( [&]( const wxRect &rect, TrackPanelCell &cell ) { const auto pTrackView = dynamic_cast(&cell); if (!pTrackView) return; @@ -1663,7 +1669,13 @@ void AdornedRulerPanel::SetPanelSize() void AdornedRulerPanel::DrawBothOverlays() { - TrackPanel::Get( *mProject ).DrawOverlays( false ); + auto pCellularPanel = + dynamic_cast( &GetProjectPanel( *GetProject() ) ); + if ( !pCellularPanel ) { + wxASSERT( false ); + } + else + pCellularPanel->DrawOverlays( false ); DrawOverlays( false ); } @@ -2214,7 +2226,13 @@ void AdornedRulerPanel::CreateOverlays() if (!mOverlay) { mOverlay = std::make_shared( mProject ); - TrackPanel::Get( *mProject ).AddOverlay( mOverlay ); + auto pCellularPanel = + dynamic_cast( &GetProjectPanel( *GetProject() ) ); + if ( !pCellularPanel ) { + wxASSERT( false ); + } + else + pCellularPanel->AddOverlay( mOverlay ); this->AddOverlay( mOverlay->mPartner ); } }