Update engine.cpp

A better way to update the play button icons, which requires less "if" checks and method calls in total.
This commit is contained in:
Alexandre Almeida
2014-02-09 18:57:03 -02:00
parent 64e1c2080c
commit f10d856290

View File

@@ -150,10 +150,35 @@ void engine::destroy()
void engine::updatePlayPauseIcons()
{
s_songEditor->updatePlayPauseIcon();
s_automationEditor->updatePlayPauseIcon();
s_bbEditor->updatePlayPauseIcon();
s_pianoRoll->updatePlayPauseIcon();
s_songEditor->setPauseIcon( false );
s_automationEditor->setPauseIcon( false );
s_bbEditor->setPauseIcon( false );
s_pianoRoll->setPauseIcon( false );
if( s_song->isPlaying() )
{
switch( s_song->playMode() )
{
case song::Mode_PlaySong:
s_songEditor->setPauseIcon( true );
break;
case song::Mode_PlayAutomationPattern:
s_automationEditor->setPauseIcon( true );
break;
case song::Mode_PlayBB:
s_bbEditor->setPauseIcon( true );
break;
case song::Mode_PlayPattern:
s_pianoRoll->setPauseIcon( true );
break;
default:
break;
}
}
}