MCPcopy Create free account
hub / github.com/LMMS/lmms / mouseMoveEvent

Method mouseMoveEvent

src/gui/TimeLineWidget.cpp:367–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365
366
367void TimeLineWidget::mouseMoveEvent( QMouseEvent* event )
368{
369 parentWidget()->update(); // essential for widgets that this timeline had taken their mouse move event from.
370 const MidiTime t = m_begin + static_cast<int>( qMax( event->x() - m_xOffset - m_moveXOff, 0 ) * MidiTime::ticksPerTact() / m_ppt );
371
372 switch( m_action )
373 {
374 case MovePositionMarker:
375 m_pos.setTicks( t.getTicks() );
376 Engine::getSong()->setMilliSeconds( ( t.getTicks() *
377 ( 60 * 1000 / 48 ) ) /
378 Engine::getSong()->getTempo() );
379 m_pos.setCurrentFrame( 0 );
380 m_pos.setJumped( true );
381 updatePosition();
382 positionMarkerMoved();
383 break;
384
385 case MoveLoopBegin:
386 case MoveLoopEnd:
387 {
388 const int i = m_action - MoveLoopBegin;
389 if( event->modifiers() & Qt::ControlModifier )
390 {
391 // no ctrl-press-hint when having ctrl pressed
392 delete m_hint;
393 m_hint = NULL;
394 m_loopPos[i] = t;
395 }
396 else
397 {
398 m_loopPos[i] = t.toNearestTact();
399 }
400 // Catch begin == end
401 if( m_loopPos[0] == m_loopPos[1] )
402 {
403 // Note, swap 1 and 0 below and the behavior "skips" the other
404 // marking instead of pushing it.
405 if( m_action == MoveLoopBegin )
406 m_loopPos[0] -= MidiTime::ticksPerTact();
407 else
408 m_loopPos[1] += MidiTime::ticksPerTact();
409 }
410 update();
411 break;
412 }
413 case SelectSongTCO:
414 emit regionSelectedFromPixels( m_initalXSelect , event->x() );
415 break;
416
417 default:
418 break;
419 }
420}
421
422
423

Callers

nothing calls this directly

Calls 9

ticksPerTactFunction · 0.85
getSongFunction · 0.85
setTicksMethod · 0.80
getTicksMethod · 0.80
getTempoMethod · 0.80
setCurrentFrameMethod · 0.80
setJumpedMethod · 0.80
toNearestTactMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected