Audacity 3.2.0
Functions
anonymous_namespace{CutlineHandle.cpp} Namespace Reference

Functions

int FindMergeLine (WaveTrack *track, double time)
 
bool IsOverCutline (const ViewInfo &viewInfo, WaveTrack *track, const wxRect &rect, const wxMouseState &state, WaveTrackLocation *pmLocation)
 

Function Documentation

◆ FindMergeLine()

int anonymous_namespace{CutlineHandle.cpp}::FindMergeLine ( WaveTrack track,
double  time 
)

Definition at line 55 of file CutlineHandle.cpp.

56 {
57 const double tolerance = 0.5 / track->GetRate();
58 int ii = 0;
59 for (const auto loc: track->GetCachedLocations()) {
61 fabs(time - loc.pos) < tolerance)
62 return ii;
63 ++ii;
64 }
65 return -1;
66 }
const std::vector< Location > & GetCachedLocations() const
Definition: WaveTrack.h:498
double GetRate() const override
Definition: WaveTrack.cpp:475

References WaveTrack::GetCachedLocations(), WaveTrack::GetRate(), and WaveTrackLocation::locationMergePoint.

Referenced by CutlineHandle::Click().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsOverCutline()

bool anonymous_namespace{CutlineHandle.cpp}::IsOverCutline ( const ViewInfo viewInfo,
WaveTrack track,
const wxRect &  rect,
const wxMouseState &  state,
WaveTrackLocation pmLocation 
)

Definition at line 68 of file CutlineHandle.cpp.

72 {
73 for (auto loc: track->GetCachedLocations())
74 {
75 const double x = viewInfo.TimeToPosition(loc.pos);
76 if (x >= 0 && x < rect.width)
77 {
78 wxRect locRect;
79 locRect.width = 2 * kPixelTolerance - 1;
80 locRect.x = (int)(rect.x + x) - locRect.width / 2;
81 locRect.y = rect.y;
82 locRect.height = rect.height;
83 if (locRect.Contains(state.m_x, state.m_y))
84 {
85 if (pmLocation)
86 *pmLocation = loc;
87 return true;
88 }
89 }
90 }
91
92 return false;
93 }
const int kPixelTolerance
Definition: Snap.h:28
wxInt64 TimeToPosition(double time, wxInt64 origin=0, bool ignoreFisheye=false) const
STM: Converts a project time to screen x position.
Definition: ZoomInfo.cpp:44

References WaveTrack::GetCachedLocations(), kPixelTolerance, and ZoomInfo::TimeToPosition().

Referenced by CutlineHandle::HitTest().

Here is the call graph for this function:
Here is the caller graph for this function: