11#ifndef __AUDACITY_TIMESHIFT_HANDLE__
12#define __AUDACITY_TIMESHIFT_HANDLE__
15#include <unordered_map>
19#include "../../UIHandle.h"
72 using Intervals = std::vector<std::shared_ptr<ChannelGroupInterval>>;
101 virtual double HintOffsetLarger(
double desiredOffset );
105 virtual double QuantizeOffset(
double desiredOffset );
114 virtual double AdjustOffsetSmaller(
double desiredOffset );
122 virtual bool MayMigrateTo(
Track &otherTrack);
133 virtual bool AdjustFit(
134 const Track &otherTrack,
138 double &desiredOffset,
152 virtual bool Attach(
Intervals intervals,
double offset);
160 virtual bool FinishMigration();
164 virtual void DoHorizontalOffset(
double offset );
169 virtual double AdjustT0(
double t0)
const;
182 bool CommonMayMigrateTo(
Track &otherTrack);
186 void InitIntervals();
189 return mAllFixed && mMoving.empty();
196 bool mAllFixed =
true;
220struct MakeTrackShifterTag;
240 using ShifterMap = std::unordered_map<Track*, std::unique_ptr<TrackShifter>>;
248 Track &capturedTrack,
250 std::unique_ptr<TrackShifter> pHit,
262 double DoSlideHorizontal(
double desiredSlideAmount);
265 void DoHorizontalOffset(
double offset);
270 bool initialized{
false };
271 bool movingSelection {};
272 bool wasMoved{
false };
273 double hSlideAmount {};
278 wxInt64 snapLeft { -1 }, snapRight { -1 };
286 movingSelection =
false;
289 snapLeft = snapRight = -1;
308 std::weak_ptr<TimeShiftHandle> &holder,
309 const std::shared_ptr<Track> &pTrack,
bool gripHit);
311 std::weak_ptr<TimeShiftHandle> &holder,
312 const wxMouseState &state,
const wxRect &rect,
313 const std::shared_ptr<Track> &pTrack);
331 wxWindow *pParent)
override;
337 bool Clicked()
const;
343 std::shared_ptr<Track>
GetTrack()
const;
345 bool WasMoved()
const;
350 void DoSlideVertical(
352 TrackList &trackList,
Track *dstTrack,
double& desiredSlideAmount);
357 const wxRect &rect,
unsigned iPass )
override;
361 const wxRect &rect,
const wxRect &panelRect,
unsigned iPass )
override;
365 bool mDidSlideVertically{};
366 bool mSlideUpDownOnly{};
368 bool mSnapPreferRightEdge{};
374 std::shared_ptr<SnapManager> mSnapManager{};
Utility for non-intrusive definition of a new method on a base class.
std::shared_ptr< UIHandle > UIHandlePtr
std::vector< Track * > TrackArray
DECLARE_EXPORTED_ATTACHED_VIRTUAL(AUDACITY_DLL_API, MakeTrackShifter)
Class template generates single-dispatch, open method registry tables.
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
A start and an end time, and whatever else subclasses associate with them.
CoarseTrackShifter(Track &track)
bool SyncLocks() override
Returns false.
Track & GetTrack() const override
There is always an associated track.
const std::shared_ptr< Track > mpTrack
~CoarseTrackShifter() override
HitTestResult HitTest(double, const ViewInfo &, HitTestParams *) override
Decide how shift behaves, based on the track that is clicked in.
TimeShiftHandle(const TimeShiftHandle &)=delete
bool StopsOnKeystroke() override
TimeShiftHandle & operator=(TimeShiftHandle &&)=default
Abstract base class for an object holding data associated with points on a time axis.
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Abstract base class for policies to manipulate a track type for Time Shift.
virtual Track & GetTrack() const =0
There is always an associated track.
virtual HitTestResult HitTest(double time, const ViewInfo &viewInfo, HitTestParams *pParams=nullptr)=0
Decide how shift behaves, based on the track that is clicked in.
const Intervals & MovingIntervals() const
Return special intervals of the track that may move.
virtual ~TrackShifter()=0
HitTestResult
Possibilities for HitTest on the clicked track.
virtual bool SyncLocks()=0
Whether unfixing of an interval should propagate to all overlapping intervals in the sync lock group.
TrackShifter(const TrackShifter &)=delete
const Intervals & FixedIntervals() const
Return special intervals of the track that will not move.
TrackShifter & operator=(const TrackShifter &)=delete
std::vector< std::shared_ptr< ChannelGroupInterval > > Intervals
Short-lived drawing and event-handling object associated with a TrackPanelCell.
void Release(wxWindow *handler)
AUDACITY_DLL_API HitTestPreview HitPreview(const wxMouseState &state)
Track & GetTrack(Channel &channel)
void SelectInterval(AudacityProject &project, const WaveTrack::Interval &interval)
ClipMoveState(const ClipMoveState &)=delete
ClipMoveState(ClipMoveState &&)=default
std::unordered_map< Track *, std::unique_ptr< TrackShifter > > ShifterMap
std::shared_ptr< Track > mCapturedTrack
Optional, more complete information for hit testing.