Commit ef4685ad authored by Olivier Teulière's avatar Olivier Teulière

* skins2/parser/interpreter.cpp: Check the VarMAnager first before trying to...

 * skins2/parser/interpreter.cpp: Check the VarMAnager first before trying to parse the action. This fixes a bug with dvd.isActive and LayoutID.isActive
parent 206a6d2e
...@@ -394,49 +394,55 @@ VarBool *Interpreter::getVarBool( const string &rName, Theme *pTheme ) ...@@ -394,49 +394,55 @@ VarBool *Interpreter::getVarBool( const string &rName, Theme *pTheme )
// Register this variable in the manager // Register this variable in the manager
pVarManager->registerVar( VariablePtr( pNewVar ) ); pVarManager->registerVar( VariablePtr( pNewVar ) );
} }
else if( token.find( ".isVisible" ) != string::npos ) else
{ {
int leftPos = token.find( ".isVisible" ); // Try first to get the variable from the variable manager
string windowId = token.substr( 0, leftPos ); // Indeed, if the skin designer is stupid enough to call a layout
TopWindow *pWin = pTheme->getWindowById( windowId ); // "dvd", we want "dvd.isActive" to resolve as the built-in action
if( pWin ) // and not as the "layoutId.isActive" one.
VarBool *pVar = (VarBool*)pVarManager->getVar( token, "bool" );
if( pVar )
{ {
// Push the visibility variable onto the stack varStack.push_back( pVar );
varStack.push_back( &pWin->getVisibleVar() );
} }
else else if( token.find( ".isVisible" ) != string::npos )
{ {
msg_Err( getIntf(), "unknown window (%s)", windowId.c_str() ); int leftPos = token.find( ".isVisible" );
return NULL; string windowId = token.substr( 0, leftPos );
TopWindow *pWin = pTheme->getWindowById( windowId );
if( pWin )
{
// Push the visibility variable onto the stack
varStack.push_back( &pWin->getVisibleVar() );
}
else
{
msg_Err( getIntf(), "unknown window (%s)", windowId.c_str() );
return NULL;
}
} }
} else if( token.find( ".isActive" ) != string::npos )
else if( token.find( ".isActive" ) != string::npos )
{
int leftPos = token.find( ".isActive" );
string layoutId = token.substr( 0, leftPos );
GenericLayout *pLayout = pTheme->getLayoutById( layoutId );
if( pLayout )
{ {
// Push the isActive variable onto the stack int leftPos = token.find( ".isActive" );
varStack.push_back( &pLayout->getActiveVar() ); string layoutId = token.substr( 0, leftPos );
GenericLayout *pLayout = pTheme->getLayoutById( layoutId );
if( pLayout )
{
// Push the isActive variable onto the stack
varStack.push_back( &pLayout->getActiveVar() );
}
else
{
msg_Err( getIntf(), "unknown layout (%s)", layoutId.c_str() );
return NULL;
}
} }
else else
{
msg_Err( getIntf(), "unknown layout (%s)", layoutId.c_str() );
return NULL;
}
}
else
{
// Try to get the variable from the variable manager
VarBool *pVar = (VarBool*)pVarManager->getVar( token, "bool" );
if( !pVar )
{ {
msg_Err( getIntf(), "cannot resolve boolean variable: %s", msg_Err( getIntf(), "cannot resolve boolean variable: %s",
token.c_str()); token.c_str());
return NULL; return NULL;
} }
varStack.push_back( pVar );
} }
// Get the first token from the RPN stack // Get the first token from the RPN stack
token = evaluator.getToken(); token = evaluator.getToken();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment