Merge "Added New methods to cater for second step initialization" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / builder / builder-impl.cpp
index 7e2f786..de3fbe1 100644 (file)
@@ -58,7 +58,6 @@ class Replacement;
 extern Animation CreateAnimation(const TreeNode& child, const Replacement& replacements, const Dali::Actor searchRoot, Builder* const builder );
 extern Actor SetupSignalAction(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor, Dali::Toolkit::Internal::Builder* const builder);
 extern Actor SetupPropertyNotification(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor, Dali::Toolkit::Internal::Builder* const builder);
-extern Actor SetupActor( const TreeNode& node, Actor& actor, const Replacement& constant );
 
 #if defined(DEBUG_ENABLED)
 Integration::Log::Filter* gFilterScript  = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_SCRIPT");
@@ -103,7 +102,7 @@ bool GetMappingKey( const std::string& str, std::string& key )
 }
 
 /*
- * Recursively collects all stylesin a node (An array of style names).
+ * Recursively collects all styles in a node (An array of style names).
  *
  * stylesCollection The set of styles from the json file (a json object of named styles)
  * style The style array to begin the collection from
@@ -118,7 +117,7 @@ void CollectAllStyles( const TreeNode& stylesCollection, const TreeNode& style,
     {
       if( OptionalString styleName = IsString( (*iter).second ) )
       {
-        if( OptionalChild node = IsChild( stylesCollection, *styleName) )
+        if( OptionalChild node = IsChildIgnoreCase( stylesCollection, *styleName) )
         {
           styleList.push_back( &(*node) );
 
@@ -180,9 +179,9 @@ void Builder::SetProperties( const TreeNode& node, Handle& handle, const Replace
           mapped = DeterminePropertyFromNode( keyChild.second, type, value, constant );
           if( ! mapped )
           {
-            // verbose as this might not be a problem
-            // eg parentOrigin can be a string which is picked up later
-            DALI_SCRIPT_VERBOSE("Could not convert property:%s\n", key.c_str());
+            // Just determine the property from the node and if it's valid, let the property object handle it
+            DeterminePropertyFromNode( keyChild.second, value, constant );
+            mapped = ( value.GetType() != Property::NONE );
           }
         }
         if( mapped )
@@ -240,8 +239,6 @@ void Builder::ApplyProperties( const TreeNode& root, const TreeNode& node,
 
     if( actor )
     {
-      SetupActor( node, actor, constant );
-
       // add signals
       SetupSignalAction( mSlotDelegate.GetConnectionTracker(), root, node, actor, this );
       SetupPropertyNotification( mSlotDelegate.GetConnectionTracker(), root, node, actor, this );
@@ -1017,10 +1014,13 @@ bool Builder::ConvertChildValue( const TreeNode& mappingRoot, KeyStack& keyStack
     case Property::MAP:
     {
       Property::Map* map = child.GetMap();
-      for( Property::Map::SizeType i=0; i < map->Count(); ++i )
+      if( map )
       {
-        Property::Value& child = map->GetValue(i);
-        ConvertChildValue(mappingRoot, keyStack, child);
+        for( Property::Map::SizeType i=0; i < map->Count(); ++i )
+        {
+          Property::Value& child = map->GetValue(i);
+          ConvertChildValue(mappingRoot, keyStack, child);
+        }
       }
       break;
     }
@@ -1028,10 +1028,13 @@ bool Builder::ConvertChildValue( const TreeNode& mappingRoot, KeyStack& keyStack
     case Property::ARRAY:
     {
       Property::Array* array = child.GetArray();
-      for( Property::Array::SizeType i=0; i < array->Count(); ++i )
+      if( array )
       {
-        Property::Value& child = array->GetElementAt(i);
-        ConvertChildValue(mappingRoot, keyStack, child);
+        for( Property::Array::SizeType i=0; i < array->Count(); ++i )
+        {
+          Property::Value& child = array->GetElementAt(i);
+          ConvertChildValue(mappingRoot, keyStack, child);
+        }
       }
       break;
     }
@@ -1228,7 +1231,9 @@ bool Builder::ApplyStyle( const std::string& styleName, Handle& handle, const Re
   DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
 
   OptionalChild styles = IsChild( *mParser.GetRoot(), KEYNAME_STYLES );
-  OptionalChild style  = IsChild( *styles, styleName );
+
+  std::string styleNameLower(styleName);
+  OptionalChild style  = IsChildIgnoreCase( *styles, styleNameLower );
 
   if( styles && style )
   {