mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
Use new class to fade
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1941 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
@@ -48,6 +48,7 @@
|
|||||||
#include <global.h>
|
#include <global.h>
|
||||||
#include <neutrino.h>
|
#include <neutrino.h>
|
||||||
#include <neutrino_menue.h>
|
#include <neutrino_menue.h>
|
||||||
|
#include <driver/fade.h>
|
||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
@@ -63,7 +64,6 @@ CMenuForwarder * const GenericMenuBack = &CGenericMenuBack;
|
|||||||
CMenuForwarder * const GenericMenuCancel = &CGenericMenuCancel;
|
CMenuForwarder * const GenericMenuCancel = &CGenericMenuCancel;
|
||||||
CMenuForwarder * const GenericMenuNext = &CGenericMenuNext;
|
CMenuForwarder * const GenericMenuNext = &CGenericMenuNext;
|
||||||
|
|
||||||
|
|
||||||
CMenuItem::CMenuItem()
|
CMenuItem::CMenuItem()
|
||||||
{
|
{
|
||||||
x = -1;
|
x = -1;
|
||||||
@@ -123,11 +123,10 @@ void CMenuItem::initItemColors(const bool select_mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CMenuItem::paintItemBackground (const bool select_mode, const int &item_height)
|
void CMenuItem::paintItemBackground (const bool select_mode, const int &item_height)
|
||||||
{
|
{
|
||||||
CFrameBuffer *frameBuffer = CFrameBuffer::getInstance();
|
CFrameBuffer *frameBuffer = CFrameBuffer::getInstance();
|
||||||
|
//FIXME what select_mode change here ??
|
||||||
if(select_mode)
|
if(select_mode)
|
||||||
frameBuffer->paintBoxRel(x, y, dx, item_height, item_bgcolor, RADIUS_LARGE);
|
frameBuffer->paintBoxRel(x, y, dx, item_height, item_bgcolor, RADIUS_LARGE);
|
||||||
else
|
else
|
||||||
@@ -170,7 +169,6 @@ void CMenuItem::prepareItem(const bool select_mode, const int &item_height)
|
|||||||
paintItemBackground(select_mode, item_height);
|
paintItemBackground(select_mode, item_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CMenuItem::paintItemSlider( const bool select_mode, const int &item_height, const int &optionvalue, const int &factor, const char * left_text, const char * right_text)
|
void CMenuItem::paintItemSlider( const bool select_mode, const int &item_height, const int &optionvalue, const int &factor, const char * left_text, const char * right_text)
|
||||||
{
|
{
|
||||||
CFrameBuffer *frameBuffer = CFrameBuffer::getInstance();
|
CFrameBuffer *frameBuffer = CFrameBuffer::getInstance();
|
||||||
@@ -469,16 +467,9 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &)
|
|||||||
if (parent)
|
if (parent)
|
||||||
parent->hide();
|
parent->hide();
|
||||||
|
|
||||||
bool fadeIn = g_settings.widget_fade && fade;
|
COSDFader fader(g_settings.menu_Content_alpha);
|
||||||
bool fadeOut = false;
|
if(fade)
|
||||||
uint32_t fadeTimer = 0;
|
fader.StartFadeIn();
|
||||||
int fadeValue = g_settings.menu_Content_alpha;
|
|
||||||
if ( fadeIn ) {
|
|
||||||
fadeValue = 100;
|
|
||||||
frameBuffer->setBlendMode(2); // Global alpha multiplied with pixel alpha
|
|
||||||
frameBuffer->setBlendLevel(fadeValue, fadeValue);
|
|
||||||
fadeTimer = g_RCInput->addTimer( FADE_TIME, false );
|
|
||||||
}
|
|
||||||
|
|
||||||
if(from_wizard) {
|
if(from_wizard) {
|
||||||
for (unsigned int count = 0; count < items.size(); count++) {
|
for (unsigned int count = 0; count < items.size(); count++) {
|
||||||
@@ -499,8 +490,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &)
|
|||||||
g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd, bAllowRepeatLR);
|
g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd, bAllowRepeatLR);
|
||||||
|
|
||||||
if ( msg <= CRCInput::RC_MaxRC ) {
|
if ( msg <= CRCInput::RC_MaxRC ) {
|
||||||
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings
|
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
|
||||||
::TIMING_MENU]);
|
|
||||||
}
|
}
|
||||||
int handled= false;
|
int handled= false;
|
||||||
|
|
||||||
@@ -522,27 +512,9 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &)
|
|||||||
if (!handled) {
|
if (!handled) {
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case (NeutrinoMessages::EVT_TIMER):
|
case (NeutrinoMessages::EVT_TIMER):
|
||||||
if(data == fadeTimer) {
|
if(data == fader.GetTimer()) {
|
||||||
if (fadeOut) { // disappear
|
if(fader.Fade())
|
||||||
fadeValue += FADE_STEP;
|
|
||||||
if (fadeValue >= 100) {
|
|
||||||
fadeValue = g_settings.menu_Content_alpha;
|
|
||||||
g_RCInput->killTimer (fadeTimer);
|
|
||||||
msg = CRCInput::RC_timeout;
|
msg = CRCInput::RC_timeout;
|
||||||
} 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) {
|
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) {
|
||||||
retval = menu_return::RETURN_EXIT_ALL;
|
retval = menu_return::RETURN_EXIT_ALL;
|
||||||
@@ -660,11 +632,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &)
|
|||||||
//exec this item...
|
//exec this item...
|
||||||
CMenuItem* item = items[selected];
|
CMenuItem* item = items[selected];
|
||||||
item->msg = msg;
|
item->msg = msg;
|
||||||
if ( fadeIn ) {
|
fader.Stop();
|
||||||
g_RCInput->killTimer(fadeTimer);
|
|
||||||
fadeIn = false;
|
|
||||||
frameBuffer->setBlendMode(1); // Set back to per pixel alpha
|
|
||||||
}
|
|
||||||
int rv = item->exec( this );
|
int rv = item->exec( this );
|
||||||
switch ( rv ) {
|
switch ( rv ) {
|
||||||
case menu_return::RETURN_EXIT_ALL:
|
case menu_return::RETURN_EXIT_ALL:
|
||||||
@@ -707,15 +675,8 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(msg == CRCInput::RC_timeout) {
|
if(msg == CRCInput::RC_timeout) {
|
||||||
if ( fadeIn ) {
|
if(fade && fader.StartFadeOut()) {
|
||||||
g_RCInput->killTimer(fadeTimer);
|
|
||||||
fadeIn = false;
|
|
||||||
}
|
|
||||||
if ((!fadeOut) && g_settings.widget_fade && fade) {
|
|
||||||
fadeOut = true;
|
|
||||||
fadeTimer = g_RCInput->addTimer( FADE_TIME, false );
|
|
||||||
timeoutEnd = CRCInput::calcTimeoutEnd( 1 );
|
timeoutEnd = CRCInput::calcTimeoutEnd( 1 );
|
||||||
frameBuffer->setBlendMode(2); // Global alpha multiplied with pixel alpha
|
|
||||||
msg = 0;
|
msg = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -733,10 +694,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &)
|
|||||||
delete[] background;
|
delete[] background;
|
||||||
background = NULL;
|
background = NULL;
|
||||||
|
|
||||||
if ( fadeIn || fadeOut ) {
|
fader.Stop();
|
||||||
g_RCInput->killTimer(fadeTimer);
|
|
||||||
frameBuffer->setBlendMode(1); // Set back to per pixel alpha
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!parent)
|
if(!parent)
|
||||||
CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO);
|
CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO);
|
||||||
|
Reference in New Issue
Block a user