Audacity 3.2.0
|
Classes | |
struct | MovingInterval |
Public Member Functions | |
LabelTrackShifter (LabelTrack &track, AudacityProject &project) | |
~LabelTrackShifter () override | |
Track & | GetTrack () const override |
There is always an associated track. More... | |
HitTestResult | HitTest (double time, const ViewInfo &viewInfo, HitTestParams *pParams) override |
Decide how shift behaves, based on the track that is clicked in. More... | |
void | SelectInterval (TimeInterval 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 &otherTrack) override |
Intervals | Detach () override |
Remove all moving intervals from the track, if possible. More... | |
bool | AdjustFit (const Track &, const Intervals &, double &, double) override |
bool | Attach (Intervals intervals, double offset) override |
Put moving intervals into the track, which may have migrated from another. More... | |
void | DoHorizontalOffset (double offset) override |
Public Member Functions inherited from TrackShifter | |
TrackShifter () | |
TrackShifter (const TrackShifter &)=delete | |
TrackShifter & | operator= (const TrackShifter &)=delete |
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 ChannelGroupInterval &)> pred) |
Change intervals satisfying a predicate from fixed to moving. More... | |
void | UnfixAll () |
Change all intervals from fixed to moving. More... | |
virtual void | SelectInterval (TimeInterval 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) |
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) |
virtual bool | Attach (Intervals intervals, double offset) |
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 |
Static Public Member Functions | |
static size_t & | GetIndex (ChannelGroupInterval &interval) |
static size_t | GetIndex (const ChannelGroupInterval &interval) |
Private Member Functions | |
void | OnLabelPermuted (const LabelTrackEvent &e) |
void | OnLabelAdded (const LabelTrackEvent &e) |
void | OnLabelDeleted (const LabelTrackEvent e) |
Private Attributes | |
Observer::Subscription | mSubscription |
const std::shared_ptr< LabelTrack > | mpTrack |
AudacityProject & | mProject |
Additional Inherited Members | |
Public Types inherited from TrackShifter | |
enum class | HitTestResult { Miss , Selection , Intervals , Track } |
Possibilities for HitTest on the clicked track. More... | |
using | Intervals = std::vector< std::shared_ptr< ChannelGroupInterval > > |
Protected Member Functions inherited from TrackShifter | |
void | CommonSelectInterval (TimeInterval 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 |
Protected Attributes inherited from TrackShifter | |
Intervals | mFixed |
Intervals | mMoving |
Definition at line 11 of file LabelTrackShifter.cpp.
|
inline |
Definition at line 13 of file LabelTrackShifter.cpp.
References TrackShifter::InitIntervals(), mpTrack, mSubscription, and LabelTrackEvent::type.
|
inlineoverride |
Definition at line 31 of file LabelTrackShifter.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 130 of file LabelTrackShifter.cpp.
|
inlineoverridevirtual |
Put moving intervals into the track, which may have migrated from another.
The ChannelGroupInterval objects pointed to by intervals
will not be used again. The shifter should repopupate mMoving with new ChannelGroupInterval objects to reflect the new state of the track. In case of failure, track states are unspecified
Reimplemented from TrackShifter.
Definition at line 137 of file LabelTrackShifter.cpp.
References mpTrack.
|
inlineoverridevirtual |
Remove all moving intervals from the track, if possible.
Default implementation does nothing
Reimplemented from TrackShifter.
Definition at line 110 of file LabelTrackShifter.cpp.
References GetIndex(), 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 152 of file LabelTrackShifter.cpp.
References GetIndex(), TrackShifter::MovingIntervals(), and mpTrack.
|
inlinestatic |
Definition at line 36 of file LabelTrackShifter.cpp.
Referenced by Detach(), DoHorizontalOffset(), GetIndex(), HitTest(), OnLabelAdded(), OnLabelDeleted(), and OnLabelPermuted().
|
inlinestatic |
Definition at line 41 of file LabelTrackShifter.cpp.
References GetIndex().
|
inlineoverridevirtual |
There is always an associated track.
Implements TrackShifter.
Definition at line 34 of file LabelTrackShifter.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 46 of file LabelTrackShifter.cpp.
References LabelTrackView::Get(), GetIndex(), LabelTrackView::GetNavigationIndex(), TrackShifter::Intervals, TrackShifter::mMoving, mProject, mpTrack, LabelTrackView::OverATextBox(), ViewInfo::selectedRegion, SelectInterval(), TrackShifter::Selection, NotifyingSelectedRegion::t0(), NotifyingSelectedRegion::t1(), TrackShifter::Track, TrackShifter::UnfixIntervals(), TrackShifter::HitTestParams::xx, and TrackShifter::HitTestParams::yy.
|
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 88 of file LabelTrackShifter.cpp.
References TrackShifter::CommonMayMigrateTo().
|
inlineprivate |
Definition at line 194 of file LabelTrackShifter.cpp.
References GetIndex(), TrackShifter::mFixed, TrackShifter::mMoving, LabelTrackEvent::mPresentPosition, LabelTrackEvent::mpTrack, and mpTrack.
|
inlineprivate |
Definition at line 217 of file LabelTrackShifter.cpp.
References GetIndex(), TrackShifter::mFixed, LabelTrackEvent::mFormerPosition, TrackShifter::mMoving, LabelTrackEvent::mpTrack, and mpTrack.
|
inlineprivate |
Definition at line 166 of file LabelTrackShifter.cpp.
References GetIndex(), TrackShifter::mFixed, LabelTrackEvent::mFormerPosition, TrackShifter::mMoving, LabelTrackEvent::mPresentPosition, LabelTrackEvent::mpTrack, and 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 81 of file LabelTrackShifter.cpp.
References TrackShifter::CommonSelectInterval().
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 86 of file LabelTrackShifter.cpp.
|
private |
Definition at line 245 of file LabelTrackShifter.cpp.
Referenced by HitTest().
|
private |
Definition at line 244 of file LabelTrackShifter.cpp.
Referenced by Attach(), Detach(), DoHorizontalOffset(), GetTrack(), HitTest(), LabelTrackShifter(), OnLabelAdded(), OnLabelDeleted(), and OnLabelPermuted().
|
private |
Definition at line 243 of file LabelTrackShifter.cpp.
Referenced by LabelTrackShifter().