MCPcopy Create free account
hub / github.com/audacity/audacity / SelectHandle

Method SelectHandle

src/tracks/ui/SelectHandle.cpp:423–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

421}
422
423SelectHandle::SelectHandle(
424 const std::shared_ptr<ChannelView> &pChannelView, bool useSnap,
425 const TrackList &trackList,
426 const TrackPanelMouseState &st, const ViewInfo &viewInfo
427) : mpView{ pChannelView }
428 // Selection dragging can snap to play region boundaries
429 , mSnapManager{ std::make_shared<SnapManager>(
430 *trackList.GetOwner(), trackList, viewInfo, SnapPointArray{
431 SnapPoint{ viewInfo.playRegion.GetLastActiveStart() },
432 SnapPoint{ viewInfo.playRegion.GetLastActiveEnd() },
433 } ) }
434{
435 const wxMouseState &state = st.state;
436 mRect = st.rect;
437
438 auto time = std::max(0.0, viewInfo.PositionToTime(state.m_x, mRect.x));
439 auto pTrack = FindTrack(pChannelView->FindChannel().get());
440 mSnapStart = mSnapManager->Snap(pTrack, time, false);
441 if (mSnapStart.snappedPoint)
442 mSnapStart.outCoord += mRect.x;
443 else
444 mSnapStart.outCoord = -1;
445
446 mUseSnap = useSnap;
447}
448
449SelectHandle::~SelectHandle()
450{

Callers

nothing calls this directly

Calls 6

maxFunction · 0.85
PositionToTimeMethod · 0.80
FindTrackFunction · 0.70
getMethod · 0.45
FindChannelMethod · 0.45
SnapMethod · 0.45

Tested by

no test coverage detected