diff --git a/src/gui/pluginlist.cpp b/src/gui/pluginlist.cpp index 0455cf651..da3ea9124 100644 --- a/src/gui/pluginlist.cpp +++ b/src/gui/pluginlist.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include @@ -136,16 +137,8 @@ int CPluginList::exec(CMenuTarget* parent, const std::string & /*actionKey*/) } } - bool fadeIn = g_settings.widget_fade; - bool fadeOut = false; - int fadeValue = g_settings.menu_Content_alpha; - uint32_t fadeTimer = 0; - if ( fadeIn ) { - fadeValue = 100; - frameBuffer->setBlendMode(2); // Global alpha multiplied with pixel alpha - frameBuffer->setBlendLevel(fadeValue, fadeValue); - fadeTimer = g_RCInput->addTimer( FADE_TIME, false ); - } + COSDFader fader(g_settings.menu_Content_alpha); + fader.StartFadeIn(); paint(); @@ -159,38 +152,16 @@ int CPluginList::exec(CMenuTarget* parent, const std::string & /*actionKey*/) if ( msg <= CRCInput::RC_MaxRC ) timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); - if((msg == NeutrinoMessages::EVT_TIMER) && (data == fadeTimer)) { - if (fadeOut) { // disappear - fadeValue += FADE_STEP; - if (fadeValue >= 100) { - fadeValue = g_settings.menu_Content_alpha; - g_RCInput->killTimer (fadeTimer); - loop = false; - } else - frameBuffer->setBlendLevel(fadeValue, fadeValue); - } else { // appears - fadeValue -= FADE_STEP; - if (fadeValue <= g_settings.menu_Content_alpha) { - fadeValue = g_settings.menu_Content_alpha; - g_RCInput->killTimer (fadeTimer); - fadeIn = false; - frameBuffer->setBlendMode(1); // Set back to per pixel alpha - } else - frameBuffer->setBlendLevel(fadeValue, fadeValue); + if((msg == NeutrinoMessages::EVT_TIMER) && (data == fader.GetTimer())) { + if(fader.Fade()) { + loop = false; } } else if ( ( msg == CRCInput::RC_timeout ) || ( msg == (neutrino_msg_t)g_settings.key_channelList_cancel ) ) { - if ( fadeIn ) { - g_RCInput->killTimer(fadeTimer); - fadeIn = false; - } - if ((!fadeOut) && g_settings.widget_fade) { - fadeOut = true; - fadeTimer = g_RCInput->addTimer( FADE_TIME, false ); + if(fader.StartFadeOut()) { timeoutEnd = CRCInput::calcTimeoutEnd( 1 ); - frameBuffer->setBlendMode(2); // Global alpha multiplied with pixel alpha msg = 0; } else loop=false; @@ -279,10 +250,8 @@ int CPluginList::exec(CMenuTarget* parent, const std::string & /*actionKey*/) } } hide(); - if ( fadeIn || fadeOut ) { - g_RCInput->killTimer(fadeTimer); - frameBuffer->setBlendMode(1); // Set back to per pixel alpha - } + + fader.Stop(); return res; }