35, mZoomInfo{ &zoomInfo }
36, mPixelTolerance{ pixelTolerance }
37, mNoTimeSnap{ noTimeSnap }
38, mCandidates{ move( candidates ) }
49 for (
const auto track : tracks.
Any() ) {
50 auto intervals = track->GetIntervals();
51 for (
const auto &interval : intervals) {
52 candidates.emplace_back( interval.Start(), track );
53 if ( interval.Start() != interval.End() )
54 candidates.emplace_back( interval.End(), track );
57 return move(candidates);
71 zoomInfo, noTimeSnap, pixelTolerance }
85 auto format = formats.GetSelectionFormat();
158 size_t half = (i0 + i1) / 2;
162 return Find(t, i0, half);
165 return Find(t, half, i1);
172 size_t index =
Find(t, 0, cnt);
177 size_t next = index + 1;
178 while (next + 1 < cnt &&
Get(next) ==
Get(index))
207 size_t index =
Find(t);
218 size_t right = index;
231 if (left == index && right == index)
238 size_t indexInThisTrack = 0;
239 size_t countInThisTrack = 0;
240 for (i = left; i <= right; ++i)
244 indexInThisTrack = i;
249 if (countInThisTrack == 1)
253 *outT =
Get(indexInThisTrack);
275(
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()
std::vector< TranslatableString > TranslatableStrings
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
static void SnapGuidePen(wxDC *dc)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
NumericConverter provides the advanced formatting control used in the selection bar of Audacity.
virtual void ControlsToValue()
virtual void ValueToControls()
void SetSampleRate(double sampleRate)
void SetValue(double newValue)
bool SetFormatName(const NumericFormatSymbol &formatName)
static ProjectRate & Get(AudacityProject &project)
static ProjectSettings & Get(AudacityProject &project)
size_t Find(double t, size_t i0, size_t i1)
bool SnapToPoints(Track *currentTrack, double t, bool rightEdge, double *outT)
NumericConverter mConverter
static void Draw(wxDC *dc, wxInt64 snap0, wxInt64 snap1)
double mEpsilon
Two time points closer than this are considered the same.
wxInt64 PixelDiff(double t, size_t index)
NumericFormatSymbol mFormat
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
static const TranslatableStrings & GetSnapLabels()
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...
auto Any() -> TrackIterRange< TrackType >
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)