Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 15 additions & 19 deletions src/gui/TimeLineWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,40 +314,36 @@ void TimeLineWidget::mousePressEvent( QMouseEvent* event )
m_action = SelectSongTCO;
m_initalXSelect = event->x();
}
else if( event->button() == Qt::RightButton || event->button() == Qt::MiddleButton )
else if( event->button() == Qt::RightButton )
{
m_moveXOff = s_posMarkerPixmap->width() / 2;
const MidiTime t = m_begin + static_cast<int>( event->x() * MidiTime::ticksPerTact() / m_ppt );
if( m_loopPos[0] > m_loopPos[1] )
{
qSwap( m_loopPos[0], m_loopPos[1] );
}
if( ( event->modifiers() & Qt::ShiftModifier ) || event->button() == Qt::MiddleButton )
m_moveXOff = s_posMarkerPixmap->width() / 2;
const MidiTime t = m_begin + static_cast<int>( qMax( event->x() - m_xOffset - m_moveXOff, 0 ) * MidiTime::ticksPerTact() / m_ppt );
const MidiTime loopMid = ( m_loopPos[0] + m_loopPos[1] ) / 2;

if( t < loopMid )
{
m_action = MoveLoopBegin;
}
else
else if( t > loopMid )
{
m_action = MoveLoopEnd;
}

if( m_loopPos[0] > m_loopPos[1] )
{
qSwap( m_loopPos[0], m_loopPos[1] );
}

m_loopPos[( m_action == MoveLoopBegin ) ? 0 : 1] = t;
}

if( m_action == MoveLoopBegin )
if( m_action == MoveLoopBegin || m_action == MoveLoopEnd )
{
delete m_hint;
m_hint = TextFloat::displayMessage( tr( "Hint" ),
tr( "Press <%1> to disable magnetic loop points." ).arg(UI_CTRL_KEY),
embed::getIconPixmap( "hint" ), 0 );
}
else if( m_action == MoveLoopEnd )
{
delete m_hint;
m_hint = TextFloat::displayMessage( tr( "Hint" ),
tr( "Hold <Shift> to move the begin loop point; Press <%1> to disable magnetic loop points." ).arg(UI_CTRL_KEY),
embed::getIconPixmap( "hint" ), 0 );
}

mouseMoveEvent( event );
}

Expand Down Expand Up @@ -376,7 +372,7 @@ void TimeLineWidget::mouseMoveEvent( QMouseEvent* event )
case MoveLoopBegin:
case MoveLoopEnd:
{
const int i = m_action - MoveLoopBegin;
const int i = m_action - MoveLoopBegin; // i == 0 || i == 1
if( event->modifiers() & Qt::ControlModifier )
{
// no ctrl-press-hint when having ctrl pressed
Expand Down