]> git.sesse.net Git - vlc/commitdiff
* skins2/parser/interpreter.cpp: Check the VarMAnager first before trying to parse...
authorOlivier Teulière <ipkiss@videolan.org>
Wed, 14 Jun 2006 18:25:51 +0000 (18:25 +0000)
committerOlivier Teulière <ipkiss@videolan.org>
Wed, 14 Jun 2006 18:25:51 +0000 (18:25 +0000)
modules/gui/skins2/parser/interpreter.cpp

index 8598cac9fe08227b3b94ac41d7f46ac14c49ef81..2b52230ef9f736f947f89ce89fc0baa4b63e20bd 100644 (file)
@@ -394,49 +394,55 @@ VarBool *Interpreter::getVarBool( const string &rName, Theme *pTheme )
             // Register this variable in the manager
             pVarManager->registerVar( VariablePtr( pNewVar ) );
         }
-        else if( token.find( ".isVisible" ) != string::npos )
+        else
         {
-            int leftPos = token.find( ".isVisible" );
-            string windowId = token.substr( 0, leftPos );
-            TopWindow *pWin = pTheme->getWindowById( windowId );
-            if( pWin )
+            // Try first to get the variable from the variable manager
+            // Indeed, if the skin designer is stupid enough to call a layout
+            // "dvd", we want "dvd.isActive" to resolve as the built-in action
+            // 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( &pWin->getVisibleVar() );
+                varStack.push_back( pVar );
             }
-            else
+            else if( token.find( ".isVisible" ) != string::npos )
             {
-                msg_Err( getIntf(), "unknown window (%s)", windowId.c_str() );
-                return NULL;
+                int leftPos = token.find( ".isVisible" );
+                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 )
-        {
-            int leftPos = token.find( ".isActive" );
-            string layoutId = token.substr( 0, leftPos );
-            GenericLayout *pLayout = pTheme->getLayoutById( layoutId );
-            if( pLayout )
+            else if( token.find( ".isActive" ) != string::npos )
             {
-                // Push the isActive variable onto the stack
-                varStack.push_back( &pLayout->getActiveVar() );
+                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
+                    varStack.push_back( &pLayout->getActiveVar() );
+                }
+                else
+                {
+                    msg_Err( getIntf(), "unknown layout (%s)", layoutId.c_str() );
+                    return NULL;
+                }
             }
             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",
                          token.c_str());
                 return NULL;
             }
-            varStack.push_back( pVar );
         }
         // Get the first token from the RPN stack
         token = evaluator.getToken();