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

Method Drag

src/tracks/ui/TrackSelectHandle.cpp:114–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114UIHandle::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
151HitTestPreview TrackSelectHandle::Preview
152(const TrackPanelMouseState &, AudacityProject *project)

Callers

nothing calls this directly

Calls 5

GetFunction · 0.85
MoveUpMethod · 0.80
GetHeightMethod · 0.80
MoveDownMethod · 0.80
IsAudioActiveMethod · 0.45

Tested by

no test coverage detected