1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-01-02 06:08:44 +01:00

Define TrackShifter, subclasses, factory method; collect them...

... in TimeShiftHandle.  They do nothing useful yet, but responsibilities
will shift into them.

TypeSwitch is avoided and the subclasses are defined in appropriate places
for dependency management, thanks to AttachedVirtualFunction.
This commit is contained in:
Paul Licameli
2020-09-09 05:10:23 -04:00
parent 1501f09bf1
commit d8a894b95b
4 changed files with 106 additions and 2 deletions

View File

@@ -1301,3 +1301,24 @@ void WaveTrackView::Draw(
CommonTrackView::Draw( context, rect, iPass );
}
class WaveTrackShifter final : public TrackShifter {
public:
WaveTrackShifter( WaveTrack &track )
: mpTrack{ track.SharedPointer<WaveTrack>() }
{
}
~WaveTrackShifter() override {}
Track &GetTrack() const override { return *mpTrack; }
private:
std::shared_ptr<WaveTrack> mpTrack;
};
using MakeWaveTrackShifter = MakeTrackShifter::Override<WaveTrack>;
template<> template<> auto MakeWaveTrackShifter::Implementation() -> Function {
return [](WaveTrack &track) {
return std::make_unique<WaveTrackShifter>(track);
};
}
static MakeWaveTrackShifter registerMakeWaveTrackShifter;