35, mZoomInfo{ &zoomInfo }
36, mPixelTolerance{ pixelTolerance }
37, mNoTimeSnap{ noTimeSnap }
38, mCandidates{ move( candidates ) }
48 for (
const auto track :
tracks)
49 for (
const auto &interval : track->Intervals()) {
50 candidates.emplace_back(interval->Start(), track);
51 if (interval->Start() != interval->End())
52 candidates.emplace_back(interval->End(), track);
54 return move(candidates);
68 zoomInfo, noTimeSnap, pixelTolerance }
82 auto snapMode =
settings.GetSnapMode();
85 auto format = formats.GetSelectionFormat();
145 size_t half = (i0 + i1) / 2;
149 return Find(t, i0, half);
152 return Find(t, half, i1);
159 size_t index =
Find(t, 0, cnt);
164 size_t next = index + 1;
165 while (next + 1 < cnt &&
Get(next) ==
Get(index))
194 size_t index =
Find(t);
205 size_t right = index;
218 if (left == index && right == index)
225 size_t indexInThisTrack = 0;
226 size_t countInThisTrack = 0;
227 for (i = left; i <= right; ++i)
231 indexInThisTrack = i;
236 if (countInThisTrack == 1)
240 *outT =
Get(indexInThisTrack);
262(
Track *currentTrack,
double t,
bool rightEdge)
an object holding per-project preferred sample rate
bool operator<(SnapPoint s1, SnapPoint s2)
std::vector< SnapPoint > SnapPointArray
declares abstract base class Track, TrackList, and iterators over TrackList
static Settings & settings()
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
static ProjectRate & Get(AudacityProject &project)
SnapResult SnapTime(double time) const
static ProjectSnap & Get(AudacityProject &project)
size_t Find(double t, size_t i0, size_t i1)
bool SnapToPoints(Track *currentTrack, double t, bool rightEdge, double *outT)
double mEpsilon
Two time points closer than this are considered the same.
wxInt64 PixelDiff(double t, size_t index)
void CondListAdd(double t, const Track *track)
const AudacityProject * mProject
SnapResults Snap(Track *currentTrack, double t, bool rightEdge)
SnapManager(const AudacityProject &project, SnapPointArray candidates, const ZoomInfo &zoomInfo, bool noTimeSnap=false, int pixelTolerance=kPixelTolerance)
Construct only for specified candidate points.
SnapPointArray mCandidates
SnapPointArray mSnapPoints
const ZoomInfo * mZoomInfo
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...
int64 TimeToPosition(double time, int64 origin=0, bool ignoreFisheye=false) const
STM: Converts a project time to screen x position.
SnapPointArray FindCandidates(SnapPointArray candidates, const TrackList &tracks)