| 1291 | } |
| 1292 | |
| 1293 | void AudioDisplay::OnSelectionChanged() |
| 1294 | { |
| 1295 | TimeRange sel(controller->GetPrimaryPlaybackRange()); |
| 1296 | scrollbar->SetSelection(AbsoluteXFromTime(sel.begin()), AbsoluteXFromTime(sel.length())); |
| 1297 | |
| 1298 | if (audio_marker) |
| 1299 | { |
| 1300 | if (!scroll_timer.IsRunning()) |
| 1301 | { |
| 1302 | // If the dragged object is outside the visible area, start the |
| 1303 | // scroll timer to shift it back into view |
| 1304 | int rel_x = RelativeXFromTime(audio_marker->GetPosition()); |
| 1305 | if (rel_x < 0 || rel_x >= GetClientSize().GetWidth()) |
| 1306 | { |
| 1307 | // 50ms is the default for this on Windows (hardcoded since |
| 1308 | // wxSystemSettings doesn't expose DragScrollDelay etc.) |
| 1309 | scroll_timer.Start(50, true); |
| 1310 | } |
| 1311 | } |
| 1312 | } |
| 1313 | else if (OPT_GET("Audio/Auto/Scroll")->GetBool() && sel.end() != 0) |
| 1314 | { |
| 1315 | ScrollTimeRangeInView(sel); |
| 1316 | } |
| 1317 | |
| 1318 | RefreshRect(scrollbar->GetBounds(), false); |
| 1319 | } |
| 1320 | |
| 1321 | void AudioDisplay::OnScrollTimer(wxTimerEvent &event) |
| 1322 | { |
nothing calls this directly
no test coverage detected