#include <sstream>
// INTERNAL INCLUDES
-#include <dali/dali.h>
#include <dali/integration-api/debug.h>
#include <dali-toolkit/public-api/controls/control.h>
{
class Replacement;
-extern Animation CreateAnimation(const TreeNode& child, const Replacement& replacements, const Dali::Actor searchRoot );
+extern Animation CreateAnimation(const TreeNode& child, const Replacement& replacements, const Dali::Actor searchRoot, Builder* const builder );
extern bool SetPropertyFromNode( const TreeNode& node, Property::Value& value );
extern bool SetPropertyFromNode( const TreeNode& node, Property::Value& value, const Replacement& replacements );
extern bool SetPropertyFromNode( const TreeNode& node, Property::Type type, Property::Value& value );
extern bool SetPropertyFromNode( const TreeNode& node, Property::Type type, Property::Value& value, const Replacement& replacements );
-extern Actor SetupSignalAction(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor, boost::function<void (void)> quitAction);
-extern Actor SetupPropertyNotification(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor, boost::function<void (void)> quitAction);
+extern Actor SetupSignalAction(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor, boost::function<void (void)> quitAction, Dali::Toolkit::Internal::Builder* const builder);
+extern Actor SetupPropertyNotification(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor, boost::function<void (void)> quitAction, Dali::Toolkit::Internal::Builder* const builder);
extern Actor SetupActor( const TreeNode& node, Actor& actor, const Replacement& constant );
#if defined(DEBUG_ENABLED)
// add signals
QuitAction quitAction( *this );
- SetupSignalAction( mSlotDelegate.GetConnectionTracker(), root, node, actor, quitAction );
- SetupPropertyNotification( mSlotDelegate.GetConnectionTracker(), root, node, actor, quitAction );
+ SetupSignalAction( mSlotDelegate.GetConnectionTracker(), root, node, actor, quitAction, this );
+ SetupPropertyNotification( mSlotDelegate.GetConnectionTracker(), root, node, actor, quitAction, this );
}
}
else
return ret;
}
-Toolkit::Builder::Signal& Builder::QuitSignal()
+Path Builder::GetPath( const std::string& name )
+{
+ DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
+
+ Path ret;
+
+ PathLut::const_iterator iter( mPathLut.find( name ) );
+ if( iter != mPathLut.end() )
+ {
+ ret = iter->second;
+ }
+ else
+ {
+ if( OptionalChild paths = IsChild( *mParser.GetRoot(), "paths") )
+ {
+ if( OptionalChild path = IsChild( *paths, name ) )
+ {
+ //points property
+ if( OptionalChild pointsProperty = IsChild( *path, "points") )
+ {
+ Dali::Property::Value points(Property::ARRAY);
+ if( SetPropertyFromNode( *pointsProperty, Property::ARRAY, points ) )
+ {
+ ret = Path::New();
+ ret.SetProperty( Path::POINTS, points);
+
+ //control-points property
+ if( OptionalChild pointsProperty = IsChild( *path, "control-points") )
+ {
+ Dali::Property::Value points(Property::ARRAY);
+ if( SetPropertyFromNode( *pointsProperty, Property::ARRAY, points ) )
+ {
+ ret.SetProperty( Path::CONTROL_POINTS, points);
+ }
+ }
+ else
+ {
+ //Curvature
+ float curvature(0.25f);
+ if( OptionalFloat pointsProperty = IsFloat( *path, "curvature") )
+ {
+ curvature = *pointsProperty;
+ }
+ ret.GenerateControlPoints(curvature);
+ }
+
+ //Add the new path to the hash table for paths
+ mPathLut[ name ] = ret;
+ }
+ }
+ else
+ {
+ //Interpolation points not specified
+ DALI_SCRIPT_WARNING("Interpolation points not specified for path '%s'\n", name.c_str() );
+ }
+ }
+
+ }
+ }
+
+ return ret;
+}
+
+Toolkit::Builder::BuilderSignalType& Builder::QuitSignal()
{
return mQuitSignal;
}
{
DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
- PropertyValueMap overrideMap;
+ Property::Map overrideMap;
Replacement replacements(overrideMap, mReplacementMap);
OptionalChild add = IsChild(*mParser.GetRoot(), sectionName);
{
if( OptionalChild animation = IsChild(*animations, animationName) )
{
- anim = Dali::Toolkit::Internal::CreateAnimation( *animation, replacement, sourceActor );
+ anim = Dali::Toolkit::Internal::CreateAnimation( *animation, replacement, sourceActor, this );
}
else
{
return anim;
}
-Animation Builder::CreateAnimation( const std::string& animationName, const PropertyValueMap& map, Dali::Actor sourceActor )
+Animation Builder::CreateAnimation( const std::string& animationName, const Property::Map& map, Dali::Actor sourceActor )
{
Replacement replacement(map, mReplacementMap);
return CreateAnimation( animationName, replacement, sourceActor);
}
-Animation Builder::CreateAnimation( const std::string& animationName, const PropertyValueMap& map )
+Animation Builder::CreateAnimation( const std::string& animationName, const Property::Map& map )
{
Replacement replacement(map, mReplacementMap);
return CreateAnimation( animationName, replacement, Stage::GetCurrent().GetRootLayer() );
void Builder::LoadFromString( std::string const& data, Dali::Toolkit::Builder::UIFormat format )
{
- DALI_ASSERT_ALWAYS( format == Dali::Toolkit::Builder::JSON && "Currently only JSON is supported" );
-
// parser to get constants and includes only
Dali::Toolkit::JsonParser parser = Dali::Toolkit::JsonParser::New();
}
-void Builder::AddConstants( const PropertyValueMap& map )
+void Builder::AddConstants( const Property::Map& map )
{
- for(PropertyValueMap::const_iterator iter = map.begin(); iter != map.end(); ++iter)
- {
- mReplacementMap[ (*iter).first ] = (*iter).second;
- }
+ mReplacementMap.Merge( map );
}
void Builder::AddConstant( const std::string& key, const Property::Value& value )
mReplacementMap[key] = value;
}
-const PropertyValueMap& Builder::GetConstants() const
+const Property::Map& Builder::GetConstants() const
{
return mReplacementMap;
}
const Property::Value& Builder::GetConstant( const std::string& key ) const
{
- PropertyValueMap::const_iterator iter = mReplacementMap.find( key );
- if( iter != mReplacementMap.end() )
+ Property::Value* match = mReplacementMap.Find( key );
+ if( match )
{
- return (*iter).second;
+ return (*match);
}
else
{
}
}
-void Builder::LoadConstants( const TreeNode& root, PropertyValueMap& intoMap )
+void Builder::LoadConstants( const TreeNode& root, Property::Map& intoMap )
{
Replacement replacer(intoMap);
}
#if defined(DEBUG_ENABLED)
- PropertyValueMap::const_iterator iter = intoMap.find( "CONFIG_SCRIPT_LOG_LEVEL" );
- if( iter != intoMap.end() && (*iter).second.GetType() == Property::STRING )
+ Property::Value* iter = intoMap.Find( "CONFIG_SCRIPT_LOG_LEVEL" );
+ if( iter && iter->GetType() == Property::STRING )
{
- std::string logLevel( (*iter).second.Get< std::string >() );
+ std::string logLevel( iter->Get< std::string >() );
if( logLevel == "NoLogging" )
{
gFilterScript->SetLogLevel( Integration::Log::NoLogging );
}
}
-BaseHandle Builder::Create( const std::string& templateName, const PropertyValueMap& map )
+BaseHandle Builder::Create( const std::string& templateName, const Property::Map& map )
{
Replacement replacement( map, mReplacementMap );
return Create( templateName, replacement );