1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 08:09:32 +02:00

Replace uses of TrackPanel::Cells() with CellularPanel::VisitCells()

This commit is contained in:
Paul Licameli 2018-11-01 12:55:06 -04:00
parent 01551913f0
commit 005abb06d6
5 changed files with 19 additions and 31 deletions

View File

@ -33,7 +33,6 @@
#include "RefreshCode.h"
#include "Snap.h"
#include "TrackPanel.h"
#include "TrackPanelCellIterator.h"
#include "TrackPanelMouseEvent.h"
#include "UIHandle.h"
#include "prefs/TracksBehaviorsPrefs.h"
@ -328,20 +327,19 @@ void AdornedRulerPanel::QuickPlayIndicatorOverlay::Draw(
;
// Draw indicator in all visible tracks
for ( const auto &data : static_cast<TrackPanel&>(panel).Cells() )
{
Track *const pTrack = dynamic_cast<Track*>(data.first.get());
if (!pTrack)
continue;
const wxRect &rect = data.second;
static_cast<TrackPanel&>(panel)
.VisitCells( [&]( const wxRect &rect, TrackPanelCell &cell ) {
const auto pTrack = dynamic_cast<Track*>(&cell);
if (!pTrack)
return;
// Draw the NEW indicator in its NEW location
AColor::Line(dc,
mOldQPIndicatorPos,
rect.GetTop(),
mOldQPIndicatorPos,
rect.GetBottom());
}
// Draw the NEW indicator in its NEW location
AColor::Line(dc,
mOldQPIndicatorPos,
rect.GetTop(),
mOldQPIndicatorPos,
rect.GetBottom());
} );
}
}

View File

@ -15,7 +15,6 @@ Paul Licameli split from TrackPanel.cpp
#include "UIHandle.h"
class Track;
class TrackPanelCellIterator;
class TrackPanelResizeHandle final : public UIHandle
{

View File

@ -29,7 +29,6 @@ public:
std::shared_ptr<Track> FindTrack() override { return mpTrack.lock(); };
private:
friend class TrackPanelCellIterator;
std::weak_ptr<Track> mpTrack;
std::weak_ptr<TrackPanelResizeHandle> mResizeHandle;

View File

@ -15,8 +15,6 @@ Paul Licameli split from TrackPanel.cpp
#include "../../AColor.h"
#include "../../AdornedRulerPanel.h"
#include "../../Project.h"
#include "../../TrackPanelCell.h"
#include "../../TrackPanelCellIterator.h"
#include "../../TrackPanelAx.h"
#include "../../ViewInfo.h"
@ -100,21 +98,19 @@ void EditCursorOverlay::Draw(OverlayPanel &panel, wxDC &dc)
AColor::CursorColor(&dc);
// Draw cursor in all selected tracks
for ( const auto &data : tp->Cells() )
{
Track *const pTrack = dynamic_cast<Track*>(data.first.get());
tp->VisitCells( [&]( const wxRect &rect, TrackPanelCell &cell ) {
const auto pTrack = dynamic_cast<Track*>(&cell);
if (!pTrack)
continue;
return;
if (pTrack->GetSelected() ||
mProject->GetTrackPanel()->GetAx().IsFocused(pTrack))
{
const wxRect &rect = data.second;
// AColor::Line includes both endpoints so use GetBottom()
AColor::Line(dc, mLastCursorX, rect.GetTop(), mLastCursorX, rect.GetBottom());
// ^^^ The whole point of this routine.
}
}
} );
}
else if (auto ruler = dynamic_cast<AdornedRulerPanel*>(&panel)) {
wxASSERT(!mIsMaster);

View File

@ -16,8 +16,6 @@ Paul Licameli split from TrackPanel.cpp
#include "../../AudioIO.h"
#include "../../Project.h"
#include "../../TrackPanel.h"
#include "../../TrackPanelCell.h"
#include "../../TrackPanelCellIterator.h"
#include "Scrubbing.h"
#include <wx/dc.h>
@ -82,9 +80,8 @@ void PlayIndicatorOverlayBase::Draw(OverlayPanel &panel, wxDC &dc)
wxASSERT(mIsMaster);
// Draw indicator in all visible tracks
for ( const auto &data : tp->Cells() )
{
Track *const pTrack = dynamic_cast<Track*>(data.first.get());
tp->VisitCells( [&]( const wxRect &rect, TrackPanelCell &cell ) {
const auto pTrack = dynamic_cast<Track*>(&cell);
if (pTrack) pTrack->TypeSwitch(
[](LabelTrack *) {
// Don't draw the indicator in label tracks
@ -92,7 +89,6 @@ void PlayIndicatorOverlayBase::Draw(OverlayPanel &panel, wxDC &dc)
[&](Track *) {
// Draw the NEW indicator in its NEW location
// AColor::Line includes both endpoints so use GetBottom()
const wxRect &rect = data.second;
AColor::Line(dc,
mLastIndicatorX,
rect.GetTop(),
@ -100,7 +96,7 @@ void PlayIndicatorOverlayBase::Draw(OverlayPanel &panel, wxDC &dc)
rect.GetBottom());
}
);
}
} );
}
else if(auto ruler = dynamic_cast<AdornedRulerPanel*>(&panel)) {
wxASSERT(!mIsMaster);