| 112 | } |
| 113 | |
| 114 | UIHandle::Result TrackSelectHandle::Drag |
| 115 | (const TrackPanelMouseEvent &evt, AudacityProject *pProject) |
| 116 | { |
| 117 | using namespace RefreshCode; |
| 118 | Result result = RefreshNone; |
| 119 | if (!mpTrack) |
| 120 | return result; |
| 121 | |
| 122 | const wxMouseEvent &event = evt.event; |
| 123 | |
| 124 | auto &tracks = TrackList::Get( *pProject ); |
| 125 | |
| 126 | // probably harmless during play? However, we do disallow the click, so check this too. |
| 127 | bool unsafe = ProjectAudioIO::Get( *pProject ).IsAudioActive(); |
| 128 | if (unsafe) |
| 129 | return result; |
| 130 | |
| 131 | if (event.m_y < mMoveUpThreshold || event.m_y < 0) { |
| 132 | tracks.MoveUp(*mpTrack); |
| 133 | --mRearrangeCount; |
| 134 | } |
| 135 | else if ( event.m_y > mMoveDownThreshold |
| 136 | || event.m_y > evt.whole.GetHeight() ) { |
| 137 | tracks.MoveDown(*mpTrack); |
| 138 | ++mRearrangeCount; |
| 139 | } |
| 140 | else |
| 141 | return result; |
| 142 | |
| 143 | // JH: if we moved up or down, recalculate the thresholds and make sure the |
| 144 | // track is fully on-screen. |
| 145 | CalculateRearrangingThresholds(event, pProject); |
| 146 | |
| 147 | result |= EnsureVisible | RefreshAll; |
| 148 | return result; |
| 149 | } |
| 150 | |
| 151 | HitTestPreview TrackSelectHandle::Preview |
| 152 | (const TrackPanelMouseState &, AudacityProject *project) |
nothing calls this directly
no test coverage detected