Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
CoarseTrackShifter Class Referencefinal

#include <TimeShiftHandle.h>

Inheritance diagram for CoarseTrackShifter:
[legend]
Collaboration diagram for CoarseTrackShifter:
[legend]

Public Member Functions

 CoarseTrackShifter (Track &track)
 
 ~CoarseTrackShifter () override
 
TrackGetTrack () const override
 There is always an associated track. More...
 
HitTestResult HitTest (double, const ViewInfo &, HitTestParams *) override
 Decide how shift behaves, based on the track that is clicked in. More...
 
bool SyncLocks () override
 Returns false. More...
 
- Public Member Functions inherited from TrackShifter
 TrackShifter ()
 
 TrackShifter (const TrackShifter &)=delete
 
TrackShifteroperator= (const TrackShifter &)=delete
 
virtual ~TrackShifter ()=0
 
virtual TrackGetTrack () 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 IntervalsFixedIntervals () const
 Return special intervals of the track that will not move. More...
 
const IntervalsMovingIntervals () 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 (const ChannelGroupInterval &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
 

Private Attributes

const std::shared_ptr< TrackmpTrack
 

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 (const ChannelGroupInterval &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
 

Detailed Description

Used in default of other reimplementations to shift any track as a whole, invoking Track::ShiftBy()

Definition at line 202 of file TimeShiftHandle.h.

Constructor & Destructor Documentation

◆ CoarseTrackShifter()

CoarseTrackShifter::CoarseTrackShifter ( Track track)
Precondition
track.IsLeader()

Definition at line 255 of file TimeShiftHandle.cpp.

256 : mpTrack{ track.SharedPointer() }
257{
258 assert(track.IsLeader());
260}
const std::shared_ptr< Track > mpTrack
std::shared_ptr< Subclass > SharedPointer()
Definition: Track.h:160
bool IsLeader() const override
Definition: Track.cpp:291
void InitIntervals()
Derived class constructor can initialize all intervals reported by the track as fixed,...

References TrackShifter::InitIntervals(), and Track::IsLeader().

Here is the call graph for this function:

◆ ~CoarseTrackShifter()

CoarseTrackShifter::~CoarseTrackShifter ( )
overridedefault

Member Function Documentation

◆ GetTrack()

Track & CoarseTrackShifter::GetTrack ( ) const
inlineoverridevirtual

There is always an associated track.

Postcondition
result: result.IsLeader()

Implements TrackShifter.

Definition at line 209 of file TimeShiftHandle.h.

209{ return *mpTrack; }

References mpTrack.

◆ HitTest()

auto CoarseTrackShifter::HitTest ( double  time,
const ViewInfo viewInfo,
HitTestParams pParams 
)
overridevirtual

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

Precondition
!pParams || (time == pParams->viewInfo.PositionToTime(pParams->xx, pParams->rect.x))
Parameters
timeA time value to test
pParamsOptional extra information

Implements TrackShifter.

Definition at line 264 of file TimeShiftHandle.cpp.

266{
268}
@ Track
Shift selected track and sister channels only, as a whole.

◆ SyncLocks()

bool CoarseTrackShifter::SyncLocks ( )
overridevirtual

Returns false.

Implements TrackShifter.

Definition at line 270 of file TimeShiftHandle.cpp.

271{
272 return false;
273}

Member Data Documentation

◆ mpTrack

const std::shared_ptr<Track> CoarseTrackShifter::mpTrack
private

Definition at line 217 of file TimeShiftHandle.h.

Referenced by GetTrack().


The documentation for this class was generated from the following files: