// EXTERNAL INCLUDES
#include <sys/stat.h>
-#include <boost/function.hpp>
#include <sstream>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/public-api/object/type-info.h>
#include <dali/public-api/actors/image-actor.h>
#include <dali/public-api/actors/camera-actor.h>
#include <dali/devel-api/scripting/scripting.h>
+#include <dali/public-api/signals/functor-delegate.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control.h>
-#include <dali-toolkit/public-api/builder/json-parser.h>
+#include <dali-toolkit/devel-api/builder/json-parser.h>
#include <dali-toolkit/internal/builder/builder-get-is.inl.h>
#include <dali-toolkit/internal/builder/builder-filesystem.h>
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, 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 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)
namespace
{
+#define TOKEN_STRING(x) #x
+
const std::string KEYNAME_STYLES = "styles";
const std::string KEYNAME_TYPE = "type";
const std::string KEYNAME_ACTORS = "actors";
ret = ToString( value.Get<int>() );
break;
}
- case Property::UNSIGNED_INTEGER:
- {
- ret = ToString( value.Get<unsigned int>() );
- break;
- }
case Property::VECTOR2:
{
ret = ToString( value.Get<Vector2>() );
ret = std::string("Map Size=") + ToString( value.Get<Property::Map>().Count() );
break;
}
- case Property::TYPE_COUNT:
- {
- ret = "";
- break;
- }
}
return ret;
}
}
-struct QuitAction
-{
-public:
- QuitAction( Builder& builder )
- : mBuilder( builder )
- {
- }
-
- void operator()(void)
- {
- mBuilder.EmitQuitSignal();
- }
-
-private:
- Builder& mBuilder;
-};
} // namespace anon
if( !SetPropertyFromNode( keyChild.second, type, value, constant ) )
{
// verbose as this might not be a problem
- // eg parent-origin can be a string which is picked up later
+ // eg parentOrigin can be a string which is picked up later
DALI_SCRIPT_VERBOSE("Could not convert property:%s\n", key.c_str());
}
else
SetupActor( node, actor, constant );
// add signals
- QuitAction quitAction( *this );
- SetupSignalAction( mSlotDelegate.GetConnectionTracker(), root, node, actor, quitAction, this );
- SetupPropertyNotification( mSlotDelegate.GetConnectionTracker(), root, node, actor, quitAction, this );
+ SetupSignalAction( mSlotDelegate.GetConnectionTracker(), root, node, actor, this );
+ SetupPropertyNotification( mSlotDelegate.GetConnectionTracker(), root, node, actor, this );
}
}
else
const Stage& stage = Stage::GetCurrent();
Layer root = stage.GetRootLayer();
- if( OptionalString s = constant.IsString( IsChild(node, "source-actor") ) )
+ if( OptionalString s = constant.IsString( IsChild(node, "sourceActor") ) )
{
Actor actor = root.FindChildByName(*s);
if(actor)
}
}
- if( OptionalString s = constant.IsString( IsChild(node, "camera-actor") ) )
+ if( OptionalString s = constant.IsString( IsChild(node, "cameraActor") ) )
{
CameraActor actor = CameraActor::DownCast( root.FindChildByName(*s) );
if(actor)
}
}
- if( OptionalString s = constant.IsString( IsChild(node, "target-frame-buffer") ) )
+ if( OptionalString s = constant.IsString( IsChild(node, "targetFrameBuffer") ) )
{
FrameBufferImage fb = GetFrameBufferImage( *s, constant );
if(fb)
}
}
- if( OptionalString s = constant.IsString( IsChild(node, "screen-to-frame-buffer-function") ) )
+ if( OptionalString s = constant.IsString( IsChild(node, "screenToFrameBufferFunction") ) )
{
if("DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION" == *s)
{
}
// other setup is via the property system
- SetProperties( node, task, constant ); // @ todo, remove 'source-actor', 'camera-actor'?
-
+ SetProperties( node, task, constant );
}
void Builder::CreateRenderTask( const std::string &name )
const Stage& stage = Stage::GetCurrent();
- OptionalChild tasks = IsChild(*mParser.GetRoot(), "render-tasks");
+ OptionalChild tasks = IsChild(*mParser.GetRoot(), "renderTasks");
if(tasks)
{
}
else
{
- if( OptionalChild effects = IsChild( *mParser.GetRoot(), "shader-effects") )
+ if( OptionalChild effects = IsChild( *mParser.GetRoot(), "shaderEffects") )
{
if( OptionalChild effect = IsChild( *effects, name ) )
{
}
else
{
- if( OptionalChild images = IsChild( *mParser.GetRoot(), "frame-buffer-images") )
+ if( OptionalChild images = IsChild( *mParser.GetRoot(), "frameBufferImages") )
{
if( OptionalChild image = IsChild( *images, name ) )
{
- Dali::Property::Value propertyMap(Property::MAP);
- if( SetPropertyFromNode( *image, Property::MAP, propertyMap, constant ) )
+ Dali::Property::Value property(Property::MAP);
+ if( SetPropertyFromNode( *image, Property::MAP, property, constant ) )
{
- propertyMap.SetValue(KEYNAME_TYPE, Property::Value(std::string("FrameBufferImage")));
- ret = FrameBufferImage::DownCast( Dali::Scripting::NewImage( propertyMap ) );
- mFrameBufferImageLut[ name ] = ret;
+ Property::Map* map = property.GetMap();
+
+ if( map )
+ {
+ (*map)[ KEYNAME_TYPE ] = Property::Value(std::string("FrameBufferImage") );
+ ret = FrameBufferImage::DownCast( Dali::Scripting::NewImage( property ) );
+ mFrameBufferImageLut[ name ] = ret;
+ }
}
}
}
ret = Path::New();
ret.SetProperty( Path::Property::POINTS, points);
- //control-points property
- if( OptionalChild pointsProperty = IsChild( *path, "control-points") )
+ //controlPoints property
+ if( OptionalChild pointsProperty = IsChild( *path, "controlPoints") )
{
Dali::Property::Value points(Property::ARRAY);
if( SetPropertyFromNode( *pointsProperty, Property::ARRAY, points ) )
ret = PathConstrainer::New();
ret.SetProperty( PathConstrainer::Property::POINTS, points);
- //control-points property
- if( OptionalChild pointsProperty = IsChild( *pathConstrainer, "control-points") )
+ //controlPoints property
+ if( OptionalChild pointsProperty = IsChild( *pathConstrainer, "controlPoints") )
{
Dali::Property::Value points(Property::ARRAY);
if( SetPropertyFromNode( *pointsProperty, Property::ARRAY, points ) )
ret = Dali::LinearConstrainer::New();
ret.SetProperty( LinearConstrainer::Property::VALUE, points);
- //control-points property
+ //controlPoints property
if( OptionalChild pointsProperty = IsChild( *linearConstrainer, "progress") )
{
Dali::Property::Value points(Property::ARRAY);
// to add automatically
if( "stage" == sectionName )
{
- if( OptionalChild renderTasks = IsChild(*mParser.GetRoot(), "render-tasks") )
+ if( OptionalChild renderTasks = IsChild(*mParser.GetRoot(), "renderTasks") )
{
if( OptionalChild tasks = IsChild(*renderTasks, "stage") )
{
: mSlotDelegate( this )
{
mParser = Dali::Toolkit::JsonParser::New();
+
+ Property::Map defaultDirs;
+ defaultDirs[ TOKEN_STRING(DALI_IMAGE_DIR) ] = DALI_IMAGE_DIR;
+ defaultDirs[ TOKEN_STRING(DALI_SOUND_DIR) ] = DALI_SOUND_DIR;
+ defaultDirs[ TOKEN_STRING(DALI_STYLE_DIR) ] = DALI_STYLE_DIR;
+ defaultDirs[ TOKEN_STRING(DALI_STYLE_IMAGE_DIR) ] = DALI_STYLE_IMAGE_DIR;
+
+ AddConstants( defaultDirs );
}
Builder::~Builder()