11#ifndef __AUDACITY_TIMESHIFT_HANDLE__
12#define __AUDACITY_TIMESHIFT_HANDLE__
15#include <unordered_map>
19#include "../../UIHandle.h"
99 virtual double HintOffsetLarger(
double desiredOffset );
103 virtual double QuantizeOffset(
double desiredOffset );
112 virtual double AdjustOffsetSmaller(
double desiredOffset );
116 virtual bool MayMigrateTo(
Track &otherTrack );
124 virtual bool AdjustFit(
125 const Track &otherTrack,
128 double &desiredOffset,
138 virtual bool Attach(
Intervals intervals,
double offset );
146 virtual bool FinishMigration();
150 virtual void DoHorizontalOffset(
double offset );
155 virtual double AdjustT0(
double t0)
const;
164 bool CommonMayMigrateTo(
Track &otherTrack );
168 void InitIntervals();
171 return mAllFixed && mMoving.empty();
178 bool mAllFixed =
true;
198struct MakeTrackShifterTag;
214 using ShifterMap = std::unordered_map<Track*, std::unique_ptr<TrackShifter>>;
219 Track &capturedTrack,
221 std::unique_ptr<TrackShifter> pHit,
233 double DoSlideHorizontal(
double desiredSlideAmount );
236 void DoHorizontalOffset(
double offset );
240 bool initialized{
false };
241 bool movingSelection {};
242 bool wasMoved{
false };
243 double hSlideAmount {};
245 wxInt64 snapLeft { -1 }, snapRight { -1 };
253 movingSelection =
false;
256 snapLeft = snapRight = -1;
269 (
const std::shared_ptr<Track> &pTrack,
bool gripHit );
276 (std::weak_ptr<TimeShiftHandle> &holder,
277 const std::shared_ptr<Track> &pTrack,
bool gripHit);
279 (std::weak_ptr<TimeShiftHandle> &holder,
280 const wxMouseState &state,
const wxRect &rect,
281 const std::shared_ptr<Track> &pTrack);
299 wxWindow *pParent)
override;
305 bool Clicked()
const;
308 std::shared_ptr<Track> GetTrack()
const;
310 bool WasMoved()
const;
315 void DoSlideVertical(
318 const std::shared_ptr<Track>& dstTrack,
double& desiredSlideAmount );
323 const wxRect &rect,
unsigned iPass )
override;
327 const wxRect &rect,
const wxRect &panelRect,
unsigned iPass )
override;
331 bool mDidSlideVertically{};
332 bool mSlideUpDownOnly{};
334 bool mSnapPreferRightEdge{};
340 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...
Used in default of other reimplementations to shift any track as a whole, invoking Track::Offset()
CoarseTrackShifter(Track &track)
bool SyncLocks() override
Returns false.
std::shared_ptr< Track > mpTrack
Track & GetTrack() const override
There is always an associated track.
~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 start and an end time, and mutative access to optional extra information.
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 with the Time Shift tool.
std::vector< TrackInterval > Intervals
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
TrackShifter & operator=(const TrackShifter &) PROHIBITED
HitTestResult
Possibilities for HitTest on the clicked track.
TrackShifter(const TrackShifter &) PROHIBITED
virtual bool SyncLocks()=0
Whether unfixing of an interval should propagate to all overlapping intervals in the sync lock group.
const Intervals & FixedIntervals() const
Return special intervals of the track that will not move.
Short-lived drawing and event-handling object associated with a TrackPanelCell.
void Release(wxWindow *handler)
AUDACITY_DLL_API HitTestPreview HitPreview(const wxMouseState &state)
ClipMoveState(ClipMoveState &&)=default
ClipMoveState(const ClipMoveState &) PROHIBITED
std::unordered_map< Track *, std::unique_ptr< TrackShifter > > ShifterMap
std::shared_ptr< Track > mCapturedTrack
Optional, more complete information for hit testing.