Handle small cursor and play head movements
| 311 | |
| 312 | // Handle small cursor and play head movements |
| 313 | void SeekLeftOrRight |
| 314 | (AudacityProject &project, double direction, SelectionOperation operation, |
| 315 | SeekInfo &info) |
| 316 | { |
| 317 | // PRL: What I found and preserved, strange though it be: |
| 318 | // During playback: jump depends on preferences and is independent of the |
| 319 | // zoom and does not vary if the key is held |
| 320 | // Else: jump depends on the zoom and gets bigger if the key is held |
| 321 | |
| 322 | if( ProjectAudioIO::Get( project ).IsAudioActive() ) |
| 323 | { |
| 324 | if( operation == CURSOR_MOVE ) |
| 325 | SeekWhenAudioActive( info.mSeekShort * direction, |
| 326 | info.mLastSelectionAdjustment ); |
| 327 | else if( operation == SELECTION_EXTEND ) |
| 328 | SeekWhenAudioActive( info.mSeekLong * direction, |
| 329 | info.mLastSelectionAdjustment ); |
| 330 | // Note: no action for CURSOR_CONTRACT |
| 331 | return; |
| 332 | } |
| 333 | |
| 334 | // If the last adjustment was very recent, we are |
| 335 | // holding the key down and should move faster. |
| 336 | const wxLongLong curtime = ::wxGetUTCTimeMillis(); |
| 337 | enum { MIN_INTERVAL = 50 }; |
| 338 | const bool fast = |
| 339 | (curtime - info.mLastSelectionAdjustment < MIN_INTERVAL); |
| 340 | |
| 341 | info.mLastSelectionAdjustment = curtime; |
| 342 | |
| 343 | // How much faster should the cursor move if shift is down? |
| 344 | enum { LARGER_MULTIPLIER = 4 }; |
| 345 | const double seekStep = (fast ? LARGER_MULTIPLIER : 1.0) * direction; |
| 346 | |
| 347 | SeekWhenAudioInactive( project, seekStep, TIME_UNIT_PIXELS, operation); |
| 348 | } |
| 349 | |
| 350 | // Move the cursor forward or backward, while paused or while playing. |
| 351 | void DoCursorMove( |
no test coverage detected