Skip to content

Commit

Permalink
Add safeguard for beat pattern wheelevent
Browse files Browse the repository at this point in the history
  • Loading branch information
diizy committed Jul 13, 2014
1 parent e06c281 commit d4e30d5
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/tracks/pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,27 +855,27 @@ void patternView::wheelEvent( QWheelEvent * _we )
{
vol = n->getVolume();
len = n->length();
}

if( len == 0 && _we->delta() > 0 )
{
n->setLength( -DefaultTicksPerTact );
n->setVolume( 5 );
}
else if( _we->delta() > 0 )
{
n->setVolume( qMin( 100, vol + 5 ) );
}
else
{
n->setVolume( qMax( 0, vol - 5 ) );
}
if( len == 0 && _we->delta() > 0 )
{
n->setLength( -DefaultTicksPerTact );
n->setVolume( 5 );
}
else if( _we->delta() > 0 )
{
n->setVolume( qMin( 100, vol + 5 ) );
}
else
{
n->setVolume( qMax( 0, vol - 5 ) );
}

engine::getSong()->setModified();
update();
if( engine::pianoRoll()->currentPattern() == m_pat )
{
engine::pianoRoll()->update();
engine::getSong()->setModified();
update();
if( engine::pianoRoll()->currentPattern() == m_pat )
{
engine::pianoRoll()->update();
}
}
_we->accept();
}
Expand Down

0 comments on commit d4e30d5

Please sign in to comment.