![]() |
Audacity 3.2.0
|
Public Member Functions | |
WaveTrackShifter (WaveTrack &track) | |
~WaveTrackShifter () override | |
Track & | GetTrack () const override |
There is always an associated track. More... | |
HitTestResult | HitTest (double time, const ViewInfo &viewInfo, HitTestParams *params) override |
Decide how shift behaves, based on the track that is clicked in. More... | |
void | SelectInterval (const TrackInterval &interval) override |
Notifies the shifter that a region is selected, so it may update its fixed and moving intervals. More... | |
bool | SyncLocks () override |
Whether unfixing of an interval should propagate to all overlapping intervals in the sync lock group. More... | |
bool | MayMigrateTo (Track &other) override |
Whether intervals may migrate to the other track, not yet checking all placement constraints */. More... | |
double | HintOffsetLarger (double desiredOffset) override |
Given amount to shift by horizontally, maybe adjust it from zero to suggest minimum distance. More... | |
double | QuantizeOffset (double desiredOffset) override |
Given amount to shift by horizontally, do any preferred rounding, before placement constraint checks. More... | |
double | AdjustOffsetSmaller (double desiredOffset) override |
Given amount to shift by horizontally, maybe adjust it toward zero to meet placement constraints. More... | |
Intervals | Detach () override |
Remove all moving intervals from the track, if possible. More... | |
bool | AdjustFit (const Track &otherTrack, const Intervals &intervals, double &desiredOffset, double tolerance) override |
Test whether intervals can fit into another track, maybe adjusting the offset slightly. More... | |
bool | Attach (Intervals intervals) override |
Put moving intervals into the track, which may have migrated from another. More... | |
bool | FinishMigration () override |
When dragging is done, do (once) the final steps of migration (which may be expensive) More... | |
void | DoHorizontalOffset (double offset) override |
double | AdjustT0 (double t0) const override |
![]() | |
TrackShifter () | |
TrackShifter (const TrackShifter &) PROHIBITED | |
TrackShifter & | operator= (const TrackShifter &) PROHIBITED |
virtual | ~TrackShifter ()=0 |
virtual Track & | GetTrack () const =0 |
There is always an associated track. More... | |
virtual HitTestResult | HitTest (double time, const ViewInfo &viewInfo, HitTestParams *pParams=nullptr)=0 |
Decide how shift behaves, based on the track that is clicked in. More... | |
const Intervals & | FixedIntervals () const |
Return special intervals of the track that will not move. More... | |
const Intervals & | MovingIntervals () const |
Return special intervals of the track that may move. More... | |
void | UnfixIntervals (std::function< bool(const TrackInterval &) > pred) |
Change intervals satisfying a predicate from fixed to moving. More... | |
void | UnfixAll () |
Change all intervals from fixed to moving. More... | |
virtual void | SelectInterval (const TrackInterval &interval) |
Notifies the shifter that a region is selected, so it may update its fixed and moving intervals. More... | |
virtual bool | SyncLocks ()=0 |
Whether unfixing of an interval should propagate to all overlapping intervals in the sync lock group. More... | |
virtual double | HintOffsetLarger (double desiredOffset) |
Given amount to shift by horizontally, maybe adjust it from zero to suggest minimum distance. More... | |
virtual double | QuantizeOffset (double desiredOffset) |
Given amount to shift by horizontally, do any preferred rounding, before placement constraint checks. More... | |
virtual double | AdjustOffsetSmaller (double desiredOffset) |
Given amount to shift by horizontally, maybe adjust it toward zero to meet placement constraints. More... | |
virtual bool | MayMigrateTo (Track &otherTrack) |
Whether intervals may migrate to the other track, not yet checking all placement constraints */. More... | |
virtual Intervals | Detach () |
Remove all moving intervals from the track, if possible. More... | |
virtual bool | AdjustFit (const Track &otherTrack, const Intervals &intervals, double &desiredOffset, double tolerance) |
Test whether intervals can fit into another track, maybe adjusting the offset slightly. More... | |
virtual bool | Attach (Intervals intervals) |
Put moving intervals into the track, which may have migrated from another. More... | |
virtual bool | FinishMigration () |
When dragging is done, do (once) the final steps of migration (which may be expensive) More... | |
virtual void | DoHorizontalOffset (double offset) |
virtual double | AdjustT0 (double t0) const |
Private Attributes | |
std::shared_ptr< WaveTrack > | mpTrack |
std::unordered_set< WaveClip * > | mMigrated |
Additional Inherited Members | |
![]() | |
enum class | HitTestResult { Miss , Selection , Intervals , Track } |
Possibilities for HitTest on the clicked track. More... | |
using | Intervals = std::vector< TrackInterval > |
![]() | |
void | CommonSelectInterval (const TrackInterval &interval) |
bool | CommonMayMigrateTo (Track &otherTrack) |
void | InitIntervals () |
Derived class constructor can initialize all intervals reported by the track as fixed, none moving. More... | |
bool | AllFixed () const |
![]() | |
Intervals | mFixed |
Intervals | mMoving |
Definition at line 12 of file WaveTrackShifter.cpp.
|
inline |
Definition at line 14 of file WaveTrackShifter.cpp.
References TrackShifter::InitIntervals().
|
inlineoverride |
Definition at line 19 of file WaveTrackShifter.cpp.
|
inlineoverridevirtual |
Test whether intervals can fit into another track, maybe adjusting the offset slightly.
Default implementation does nothing and returns false
intervals | Assume these came from Detach() and only after MayMigrateTo returned true for otherTrack | |
[in,out] | desiredOffset | |
tolerance | Nonnegative ceiling for allowed changes in fabs(desiredOffset) |
Reimplemented from TrackShifter.
Definition at line 138 of file WaveTrackShifter.cpp.
References WaveTrack::IntervalData::GetClip().
|
inlineoverridevirtual |
Given amount to shift by horizontally, maybe adjust it toward zero to meet placement constraints.
Default implementation returns the argument
fabs(r) <= fabs(desiredOffset)
r * desiredOffset >= 0
(i.e. signs are not opposite) r
is return value) Reimplemented from TrackShifter.
Definition at line 113 of file WaveTrackShifter.cpp.
References TrackShifter::MovingIntervals(), and mpTrack.
|
inlineoverridevirtual |
Reimplemented from TrackShifter.
Definition at line 193 of file WaveTrackShifter.cpp.
References WaveTrack::IntervalData::GetClip(), and TrackShifter::MovingIntervals().
|
inlineoverridevirtual |
Put moving intervals into the track, which may have migrated from another.
In case of failure, track states are unspecified
Default implementation does nothing and returns true
Reimplemented from TrackShifter.
Definition at line 156 of file WaveTrackShifter.cpp.
References WaveTrack::IntervalData::GetClip(), mMigrated, TrackShifter::mMoving, and mpTrack.
|
inlineoverridevirtual |
Remove all moving intervals from the track, if possible.
Default implementation does nothing
Reimplemented from TrackShifter.
Definition at line 126 of file WaveTrackShifter.cpp.
References WaveTrack::IntervalData::GetClip(), mMigrated, TrackShifter::mMoving, and mpTrack.
|
inlineoverridevirtual |
Shift all moving intervals horizontally Default moves the whole track, provided !AllFixed()
; else does nothing
Reimplemented from TrackShifter.
Definition at line 181 of file WaveTrackShifter.cpp.
References WaveTrack::IntervalData::GetClip(), and TrackShifter::MovingIntervals().
|
inlineoverridevirtual |
When dragging is done, do (once) the final steps of migration (which may be expensive)
In case of failure, track states are unspecified
Default implementation does nothing and returns true
Reimplemented from TrackShifter.
Definition at line 169 of file WaveTrackShifter.cpp.
|
inlineoverridevirtual |
There is always an associated track.
Implements TrackShifter.
Definition at line 20 of file WaveTrackShifter.cpp.
References mpTrack.
|
inlineoverridevirtual |
Given amount to shift by horizontally, maybe adjust it from zero to suggest minimum distance.
Any interval placement constraints, not necessarily met at the suggested offset Default implementation returns the argument
fabs(r) >= fabs(desiredOffset)
r * desiredOffset >= 0
(i.e. signs are not opposite) r
is return value) Reimplemented from TrackShifter.
Definition at line 92 of file WaveTrackShifter.cpp.
References mpTrack.
|
inlineoverridevirtual |
Decide how shift behaves, based on the track that is clicked in.
If the return value is Intervals or Selection, then some intervals may be marked moving as a side effect
!pParams || (time == pParams->viewInfo.PositionToTime(pParams->xx, pParams->rect.x))
time | A time value to test |
pParams | Optional extra information |
Implements TrackShifter.
Definition at line 22 of file WaveTrackShifter.cpp.
References WaveTrack::IntervalData::GetClip(), WaveTrackView::HitTest(), TrackShifter::Intervals, TrackShifter::Miss, mpTrack, params, ViewInfo::selectedRegion, SelectInterval(), TrackShifter::Selection, NotifyingSelectedRegion::t0(), NotifyingSelectedRegion::t1(), and TrackShifter::UnfixIntervals().
|
inlineoverridevirtual |
Whether intervals may migrate to the other track, not yet checking all placement constraints */.
Default implementation returns false
Reimplemented from TrackShifter.
Definition at line 87 of file WaveTrackShifter.cpp.
References TrackShifter::CommonMayMigrateTo().
|
inlineoverridevirtual |
Given amount to shift by horizontally, do any preferred rounding, before placement constraint checks.
Default implementation returns argument
Reimplemented from TrackShifter.
Definition at line 106 of file WaveTrackShifter.cpp.
References mpTrack.
|
inlineoverridevirtual |
Notifies the shifter that a region is selected, so it may update its fixed and moving intervals.
Default behavior: if any part of the track is selected, unfix all parts of it.
Reimplemented from TrackShifter.
Definition at line 69 of file WaveTrackShifter.cpp.
References ConstTrackInterval::End(), WaveTrack::IntervalData::GetClip(), mpTrack, ConstTrackInterval::Start(), and TrackShifter::UnfixIntervals().
Referenced by HitTest().
|
inlineoverridevirtual |
Whether unfixing of an interval should propagate to all overlapping intervals in the sync lock group.
Implements TrackShifter.
Definition at line 85 of file WaveTrackShifter.cpp.
|
private |
Definition at line 212 of file WaveTrackShifter.cpp.
Referenced by Attach(), Detach(), and FinishMigration().
|
private |
Definition at line 209 of file WaveTrackShifter.cpp.
Referenced by AdjustOffsetSmaller(), Attach(), Detach(), FinishMigration(), GetTrack(), HintOffsetLarger(), HitTest(), QuantizeOffset(), and SelectInterval().