| 71 | } |
| 72 | |
| 73 | UIHandle::Result TrackSelectHandle::Click |
| 74 | (const TrackPanelMouseEvent &evt, AudacityProject *pProject) |
| 75 | { |
| 76 | // If unsafe to drag, still, it does harmlessly change the selected track |
| 77 | // set on button down. |
| 78 | |
| 79 | using namespace RefreshCode; |
| 80 | Result result = RefreshNone; |
| 81 | |
| 82 | const wxMouseEvent &event = evt.event; |
| 83 | |
| 84 | // AS: If not a click, ignore the mouse event. |
| 85 | if (!event.ButtonDown() && !event.ButtonDClick()) |
| 86 | return Cancelled; |
| 87 | if (!event.Button(wxMOUSE_BTN_LEFT)) |
| 88 | return Cancelled; |
| 89 | |
| 90 | const auto pTrack = mpTrack; |
| 91 | if (!pTrack) |
| 92 | return Cancelled; |
| 93 | const bool unsafe = ProjectAudioIO::Get( *pProject ).IsAudioActive(); |
| 94 | |
| 95 | // DM: If they weren't clicking on a particular part of a track label, |
| 96 | // deselect other tracks and select this one. |
| 97 | |
| 98 | // JH: also, capture the current track for rearranging, so the user |
| 99 | // can drag the track up or down to swap it with others |
| 100 | if (unsafe) |
| 101 | result |= Cancelled; |
| 102 | else { |
| 103 | mRearrangeCount = 0; |
| 104 | CalculateRearrangingThresholds(event, pProject); |
| 105 | } |
| 106 | |
| 107 | SelectUtilities::DoListSelection(*pProject, |
| 108 | *pTrack, event.ShiftDown(), event.ControlDown(), !unsafe); |
| 109 | |
| 110 | mClicked = true; |
| 111 | return result; |
| 112 | } |
| 113 | |
| 114 | UIHandle::Result TrackSelectHandle::Drag |
| 115 | (const TrackPanelMouseEvent &evt, AudacityProject *pProject) |
nothing calls this directly
no test coverage detected