1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-19 15:11:23 +01: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 "RefreshCode.h"
#include "Snap.h" #include "Snap.h"
#include "TrackPanel.h" #include "TrackPanel.h"
#include "TrackPanelCellIterator.h"
#include "TrackPanelMouseEvent.h" #include "TrackPanelMouseEvent.h"
#include "UIHandle.h" #include "UIHandle.h"
#include "prefs/TracksBehaviorsPrefs.h" #include "prefs/TracksBehaviorsPrefs.h"
@@ -328,20 +327,19 @@ void AdornedRulerPanel::QuickPlayIndicatorOverlay::Draw(
; ;
// Draw indicator in all visible tracks // Draw indicator in all visible tracks
for ( const auto &data : static_cast<TrackPanel&>(panel).Cells() ) static_cast<TrackPanel&>(panel)
{ .VisitCells( [&]( const wxRect &rect, TrackPanelCell &cell ) {
Track *const pTrack = dynamic_cast<Track*>(data.first.get()); const auto pTrack = dynamic_cast<Track*>(&cell);
if (!pTrack) if (!pTrack)
continue; return;
const wxRect &rect = data.second;
// Draw the NEW indicator in its NEW location // Draw the NEW indicator in its NEW location
AColor::Line(dc, AColor::Line(dc,
mOldQPIndicatorPos, mOldQPIndicatorPos,
rect.GetTop(), rect.GetTop(),
mOldQPIndicatorPos, mOldQPIndicatorPos,
rect.GetBottom()); rect.GetBottom());
} } );
} }
} }

View File

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

View File

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

View File

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

View File

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