From 725da8ec700888c4c53e394ad9b15cbb4c54d8ce Mon Sep 17 00:00:00 2001 From: focus Date: Tue, 6 Dec 2011 13:35:26 +0000 Subject: [PATCH] Use new class to fade git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1949 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/gui/dboxinfo.cpp | 50 +++++++------------------------------------- 1 file changed, 8 insertions(+), 42 deletions(-) diff --git a/src/gui/dboxinfo.cpp b/src/gui/dboxinfo.cpp index e6092e8c7..1f66372f8 100644 --- a/src/gui/dboxinfo.cpp +++ b/src/gui/dboxinfo.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -77,17 +78,8 @@ int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &) { parent->hide(); } - - 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(); @@ -107,38 +99,15 @@ int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &) { g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd ); - 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); - doLoop = 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()) + doLoop = false; } else if ( ( msg == CRCInput::RC_timeout ) || ( msg == CRCInput::RC_home ) || ( msg == CRCInput::RC_ok ) ) { - 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 doLoop = false; @@ -173,10 +142,7 @@ int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &) } hide(); - if ( fadeIn || fadeOut ) { - g_RCInput->killTimer(fadeTimer); - frameBuffer->setBlendMode(1); // Set back to per pixel alpha - } + fader.Stop(); return res; }