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

Method Click

src/tracks/ui/SelectHandle.cpp:540–807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

538}
539
540UIHandle::Result SelectHandle::Click(
541 const TrackPanelMouseEvent &evt, AudacityProject *pProject)
542{
543 /// This method gets called when we're handling selection
544 /// and the mouse was just clicked.
545
546 using namespace RefreshCode;
547
548 const auto pView = mpView.lock();
549 if ( !pView )
550 return Cancelled;
551 auto &view = *pView;
552
553 wxMouseEvent &event = evt.event;
554 auto &trackList = TrackList::Get(*pProject);
555 const auto pTrack = FindTrack();
556 if (!pTrack)
557 return Cancelled;
558 auto &trackPanel = TrackPanel::Get(*pProject);
559 auto &viewInfo = ViewInfo::Get(*pProject);
560
561 mMostRecentX = event.m_x;
562 mMostRecentY = event.m_y;
563
564 bool selectChange = (
565 event.LeftDown() &&
566 event.ControlDown() &&
567 pTrack->TypeSwitch<bool>( [&](LabelTrack &){
568 // We should reach this, only in default of other hits on glyphs or
569 // text boxes.
570 bool bShift = event.ShiftDown();
571 bool unsafe = ProjectAudioIO::Get( *pProject ).IsAudioActive();
572 SelectUtilities::DoListSelection(
573 *pProject, *pTrack, bShift, true, !unsafe);
574 return true;
575 } )
576 );
577 if ( selectChange )
578 // Do not start a drag
579 return RefreshAll | Cancelled;
580
581 auto &selectionState = SelectionState::Get( *pProject );
582 if (event.LeftDClick() && !event.ShiftDown()) {
583 // Deselect all other tracks and select this one.
584 selectionState.SelectNone(trackList);
585
586 if (pTrack)
587 selectionState.SelectTrack(*pTrack, true, true);
588
589 // Default behavior: select whole track
590 SelectionState::SelectTrackLength(
591 viewInfo, *pTrack, SyncLockState::Get(*pProject).IsSyncLocked());
592
593 // Special case: if we're over a clip in a WaveTrack,
594 // select just that clip
595 if (const auto pWc = view.FindChannel<WaveChannel>()) {
596 auto &wc = *pWc;
597 auto time = viewInfo.PositionToTime(event.m_x, mRect.x);

Callers

nothing calls this directly

Calls 15

GetFunction · 0.85
DoListSelectionFunction · 0.85
ChooseBoundaryFunction · 0.85
SelectNoneMethod · 0.80
SelectTrackMethod · 0.80
IsSyncLockedMethod · 0.80
PositionToTimeMethod · 0.80
setTimesMethod · 0.80
TimeToPositionMethod · 0.80
GetSelectedTrackCountMethod · 0.80
FindTrackFunction · 0.70

Tested by

no test coverage detected