X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fbuilder%2Fbuilder-signals.cpp;h=c17738588e2ad24f65831ed20f0355e83afa7cd5;hp=b3372f29c0e1696b5d83b1150ff3316212d9a4c3;hb=HEAD;hpb=1c5674a11a51310ee689d6daf4e6b7d94dec607e diff --git a/dali-toolkit/internal/builder/builder-signals.cpp b/dali-toolkit/internal/builder/builder-signals.cpp index b3372f2..c4af9d4 100644 --- a/dali-toolkit/internal/builder/builder-signals.cpp +++ b/dali-toolkit/internal/builder/builder-signals.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,17 +16,18 @@ */ // EXTERNAL INCLUDES +#include #include #include -#include #include +#include #include #include // INTERNAL INCLUDES -#include #include +#include namespace Dali { @@ -34,11 +35,11 @@ namespace Toolkit { namespace Internal { -extern Animation CreateAnimation( const TreeNode& child, Dali::Toolkit::Internal::Builder* const builder ); -extern bool SetPropertyFromNode( const TreeNode& node, Property::Value& value ); -} -} -} +extern Animation CreateAnimation(const TreeNode& child, Dali::Toolkit::Internal::Builder* const builder); +extern void DeterminePropertyFromNode(const TreeNode& node, Property::Value& value); +} // namespace Internal +} // namespace Toolkit +} // namespace Dali namespace { @@ -51,9 +52,9 @@ using namespace Dali; // Action on child actor. The child is found by name struct ChildActorAction { - std::string actorName; - std::string actionName; - std::string childName; + std::string actorName; + std::string actionName; + std::string childName; Property::Map parameters; void operator()(void) @@ -79,8 +80,8 @@ struct ChildActorAction // Action to set a property struct PropertySetAction { - std::string actorName; - std::string propertyName; + std::string actorName; + std::string propertyName; Property::Value value; void operator()(void) @@ -91,15 +92,15 @@ struct PropertySetAction { Property::Index idx = actor.GetPropertyIndex(propertyName); - if( idx != Property::INVALID_INDEX ) + if(idx != Property::INVALID_INDEX) { - if( actor.GetPropertyType(idx) != value.GetType() ) + if(actor.GetPropertyType(idx) != value.GetType()) { DALI_SCRIPT_WARNING("Set property action has different type for property '%s'\n", propertyName.c_str()); } else { - actor.SetProperty( idx, value ); + actor.SetProperty(idx, value); } } else @@ -113,8 +114,8 @@ struct PropertySetAction // Generic action on a handle (Animation & Actor) struct GenericAction { - std::string actorName; - std::string actionName; + std::string actorName; + std::string actionName; Property::Map parameters; void operator()(void) @@ -124,7 +125,6 @@ struct GenericAction { actor.DoAction(actionName, parameters); } - }; }; @@ -141,12 +141,12 @@ struct QuitAction // Delay an animation play; ie wait as its not on stage yet struct DelayedAnimationPlay { - OptionalChild animNode; - Dali::IntrusivePtr builder; + OptionalChild animNode; + Dali::IntrusivePtr builder; void operator()(void) { - Animation anim = Toolkit::Internal::CreateAnimation(*animNode, builder.Get() ); + Animation anim = Toolkit::Internal::CreateAnimation(*animNode, builder.Get()); if(anim) { anim.Play(); @@ -157,16 +157,16 @@ struct DelayedAnimationPlay // Delay a pathConstrainer apply struct DelayedConstrainerApply { - std::string constrainerName; + std::string constrainerName; std::vector targetActorNames; std::vector sourceActorNames; std::vector targetPropertyNames; std::vector sourcePropertyNames; - std::vector ranges; - std::vector wrapRanges; + std::vector ranges; + std::vector wrapRanges; - Dali::IntrusivePtr builder; + Dali::IntrusivePtr builder; /* * Helper function to get the parameters to apply each constraint @@ -176,43 +176,43 @@ struct DelayedConstrainerApply * @param[out] sourceActor Source actor for the constraint * @param[out] sourcePropertyIndex Source property index for the constraint */ - bool GetApplyParameters( size_t i, - Actor& targetActor, Property::Index& targetPropertyIndex, - Actor& sourceActor, Property::Index& sourcePropertyIndex) + bool GetApplyParameters(size_t i, + Actor& targetActor, + Property::Index& targetPropertyIndex, + Actor& sourceActor, + Property::Index& sourcePropertyIndex) { - - targetActor = Stage::GetCurrent().GetRootLayer().FindChildByName(targetActorNames[i]); + targetActor = Stage::GetCurrent().GetRootLayer().FindChildByName(targetActorNames[i]); targetPropertyIndex = Property::INVALID_INDEX; if(targetActor) { targetPropertyIndex = targetActor.GetPropertyIndex(targetPropertyNames[i]); - if( targetPropertyIndex == Property::INVALID_INDEX ) + if(targetPropertyIndex == Property::INVALID_INDEX) { - DALI_SCRIPT_WARNING("Property '%s' not founded in actor '%s'\n", targetPropertyNames[i].c_str(), targetActorNames[i].c_str() ); + DALI_SCRIPT_WARNING("Property '%s' not founded in actor '%s'\n", targetPropertyNames[i].c_str(), targetActorNames[i].c_str()); return false; } } else { - DALI_SCRIPT_WARNING("Actor '%s' not founded\n", targetActorNames[i].c_str() ); + DALI_SCRIPT_WARNING("Actor '%s' not founded\n", targetActorNames[i].c_str()); return false; } - - sourceActor = Stage::GetCurrent().GetRootLayer().FindChildByName(sourceActorNames[i]); + sourceActor = Stage::GetCurrent().GetRootLayer().FindChildByName(sourceActorNames[i]); sourcePropertyIndex = Property::INVALID_INDEX; if(sourceActor) { sourcePropertyIndex = sourceActor.GetPropertyIndex(sourcePropertyNames[i]); - if( sourcePropertyIndex == Property::INVALID_INDEX ) + if(sourcePropertyIndex == Property::INVALID_INDEX) { - DALI_SCRIPT_WARNING("Property '%s' not founded in actor '%s'\n", sourcePropertyNames[i].c_str(), sourceActorNames[i].c_str() ); + DALI_SCRIPT_WARNING("Property '%s' not founded in actor '%s'\n", sourcePropertyNames[i].c_str(), sourceActorNames[i].c_str()); return false; } } else { - DALI_SCRIPT_WARNING("Actor '%s' not founded\n", targetActorNames[i].c_str() ); + DALI_SCRIPT_WARNING("Actor '%s' not founded\n", targetActorNames[i].c_str()); return false; } return true; @@ -220,24 +220,23 @@ struct DelayedConstrainerApply void operator()(void) { - Actor sourceActor, targetActor; + Actor sourceActor, targetActor; Property::Index targetPropertyIndex(Property::INVALID_INDEX); Property::Index sourcePropertyIndex(Property::INVALID_INDEX); - size_t actorCount( targetActorNames.size() ); - if( builder.Get()->IsPathConstrainer( constrainerName )) + size_t actorCount(targetActorNames.size()); + if(builder.Get()->IsPathConstrainer(constrainerName)) { PathConstrainer constrainer = builder.Get()->GetPathConstrainer(constrainerName); - if( constrainer ) + if(constrainer) { - for(size_t i(0); iIsLinearConstrainer( constrainerName ) ) + else if(builder.Get()->IsLinearConstrainer(constrainerName)) { - Dali::LinearConstrainer constrainer( builder.Get()->GetLinearConstrainer(constrainerName)); - if( constrainer ) + Dali::LinearConstrainer constrainer(builder.Get()->GetLinearConstrainer(constrainerName)); + if(constrainer) { - for(size_t i(0); i targetActorNames; - Dali::IntrusivePtr builder; + std::string constrainerName; + std::vector targetActorNames; + Dali::IntrusivePtr builder; void operator()(void) { - size_t actorCount( targetActorNames.size() ); - if( builder.Get()->IsPathConstrainer( constrainerName )) + size_t actorCount(targetActorNames.size()); + if(builder.Get()->IsPathConstrainer(constrainerName)) { PathConstrainer constrainer = builder.Get()->GetPathConstrainer(constrainerName); - if( constrainer ) + if(constrainer) { - for(size_t i(0); iIsLinearConstrainer( constrainerName )) + else if(builder.Get()->IsLinearConstrainer(constrainerName)) { LinearConstrainer constrainer = builder.Get()->GetLinearConstrainer(constrainerName); - if( constrainer ) + if(constrainer) { - for(size_t i(0); i( Dali::Toolkit::Internal::SetPropertyFromNode( child, ret ) ); + static_cast(Dali::Toolkit::Internal::DeterminePropertyFromNode(child, ret)); } else if(1 == nChildren) { // {"property": {"quaternion":[1,2,3,4]} } // {"property": {"angle":22, "axis": [1,2,3]} } - OptionalChild quaternion = IsChild(&child, "quaternion"); - OptionalChild axis = IsChild(&child, "axis"); - OptionalChild angle = IsChild(&child, "angle"); + OptionalChild quaternion = IsChild(&child, "quaternion"); + OptionalChild axis = IsChild(&child, "axis"); + OptionalChild angle = IsChild(&child, "angle"); if(quaternion) { @@ -381,14 +379,13 @@ Property::Value GetPropertyValue(const TreeNode &child) return ret; } - /* * Gets Parmeter list from child * params is be cleared before insertion */ void GetParameters(const TreeNode& child, Property::Map& params) { - if( OptionalChild c = IsChild(child, "parameters") ) + if(OptionalChild c = IsChild(child, "parameters")) { const TreeNode& node = *c; @@ -396,18 +393,21 @@ void GetParameters(const TreeNode& child, Property::Map& params) for(TreeNode::ConstIterator iter(node.CBegin()); iter != node.CEnd(); ++iter) { - params[ (*iter).first ] = GetPropertyValue( (*iter).second ); + params[(*iter).first] = GetPropertyValue((*iter).second); } } } // Shim for the property notifcation signal -template +template struct PropertyNotifcationSignalShim { T mFunctor; - PropertyNotifcationSignalShim(T& functor) : mFunctor(functor) {} + PropertyNotifcationSignalShim(T& functor) + : mFunctor(functor) + { + } void operator()(PropertyNotification& /* source */) { @@ -416,108 +416,115 @@ struct PropertyNotifcationSignalShim }; // Specializations for the different signal connection calls between actor & PropertyNotification -template -struct SignalConnector {}; +template +struct SignalConnector +{ +}; // Actor specialization -template <> -struct SignalConnector { - Actor& mActor; +template<> +struct SignalConnector +{ + Actor& mActor; ConnectionTracker* mTracker; const std::string& mName; SignalConnector(ConnectionTracker* tracker, Actor& actor, const std::string& name) - : mActor(actor), mTracker(tracker), mName(name) {} + : mActor(actor), + mTracker(tracker), + mName(name) + { + } - template + template void Connect(T& functor) { - mActor.ConnectSignal( mTracker, mName, functor); + mActor.ConnectSignal(mTracker, mName, functor); } }; // PropertyNotification specialization -template <> +template<> struct SignalConnector { PropertyNotification& mNotification; - ConnectionTracker* mTracker; + ConnectionTracker* mTracker; - SignalConnector(ConnectionTracker* tracker, PropertyNotification ¬ification) - : mNotification(notification), mTracker(tracker) {} + SignalConnector(ConnectionTracker* tracker, PropertyNotification& notification) + : mNotification(notification), + mTracker(tracker) + { + } - template + template void Connect(T& functor) { - mNotification.NotifySignal().Connect( mTracker, PropertyNotifcationSignalShim(functor) ); + mNotification.NotifySignal().Connect(mTracker, PropertyNotifcationSignalShim(functor)); } }; /** * Set an action functor on a signal */ -template -void SetActionOnSignal(const TreeNode &root, const TreeNode &child, Actor actor, Dali::Toolkit::Internal::Builder* const builder, SignalConnector& connector) +template +void SetActionOnSignal(const TreeNode& root, const TreeNode& child, Actor actor, Dali::Toolkit::Internal::Builder* const builder, SignalConnector& connector) { - OptionalString childActorName(IsString( IsChild(&child, "child-actor")) ); - OptionalString actorName(IsString( IsChild(&child, "actor")) ); - OptionalString propertyName(IsString( IsChild(&child, "property")) ); - OptionalChild valueChild( IsChild(&child, "value") ); + OptionalString childActorName(IsString(IsChild(&child, "childActor"))); + OptionalString actorName(IsString(IsChild(&child, "actor"))); + OptionalString propertyName(IsString(IsChild(&child, "property"))); + OptionalChild valueChild(IsChild(&child, "value")); - OptionalString actionName = IsString( IsChild(&child, "action") ); + OptionalString actionName = IsString(IsChild(&child, "action")); DALI_ASSERT_ALWAYS(actionName && "Signal must have an action"); if(childActorName) { ChildActorAction action; - action.actorName = *actorName; - action.childName = *childActorName; - action.actionName = *actionName; + action.actorName = *actorName; + action.childName = *childActorName; + action.actionName = *actionName; GetParameters(child, action.parameters); - connector.Connect( action ); + connector.Connect(action); } else if(actorName) { - if(propertyName && valueChild && ("set" == *actionName) ) + if(propertyName && valueChild && ("set" == *actionName)) { PropertySetAction action; - action.actorName = *actorName; - action.propertyName = *propertyName; + action.actorName = *actorName; + action.propertyName = *propertyName; // actor may not exist yet so we can't check the property type - if( !Dali::Toolkit::Internal::SetPropertyFromNode( *valueChild, action.value ) ) - { - DALI_SCRIPT_WARNING("Cannot set property for set property action\n"); - } - connector.Connect( action ); + Dali::Toolkit::Internal::DeterminePropertyFromNode(*valueChild, action.value); + connector.Connect(action); } else { GenericAction action; - action.actorName = *actorName; - action.actionName = *actionName; + action.actorName = *actorName; + action.actionName = *actionName; GetParameters(child, action.parameters); - connector.Connect( action ); + connector.Connect(action); } } else if("quit" == *actionName) { QuitAction action; action.builder = builder; - connector.Connect( action ); + connector.Connect(action); } else if("play" == *actionName) { - OptionalChild animations = IsChild( root, "animations" ); - OptionalString animationName = IsString( IsChild(child, "animation") ); - if( animations && animationName ) + OptionalChild animations = IsChild(root, "animations"); + OptionalString animationName = IsString(IsChild(child, "animation")); + if(animations && animationName) { - if( OptionalChild animNode = IsChild(*animations, *animationName) ) + if(OptionalChild animNode = IsChild(*animations, *animationName)) { DelayedAnimationPlay action; action.animNode = animNode; - action.builder = builder; + action.builder = builder; // @todo; put constants into the map - connector.Connect( action ); + connector.Connect(action); } else { @@ -529,32 +536,32 @@ void SetActionOnSignal(const TreeNode &root, const TreeNode &child, Actor actor, DALI_SCRIPT_WARNING("Cannot find animations section\n"); } } - else if("applyConstraint" == *actionName ) + else if("applyConstraint" == *actionName) { - OptionalString constrainerName = IsString( IsChild(child, "constrainer") ); - if( !constrainerName ) + OptionalString constrainerName = IsString(IsChild(child, "constrainer")); + if(!constrainerName) { DALI_SCRIPT_WARNING("Need to specify a constrainer\n"); } else { DelayedConstrainerApply action; - action.constrainerName = *constrainerName; - action.builder = builder; + action.constrainerName = *constrainerName; + action.builder = builder; OptionalChild propertiesNode = IsChild(child, "properties"); if(propertiesNode) { const TreeNode::ConstIterator endIter = (*propertiesNode).CEnd(); - for( TreeNode::ConstIterator iter = (*propertiesNode).CBegin(); endIter != iter; ++iter ) + for(TreeNode::ConstIterator iter = (*propertiesNode).CBegin(); endIter != iter; ++iter) { const TreeNode::KeyNodePair& pKeyChild = *iter; - OptionalString sourceActorName(IsString(IsChild(pKeyChild.second, "source"))); + OptionalString sourceActorName(IsString(IsChild(pKeyChild.second, "source"))); if(!sourceActorName) { DALI_SCRIPT_WARNING("Need to specify source actor to apply the constraint\n"); continue; } - OptionalString sourcePropertyName( IsString( IsChild(pKeyChild.second, "sourceProperty" ) ) ); + OptionalString sourcePropertyName(IsString(IsChild(pKeyChild.second, "sourceProperty"))); if(!sourcePropertyName) { DALI_SCRIPT_WARNING("Need to specify source property to apply the constraint\n"); @@ -568,7 +575,7 @@ void SetActionOnSignal(const TreeNode &root, const TreeNode &child, Actor actor, continue; } - OptionalString targetPropertyName( IsString( IsChild(pKeyChild.second, "targetProperty" ) ) ); + OptionalString targetPropertyName(IsString(IsChild(pKeyChild.second, "targetProperty"))); if(!targetPropertyName) { DALI_SCRIPT_WARNING("Need to specify target property name to apply the constraint\n"); @@ -582,7 +589,7 @@ void SetActionOnSignal(const TreeNode &root, const TreeNode &child, Actor actor, continue; } - Vector2 wrap(-std::numeric_limits::max(), std::numeric_limits::max()); + Vector2 wrap(-std::numeric_limits::max(), std::numeric_limits::max()); OptionalVector2 wrapRange(IsVector2(IsChild(pKeyChild.second, "wrap"))); if(wrapRange) { @@ -600,27 +607,26 @@ void SetActionOnSignal(const TreeNode &root, const TreeNode &child, Actor actor, } } } - else if("removeConstraints" == *actionName ) + else if("removeConstraints" == *actionName) { - OptionalString constrainerName = IsString( IsChild(child, "constrainer") ); - if( !constrainerName ) + OptionalString constrainerName = IsString(IsChild(child, "constrainer")); + if(!constrainerName) { DALI_SCRIPT_WARNING("Need to specify a constrainer\n"); } else { - DelayedConstrainerRemove action; - action.constrainerName = *constrainerName; - action.builder = builder; + action.constrainerName = *constrainerName; + action.builder = builder; OptionalChild propertiesNode = IsChild(child, "properties"); if(propertiesNode) { const TreeNode::ConstIterator endIter = (*propertiesNode).CEnd(); - for( TreeNode::ConstIterator iter = (*propertiesNode).CBegin(); endIter != iter; ++iter ) + for(TreeNode::ConstIterator iter = (*propertiesNode).CBegin(); endIter != iter; ++iter) { const TreeNode::KeyNodePair& pKeyChild = *iter; - OptionalString targetActorName(IsString(IsChild(pKeyChild.second, "target"))); + OptionalString targetActorName(IsString(IsChild(pKeyChild.second, "target"))); if(targetActorName) { action.targetActorNames.push_back(*targetActorName); @@ -639,28 +645,27 @@ void SetActionOnSignal(const TreeNode &root, const TreeNode &child, Actor actor, { // no named actor; presume self GenericAction action; - action.actorName = actor.GetName(); - action.actionName = *actionName; + action.actorName = actor.GetProperty(Dali::Actor::Property::NAME); + action.actionName = *actionName; GetParameters(child, action.parameters); - connector.Connect( action ); + connector.Connect(action); } } - /** * Get a notification condition argument0 as 'arg0' 'value' or 'min' */ -float GetConditionArg0(const TreeNode &child) +float GetConditionArg0(const TreeNode& child) { - OptionalFloat f = IsFloat( IsChild(child, "arg0") ); + OptionalFloat f = IsFloat(IsChild(child, "arg0")); // allowing some human preferable alternatives if(!f) { - f = IsFloat( IsChild(child, "value") ); + f = IsFloat(IsChild(child, "value")); } if(!f) { - f = IsFloat( IsChild(child, "min") ); + f = IsFloat(IsChild(child, "min")); } DALI_ASSERT_ALWAYS(f && "Notification condition for arg0 not specified"); @@ -671,13 +676,13 @@ float GetConditionArg0(const TreeNode &child) /** * Get a notification condition argument1 as 'arg1' or 'max' */ -float GetConditionArg1(const TreeNode &child) +float GetConditionArg1(const TreeNode& child) { - OptionalFloat f = IsFloat( IsChild(child, "arg1") ); + OptionalFloat f = IsFloat(IsChild(child, "arg1")); // allowing some human preferable alternatives if(!f) { - f = IsFloat( IsChild(child, "max") ); + f = IsFloat(IsChild(child, "max")); } DALI_ASSERT_ALWAYS(f && "Notification condition for arg1 not specified"); @@ -685,9 +690,7 @@ float GetConditionArg1(const TreeNode &child) return *f; } - - -}; // anon namespace +}; // namespace namespace Dali { @@ -695,28 +698,27 @@ namespace Toolkit { namespace Internal { - -Actor SetupSignalAction(const TreeNode &child, Actor actor, Dali::Toolkit::Internal::Builder* const builder ); -Actor SetupPropertyNotification(const TreeNode &child, Actor actor, Dali::Toolkit::Internal::Builder* const builder ); +Actor SetupSignalAction(const TreeNode& child, Actor actor, Dali::Toolkit::Internal::Builder* const builder); +Actor SetupPropertyNotification(const TreeNode& child, Actor actor, Dali::Toolkit::Internal::Builder* const builder); /** * Setup signals and actions on an actor */ -Actor SetupSignalAction(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor, Dali::Toolkit::Internal::Builder* const builder ) +Actor SetupSignalAction(ConnectionTracker* tracker, const TreeNode& root, const TreeNode& child, Actor actor, Dali::Toolkit::Internal::Builder* const builder) { DALI_ASSERT_ALWAYS(actor); if(OptionalChild signalsChild = IsChild(child, "signals")) { - const TreeNode& signalsNode = *signalsChild; - const TreeConstIter endIter = signalsNode.CEnd(); - for( TreeConstIter iter = signalsNode.CBegin(); endIter != iter; ++iter ) + const TreeNode& signalsNode = *signalsChild; + const TreeConstIter endIter = signalsNode.CEnd(); + for(TreeConstIter iter = signalsNode.CBegin(); endIter != iter; ++iter) { const TreeNode::KeyNodePair& key_child = *iter; - DALI_SCRIPT_INFO(" Creating Signal for: %s\n", actor.GetName().c_str()); + DALI_SCRIPT_INFO(" Creating Signal for: %s\n", actor.GetProperty(Dali::Actor::Property::NAME).c_str()); - OptionalString name( IsString( IsChild( key_child.second, "name")) ); + OptionalString name(IsString(IsChild(key_child.second, "name"))); DALI_ASSERT_ALWAYS(name && "Signal must have a name"); SignalConnector connector(tracker, actor, *name); @@ -730,61 +732,66 @@ Actor SetupSignalAction(ConnectionTracker* tracker, const TreeNode &root, const /** * Setup Property notifications for an actor */ -Actor SetupPropertyNotification(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor, Dali::Toolkit::Internal::Builder* const builder ) +Actor SetupPropertyNotification(ConnectionTracker* tracker, const TreeNode& root, const TreeNode& child, Actor actor, Dali::Toolkit::Internal::Builder* const builder) { DALI_ASSERT_ALWAYS(actor); - if(OptionalChild notificationsChild = IsChild(child,"notifications")) + if(OptionalChild notificationsChild = IsChild(child, "notifications")) { - const TreeNode& notificationsNode = *notificationsChild; - const TreeNode::ConstIterator endIter = notificationsNode.CEnd(); - for( TreeNode::ConstIterator iter = notificationsNode.CBegin(); endIter != iter; ++iter ) + const TreeNode& notificationsNode = *notificationsChild; + const TreeNode::ConstIterator endIter = notificationsNode.CEnd(); + for(TreeNode::ConstIterator iter = notificationsNode.CBegin(); endIter != iter; ++iter) { const TreeNode::KeyNodePair& key_child = *iter; - OptionalString prop(IsString( IsChild(key_child.second, "property")) ); + OptionalString prop(IsString(IsChild(key_child.second, "property"))); DALI_ASSERT_ALWAYS(prop && "Notification signal must specify a property"); Property::Index prop_index = actor.GetPropertyIndex(*prop); DALI_ASSERT_ALWAYS(prop_index != Property::INVALID_INDEX && "Notification signal specifies an unknown property"); - OptionalString cond(IsString( IsChild(key_child.second, "condition"))); + OptionalString cond(IsString(IsChild(key_child.second, "condition"))); DALI_ASSERT_ALWAYS(cond && "Notification signal must specify a condition"); if("False" == *cond) { - PropertyNotification notification = actor.AddPropertyNotification( actor.GetPropertyIndex(*prop), - LessThanCondition(1.f) ); + PropertyNotification notification = actor.AddPropertyNotification(actor.GetPropertyIndex(*prop), + LessThanCondition(1.f)); + SignalConnector connector(tracker, notification); SetActionOnSignal(root, key_child.second, actor, builder, connector); } else if("LessThan" == *cond) { - PropertyNotification notification = actor.AddPropertyNotification( actor.GetPropertyIndex(*prop), - LessThanCondition(GetConditionArg0(key_child.second)) ); + PropertyNotification notification = actor.AddPropertyNotification(actor.GetPropertyIndex(*prop), + LessThanCondition(GetConditionArg0(key_child.second))); + SignalConnector connector(tracker, notification); SetActionOnSignal(root, key_child.second, actor, builder, connector); } else if("GreaterThan" == *cond) { - PropertyNotification notification = actor.AddPropertyNotification( actor.GetPropertyIndex(*prop), - GreaterThanCondition(GetConditionArg0(key_child.second)) ); + PropertyNotification notification = actor.AddPropertyNotification(actor.GetPropertyIndex(*prop), + GreaterThanCondition(GetConditionArg0(key_child.second))); + SignalConnector connector(tracker, notification); SetActionOnSignal(root, key_child.second, actor, builder, connector); } else if("Inside" == *cond) { - PropertyNotification notification = actor.AddPropertyNotification( actor.GetPropertyIndex(*prop), - InsideCondition(GetConditionArg0(key_child.second), - GetConditionArg1(key_child.second)) ); + PropertyNotification notification = actor.AddPropertyNotification(actor.GetPropertyIndex(*prop), + InsideCondition(GetConditionArg0(key_child.second), + GetConditionArg1(key_child.second))); + SignalConnector connector(tracker, notification); SetActionOnSignal(root, key_child.second, actor, builder, connector); } else if("Outside" == *cond) { - PropertyNotification notification = actor.AddPropertyNotification( actor.GetPropertyIndex(*prop), - OutsideCondition(GetConditionArg0(key_child.second), - GetConditionArg1(key_child.second)) ); + PropertyNotification notification = actor.AddPropertyNotification(actor.GetPropertyIndex(*prop), + OutsideCondition(GetConditionArg0(key_child.second), + GetConditionArg1(key_child.second))); + SignalConnector connector(tracker, notification); SetActionOnSignal(root, key_child.second, actor, builder, connector); } @@ -799,7 +806,6 @@ Actor SetupPropertyNotification(ConnectionTracker* tracker, const TreeNode &root } // AddPropertyNotification - } // namespace Internal } // namespace Toolkit } // namespace Dali