2016-10-11 19:31:17 -07:00
|
|
|
#define EFL_CANVAS_GROUP_PROTECTED
|
2018-05-03 16:34:17 -07:00
|
|
|
#define EFL_PART_PROTECTED
|
2016-10-11 19:31:17 -07:00
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
#include "edje_private.h"
|
|
|
|
|
2019-03-05 08:15:40 -08:00
|
|
|
#include "canvas/evas_canvas_eo.h"
|
2018-08-16 10:01:26 -07:00
|
|
|
|
2012-10-22 02:36:23 -07:00
|
|
|
#ifdef MY_CLASS
|
|
|
|
# undef MY_CLASS
|
|
|
|
#endif
|
|
|
|
|
2017-12-05 19:15:39 -08:00
|
|
|
#define MY_CLASS EFL_CANVAS_LAYOUT_CLASS
|
2003-06-23 19:33:04 -07:00
|
|
|
|
2015-06-08 11:43:00 -07:00
|
|
|
#define MY_CLASS_NAME "Edje"
|
2013-11-07 03:16:01 -08:00
|
|
|
#define MY_CLASS_NAME_LEGACY "edje"
|
2013-01-28 22:36:23 -08:00
|
|
|
|
2016-08-13 20:25:59 -07:00
|
|
|
Eina_Inlist *_edje_edjes = NULL;
|
2003-07-15 22:15:15 -07:00
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/************************** API Routines **************************/
|
|
|
|
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI Evas_Object *
|
2003-07-08 03:08:15 -07:00
|
|
|
edje_object_add(Evas *evas)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2018-08-29 05:11:00 -07:00
|
|
|
evas = evas_find(evas);
|
2018-08-16 10:01:26 -07:00
|
|
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(evas, EVAS_CANVAS_CLASS), NULL);
|
2018-08-29 05:11:00 -07:00
|
|
|
return efl_add(MY_CLASS, evas, efl_canvas_object_legacy_ctor(efl_added));
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
|
2015-05-19 03:41:27 -07:00
|
|
|
EOLIAN static Eo *
|
2017-12-05 19:15:39 -08:00
|
|
|
_efl_canvas_layout_efl_object_constructor(Eo *obj, Edje *ed)
|
2010-04-08 12:21:54 -07:00
|
|
|
{
|
2016-02-04 21:02:29 -08:00
|
|
|
Eo *parent;
|
|
|
|
Evas *e;
|
|
|
|
void *tmp;
|
|
|
|
|
2017-09-05 20:13:58 -07:00
|
|
|
efl_canvas_group_clipped_set(obj, EINA_TRUE);
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
2017-10-31 00:36:32 -07:00
|
|
|
ed->base.evas = evas_object_evas_get(obj);
|
2017-09-05 23:14:07 -07:00
|
|
|
ed->base.clipper = (Evas_Object *) efl_canvas_group_clipper_get(obj);
|
2017-08-31 22:50:29 -07:00
|
|
|
ed->duration_scale = 1.0;
|
2012-10-21 03:46:58 -07:00
|
|
|
_edje_lib_ref();
|
2015-05-19 03:41:27 -07:00
|
|
|
|
2016-08-10 07:23:04 -07:00
|
|
|
parent = efl_parent_get(obj);
|
2016-02-04 21:02:29 -08:00
|
|
|
e = evas_object_evas_get(parent);
|
|
|
|
tmp = ecore_evas_ecore_evas_get(e);
|
|
|
|
|
|
|
|
ed->canvas_animator = !!tmp;
|
|
|
|
|
2015-05-19 03:41:27 -07:00
|
|
|
return obj;
|
2010-04-08 12:21:54 -07:00
|
|
|
}
|
|
|
|
|
2018-05-28 21:38:40 -07:00
|
|
|
|
2018-03-20 10:18:50 -07:00
|
|
|
EOLIAN static void
|
2018-05-09 12:28:26 -07:00
|
|
|
_efl_canvas_layout_efl_object_invalidate(Eo *obj, Edje *ed)
|
2018-03-20 10:18:50 -07:00
|
|
|
{
|
|
|
|
_edje_file_callbacks_del(ed, NULL);
|
2018-05-09 12:28:26 -07:00
|
|
|
|
2018-07-10 04:31:32 -07:00
|
|
|
efl_invalidate(efl_super(obj, MY_CLASS));
|
|
|
|
|
|
|
|
//invalidate is done, this means the legacy evas deletion event is called.
|
2018-05-28 21:38:40 -07:00
|
|
|
for (int i = 0; i < ed->table_parts_size; ++i)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp = ed->table_parts[i];
|
|
|
|
switch(rp->type)
|
|
|
|
{
|
|
|
|
case EDJE_RP_TYPE_SWALLOW:
|
|
|
|
_edje_real_part_swallow_clear(ed, rp);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EDJE_RP_TYPE_CONTAINER:
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_BOX)
|
|
|
|
_edje_real_part_box_remove_all(ed, rp, 0);
|
|
|
|
else if (rp->part->type == EDJE_PART_TYPE_TABLE)
|
|
|
|
_edje_real_part_table_clear(ed, rp, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2018-03-20 10:18:50 -07:00
|
|
|
}
|
|
|
|
|
2017-10-12 18:54:54 -07:00
|
|
|
EOLIAN static void
|
2017-12-05 19:15:39 -08:00
|
|
|
_efl_canvas_layout_efl_object_debug_name_override(Eo *obj, Edje *ed, Eina_Strbuf *sb)
|
2017-07-14 00:55:10 -07:00
|
|
|
{
|
2017-10-12 18:54:54 -07:00
|
|
|
efl_debug_name_override(efl_super(obj, MY_CLASS), sb);
|
2017-07-20 23:24:08 -07:00
|
|
|
eina_strbuf_append_printf(sb, ":file='%s':group='%s'",
|
|
|
|
ed->file ? eina_file_filename_get(ed->file->f) : NULL,
|
|
|
|
ed->group);
|
2013-05-02 00:47:16 -07:00
|
|
|
}
|
|
|
|
|
2014-03-18 07:00:14 -07:00
|
|
|
EOLIAN static void
|
2017-12-05 19:15:39 -08:00
|
|
|
_efl_canvas_layout_efl_object_dbg_info_get(Eo *eo_obj, Edje *_pd EINA_UNUSED, Efl_Dbg_Info *root) EINA_ARG_NONNULL(3)
|
2013-01-28 22:36:23 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_dbg_info_get(efl_super(eo_obj, MY_CLASS), root);
|
|
|
|
Efl_Dbg_Info *group = EFL_DBG_INFO_LIST_APPEND(root, MY_CLASS_NAME);
|
2017-05-25 18:29:05 -07:00
|
|
|
Edje_Load_Error error;
|
2013-01-28 22:36:23 -08:00
|
|
|
|
|
|
|
const char *file, *edje_group;
|
2019-02-27 10:17:09 -08:00
|
|
|
efl_file_simple_get(eo_obj, &file, &edje_group);
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_DBG_INFO_APPEND(group, "File", EINA_VALUE_TYPE_STRING, file);
|
|
|
|
EFL_DBG_INFO_APPEND(group, "Group", EINA_VALUE_TYPE_STRING, edje_group);
|
2013-01-28 22:36:23 -08:00
|
|
|
|
2017-05-25 18:29:05 -07:00
|
|
|
error = edje_object_load_error_get(eo_obj);
|
2013-01-28 22:36:23 -08:00
|
|
|
if (error != EDJE_LOAD_ERROR_NONE)
|
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
EFL_DBG_INFO_APPEND(group, "Error", EINA_VALUE_TYPE_STRING,
|
2015-06-08 11:43:00 -07:00
|
|
|
edje_load_error_str(error));
|
2013-01-28 22:36:23 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-09 01:27:04 -07:00
|
|
|
static void
|
|
|
|
_edje_color_class_free(void *data)
|
|
|
|
{
|
|
|
|
Edje_Color_Class *cc = data;
|
|
|
|
|
|
|
|
if (cc->name) eina_stringshare_del(cc->name);
|
|
|
|
free(cc);
|
|
|
|
}
|
|
|
|
|
2015-12-23 22:55:17 -08:00
|
|
|
static void
|
|
|
|
_edje_text_class_free(void *data)
|
|
|
|
{
|
|
|
|
Edje_Text_Class *tc = data;
|
|
|
|
|
|
|
|
if (tc->name) eina_stringshare_del(tc->name);
|
|
|
|
if (tc->font) eina_stringshare_del(tc->font);
|
|
|
|
free(tc);
|
|
|
|
}
|
|
|
|
|
2015-12-07 19:15:48 -08:00
|
|
|
static void
|
|
|
|
_edje_size_class_free(void *data)
|
|
|
|
{
|
|
|
|
Edje_Size_Class *sc = data;
|
|
|
|
|
|
|
|
if (sc->name) eina_stringshare_del(sc->name);
|
|
|
|
free(sc);
|
|
|
|
}
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
/* Private Routines */
|
2014-03-18 07:00:14 -07:00
|
|
|
EOLIAN static void
|
2017-12-05 19:15:39 -08:00
|
|
|
_efl_canvas_layout_efl_canvas_group_group_add(Eo *obj, Edje *ed)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2011-05-27 03:32:53 -07:00
|
|
|
Evas *tev = evas_object_evas_get(obj);
|
2003-06-23 19:33:04 -07:00
|
|
|
|
2011-05-27 03:32:53 -07:00
|
|
|
evas_event_freeze(tev);
|
2010-04-08 12:21:54 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
2014-11-24 01:08:17 -08:00
|
|
|
|
2011-02-01 05:26:49 -08:00
|
|
|
ed->is_rtl = EINA_FALSE;
|
2012-09-04 22:38:01 -07:00
|
|
|
ed->have_objects = EINA_TRUE;
|
2010-04-08 12:21:54 -07:00
|
|
|
ed->references = 1;
|
2012-05-18 07:37:21 -07:00
|
|
|
ed->user_defined = NULL;
|
2012-08-09 01:27:04 -07:00
|
|
|
ed->color_classes = eina_hash_string_small_new(_edje_color_class_free);
|
2015-12-23 22:55:17 -08:00
|
|
|
ed->text_classes = eina_hash_string_small_new(_edje_text_class_free);
|
2015-12-07 19:15:48 -08:00
|
|
|
ed->size_classes = eina_hash_string_small_new(_edje_size_class_free);
|
2010-04-08 12:21:54 -07:00
|
|
|
|
2007-10-04 21:53:17 -07:00
|
|
|
evas_object_geometry_get(obj, &(ed->x), &(ed->y), &(ed->w), &(ed->h));
|
2003-06-23 19:33:04 -07:00
|
|
|
ed->obj = obj;
|
2016-08-13 20:25:59 -07:00
|
|
|
_edje_edjes = eina_inlist_append(_edje_edjes, EINA_INLIST_GET(ed));
|
2011-05-27 03:32:53 -07:00
|
|
|
evas_event_thaw(tev);
|
|
|
|
evas_event_thaw_eval(tev);
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
|
2014-03-18 07:00:14 -07:00
|
|
|
EOLIAN static void
|
2017-12-05 19:15:39 -08:00
|
|
|
_efl_canvas_layout_efl_canvas_group_group_del(Eo *obj, Edje *ed)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2003-08-25 17:16:49 -07:00
|
|
|
_edje_block_violate(ed);
|
|
|
|
ed->delete_me = 1;
|
2016-08-13 20:25:59 -07:00
|
|
|
_edje_edjes = eina_inlist_remove(_edje_edjes, EINA_INLIST_GET(ed));
|
From: "Hanspeter Portner" <ventosus@airpost.net>
This concerns Ticket #109: Add Lua support for Edje
It adds Lua as scripting facility to Edje, letting Embryo untouched.
It should be easier to use and be more flexible than Embryo, imho ;-)
---
The patch
---
Lua 5.1 is used in sandboxed mode. Lua byte code is not
platform/architecture independent, Lua code is saved as text in the Edje
container and parsed at load time, therefore.
The patch goes in two directions
1) Analogous to Embryo for scripting logic, messaging and custom states.
The same things are implemented as in Embryo:
- messaging from and to C
- manual creation of timers, animators, pollers for custom events /
animations
- manual manipulation of Edje parts by means of the public
edje_object_part_* and internal functions and custom states
-> those routines are actually implemented as Lua
bindings to
functions in Edje.h and Ecore.h
-> the implementation is done in an object oriented way, so that the
interface gives the feel of an object description language, pretty
similar to EDC itself
-> combining custom states and custom animators allows
for fancy
animations and transitions, e.g circular/spline translations or
complex/conditional transitions, etc.
-> this is just the same as Embryo does, but implemented in Lua, so
nothing new here, actually
2) Dynamic object creation and manipulation
- this interface stems from the 'script_only' objects in
Edje. Those
objects are a kind of scriptable Edje counterparts to Evas_Smart
objects. The infrastructure for Embryo is already there, but has
never been used
- I added this in Lua and added some first bindings to
experiment
with
- I thought it would be useful to allow for a limited dynamic
creation of ui parts
- We can create instances of groups from within the same Edje
container and use them just like the main Edje object as
stated in
1)
- And there are some stand-alone bindings to dynamically create
Evas_Image, Evas_Table, Evas_Line, Evas_Polygon as examples
-> this may be useful to decouple the program from the ui
even more,
to be able to do things that have to be done in the program itself
atm, but actually belong to the user interface, but need dynamic
creation of objects or complex interactions
-> those objects are manipulated manually with Lua bindings
to the
corresponding edje_object_* and evas_object_* functions
---
Discussion points
---
Both stuff in 1) & 2) is functioning, but needs testing, feedback,
improvements, ...
Stuff in 1) can already fully replace Embryo scripting with Lua
scripting. There still is space for improvements/additions, though.
Of the stuff in 2), I think it may only make sense to add the dynamic
creation of groups defined in the same Edje container. Dynamic creation
of other Evas_Objects makes not much sense, as most of them can already
be used as Edje parts and be manipulated with custom states (apart from
polygons and lines) and it would make the whole theming potentially more
programing-like and much more susceptible for errors, etc.
Would this be useful, or drop it all?
The scripting should be there just for logic, conditionals, custom
states and animations, not for a whole dynamic canvas, imho.
There is a patch around with EXTERNAL Edje parts. Seems to be a better,
faster, more secure way to extend Edje with custom objects.
There would be the possibility of precompiling Lua code at compile time
(edje_cc) for faster loading, but we would have to patch and run our own
Lua version.
The Lua parser is pretty fast, though, and using
byte-converted/endianness-swapped byte-code does only pay off for Lua
chunks of some kilo lines.
Byte code also occupies much more space than text in the final Edje
container, as it includes debug symbols.
---
Cedric and Vincent told me, that the plan was to replace Embryo totally
by Lua before the official release of Edje at the end of the year? So it
would make sense to bring Lua to svn soon and look how it fits in, test,
debug, adapt it further to the themers needs, decide on its final shape,
GATHER SOME PEOPLE TO HELP ;-)
---
The Lua enhanced Edje is in sync with svn and can be get directly here
git clone git://repo.or.cz/edje_lua.git
cd edje_lua
git checkout -b lua_patch origin/lua_patch
or apply the attached patch
There are also some examples to show the usage of the things
mentioned
above
- showcase.edj: shows usage of custom animators, custom states,
messaging and the script_only object
- test.edj: test cases of script usage and bindings (custom states,
custom transitions, tween_states, animators, timers,
object_parts),
but most of it are experimental script_only objects
http://didgmo.sourceforge.net/showcase.edj
http://didgmo.sourceforge.net/test.edj
The source of showcase.edc is attached, too, to just have a glimpse at
Lua inside of EDC
---
So, what do you guys think?
Thanks and sry for the looong mail, hehe ;-)
SVN revision: 41802
2009-08-15 19:34:02 -07:00
|
|
|
if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed);
|
2012-11-28 14:38:47 -08:00
|
|
|
#ifdef HAVE_EPHYSICS
|
|
|
|
/* clear physics world / shutdown ephysics */
|
2016-08-01 03:04:42 -07:00
|
|
|
if ((ed->collection) && (ed->collection->physics_enabled) && (ed->world))
|
2012-11-28 14:38:47 -08:00
|
|
|
{
|
2016-08-01 03:04:42 -07:00
|
|
|
if (EPH_LOAD())
|
|
|
|
{
|
|
|
|
EPH_CALL(ephysics_world_del)(ed->world);
|
|
|
|
EPH_CALL(ephysics_shutdown)();
|
|
|
|
}
|
2012-11-28 14:38:47 -08:00
|
|
|
}
|
|
|
|
#endif
|
2010-02-18 22:28:03 -08:00
|
|
|
if (ed->persp) edje_object_perspective_set(obj, NULL);
|
2007-01-22 04:44:57 -08:00
|
|
|
_edje_file_del(ed);
|
2007-02-21 13:30:29 -08:00
|
|
|
_edje_unref(ed);
|
2011-08-02 00:23:05 -07:00
|
|
|
_edje_lib_unref();
|
2017-02-15 03:07:11 -08:00
|
|
|
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
|
2014-03-18 07:00:14 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_efl_canvas_layout_efl_gfx_entity_position_set(Eo *obj, Edje *ed, Eina_Position2D pos)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2016-07-03 22:59:59 -07:00
|
|
|
unsigned short i;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2017-09-14 20:14:32 -07:00
|
|
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y))
|
2016-10-10 20:39:05 -07:00
|
|
|
return;
|
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos);
|
2016-10-10 20:39:05 -07:00
|
|
|
|
2017-09-14 20:14:32 -07:00
|
|
|
if ((ed->x == pos.x) && (ed->y == pos.y)) return;
|
|
|
|
ed->x = pos.x;
|
|
|
|
ed->y = pos.y;
|
2003-07-23 17:49:13 -07:00
|
|
|
// evas_object_move(ed->clipper, ed->x, ed->y);
|
2007-09-08 11:31:56 -07:00
|
|
|
|
From: "Hanspeter Portner" <ventosus@airpost.net>
This concerns Ticket #109: Add Lua support for Edje
It adds Lua as scripting facility to Edje, letting Embryo untouched.
It should be easier to use and be more flexible than Embryo, imho ;-)
---
The patch
---
Lua 5.1 is used in sandboxed mode. Lua byte code is not
platform/architecture independent, Lua code is saved as text in the Edje
container and parsed at load time, therefore.
The patch goes in two directions
1) Analogous to Embryo for scripting logic, messaging and custom states.
The same things are implemented as in Embryo:
- messaging from and to C
- manual creation of timers, animators, pollers for custom events /
animations
- manual manipulation of Edje parts by means of the public
edje_object_part_* and internal functions and custom states
-> those routines are actually implemented as Lua
bindings to
functions in Edje.h and Ecore.h
-> the implementation is done in an object oriented way, so that the
interface gives the feel of an object description language, pretty
similar to EDC itself
-> combining custom states and custom animators allows
for fancy
animations and transitions, e.g circular/spline translations or
complex/conditional transitions, etc.
-> this is just the same as Embryo does, but implemented in Lua, so
nothing new here, actually
2) Dynamic object creation and manipulation
- this interface stems from the 'script_only' objects in
Edje. Those
objects are a kind of scriptable Edje counterparts to Evas_Smart
objects. The infrastructure for Embryo is already there, but has
never been used
- I added this in Lua and added some first bindings to
experiment
with
- I thought it would be useful to allow for a limited dynamic
creation of ui parts
- We can create instances of groups from within the same Edje
container and use them just like the main Edje object as
stated in
1)
- And there are some stand-alone bindings to dynamically create
Evas_Image, Evas_Table, Evas_Line, Evas_Polygon as examples
-> this may be useful to decouple the program from the ui
even more,
to be able to do things that have to be done in the program itself
atm, but actually belong to the user interface, but need dynamic
creation of objects or complex interactions
-> those objects are manipulated manually with Lua bindings
to the
corresponding edje_object_* and evas_object_* functions
---
Discussion points
---
Both stuff in 1) & 2) is functioning, but needs testing, feedback,
improvements, ...
Stuff in 1) can already fully replace Embryo scripting with Lua
scripting. There still is space for improvements/additions, though.
Of the stuff in 2), I think it may only make sense to add the dynamic
creation of groups defined in the same Edje container. Dynamic creation
of other Evas_Objects makes not much sense, as most of them can already
be used as Edje parts and be manipulated with custom states (apart from
polygons and lines) and it would make the whole theming potentially more
programing-like and much more susceptible for errors, etc.
Would this be useful, or drop it all?
The scripting should be there just for logic, conditionals, custom
states and animations, not for a whole dynamic canvas, imho.
There is a patch around with EXTERNAL Edje parts. Seems to be a better,
faster, more secure way to extend Edje with custom objects.
There would be the possibility of precompiling Lua code at compile time
(edje_cc) for faster loading, but we would have to patch and run our own
Lua version.
The Lua parser is pretty fast, though, and using
byte-converted/endianness-swapped byte-code does only pay off for Lua
chunks of some kilo lines.
Byte code also occupies much more space than text in the final Edje
container, as it includes debug symbols.
---
Cedric and Vincent told me, that the plan was to replace Embryo totally
by Lua before the official release of Edje at the end of the year? So it
would make sense to bring Lua to svn soon and look how it fits in, test,
debug, adapt it further to the themers needs, decide on its final shape,
GATHER SOME PEOPLE TO HELP ;-)
---
The Lua enhanced Edje is in sync with svn and can be get directly here
git clone git://repo.or.cz/edje_lua.git
cd edje_lua
git checkout -b lua_patch origin/lua_patch
or apply the attached patch
There are also some examples to show the usage of the things
mentioned
above
- showcase.edj: shows usage of custom animators, custom states,
messaging and the script_only object
- test.edj: test cases of script usage and bindings (custom states,
custom transitions, tween_states, animators, timers,
object_parts),
but most of it are experimental script_only objects
http://didgmo.sourceforge.net/showcase.edj
http://didgmo.sourceforge.net/test.edj
The source of showcase.edc is attached, too, to just have a glimpse at
Lua inside of EDC
---
So, what do you guys think?
Thanks and sry for the looong mail, hehe ;-)
SVN revision: 41802
2009-08-15 19:34:02 -07:00
|
|
|
if (_edje_lua_script_only(ed))
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2010-02-23 00:37:30 -08:00
|
|
|
_edje_lua_script_only_move(ed);
|
|
|
|
return;
|
|
|
|
}
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2013-11-20 20:26:37 -08:00
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
2010-02-23 00:37:30 -08:00
|
|
|
{
|
2013-11-20 20:26:37 -08:00
|
|
|
Edje_Real_Part *ep;
|
2010-08-12 05:58:54 -07:00
|
|
|
|
2013-11-20 20:26:37 -08:00
|
|
|
ep = ed->table_parts[i];
|
|
|
|
if ((ep->type == EDJE_RP_TYPE_TEXT) && (ep->typedata.text))
|
2010-02-23 00:37:30 -08:00
|
|
|
{
|
2018-01-15 22:12:49 -08:00
|
|
|
if (ep->object)
|
|
|
|
evas_object_move(ep->object,
|
|
|
|
ed->x + ep->x + ep->typedata.text->offset.x,
|
|
|
|
ed->y + ep->y + ep->typedata.text->offset.y);
|
|
|
|
else if (ep->type != EFL_CANVAS_LAYOUT_PART_TYPE_NONE)
|
|
|
|
WRN("No object for part '%s' in group '%s'",
|
|
|
|
ep->part ? ep->part->name : "<invalid>", ed->group);
|
2013-11-20 20:26:37 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-01-15 22:12:49 -08:00
|
|
|
if (ep->object)
|
|
|
|
evas_object_move(ep->object, ed->x + ep->x, ed->y + ep->y);
|
|
|
|
else if (ep->type != EFL_CANVAS_LAYOUT_PART_TYPE_NONE)
|
|
|
|
WRN("No object for part '%s' in group '%s'",
|
|
|
|
ep->part ? ep->part->name : "<invalid>", ed->group);
|
2013-11-20 20:26:37 -08:00
|
|
|
if ((ep->type == EDJE_RP_TYPE_SWALLOW) &&
|
|
|
|
(ep->typedata.swallow))
|
2010-02-23 00:37:30 -08:00
|
|
|
{
|
2013-11-20 20:26:37 -08:00
|
|
|
if (ep->typedata.swallow->swallowed_object)
|
|
|
|
evas_object_move
|
2015-06-08 11:43:00 -07:00
|
|
|
(ep->typedata.swallow->swallowed_object,
|
|
|
|
ed->x + ep->x,
|
|
|
|
ed->y + ep->y);
|
2010-02-23 00:37:30 -08:00
|
|
|
}
|
|
|
|
}
|
2013-11-20 20:26:37 -08:00
|
|
|
if (ep->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
_edje_entry_real_part_configure(ed, ep);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ed->have_mapped_part)
|
|
|
|
{
|
|
|
|
ed->dirty = EINA_TRUE;
|
|
|
|
ed->have_mapped_part = EINA_FALSE;
|
2013-11-21 21:02:40 -08:00
|
|
|
ed->need_map_update = EINA_TRUE;
|
|
|
|
_edje_recalc_do(ed);
|
|
|
|
ed->need_map_update = EINA_FALSE;
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
2013-11-20 20:26:37 -08:00
|
|
|
|
2005-11-23 06:00:39 -08:00
|
|
|
// _edje_emit(ed, "move", NULL);
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
|
2011-08-22 14:44:49 -07:00
|
|
|
static void
|
|
|
|
_edje_limit_emit(Edje *ed, const char *limit_name, Eina_Bool over)
|
|
|
|
{
|
|
|
|
char *buffer;
|
|
|
|
unsigned int length;
|
|
|
|
|
2013-06-20 04:28:18 -07:00
|
|
|
if (!limit_name) return;
|
2011-08-22 14:44:49 -07:00
|
|
|
|
|
|
|
length = strlen(limit_name) + 13;
|
|
|
|
buffer = alloca(length);
|
|
|
|
snprintf(buffer, length, "limit,%s,%s", limit_name, over ? "over" : "below");
|
|
|
|
_edje_emit(ed, buffer, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_limit_get(Edje *ed, Edje_Limit **limits, unsigned int length, Evas_Coord size_current, Evas_Coord size_next)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
2013-06-20 04:28:18 -07:00
|
|
|
if (size_next == size_current) return;
|
2011-08-22 14:44:49 -07:00
|
|
|
|
|
|
|
for (i = 0; i < length; ++i)
|
|
|
|
{
|
|
|
|
if ((size_current <= limits[i]->value) && (limits[i]->value < size_next))
|
|
|
|
{
|
|
|
|
_edje_limit_emit(ed, limits[i]->name, EINA_TRUE);
|
|
|
|
}
|
|
|
|
else if ((size_next <= limits[i]->value) && (limits[i]->value < size_current))
|
|
|
|
{
|
|
|
|
_edje_limit_emit(ed, limits[i]->name, EINA_FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-18 07:00:14 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_efl_canvas_layout_efl_gfx_entity_size_set(Eo *obj, Edje *ed, Eina_Size2D sz)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2017-09-15 02:37:25 -07:00
|
|
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 0, sz.w, sz.h))
|
evas/elm: Remove function group_resize
This is an override of efl_gfx_size_set. Same as before, the
order of operations matter so it is possible that a corner
case will break. In particular, legacy code was:
- intercept
- smart resize (do stuff), super, super, super
- evas object resize
The new code is more like:
- intercept
- super, super, super, evas object resize
- do stuff
But unfortunately this broke elm_widget (read: all widgets) as
the internal resize was done before the object resize. So,
inside the resize event cb, the resize_obj size would not match
the smart object size. >_<
2016-10-11 00:54:31 -07:00
|
|
|
return;
|
|
|
|
|
2017-09-15 02:37:25 -07:00
|
|
|
if ((sz.w == ed->w) && (sz.h == ed->h)) goto super;
|
2011-08-22 14:44:49 -07:00
|
|
|
if (ed->collection)
|
|
|
|
{
|
2017-09-15 02:37:25 -07:00
|
|
|
_edje_limit_get(ed, ed->collection->limits.horizontal, ed->collection->limits.horizontal_count, ed->w, sz.w);
|
|
|
|
_edje_limit_get(ed, ed->collection->limits.vertical, ed->collection->limits.vertical_count, ed->h, sz.h);
|
2011-08-22 14:44:49 -07:00
|
|
|
}
|
2017-09-15 02:37:25 -07:00
|
|
|
ed->w = sz.w;
|
|
|
|
ed->h = sz.h;
|
2012-11-28 14:38:47 -08:00
|
|
|
#ifdef HAVE_EPHYSICS
|
2012-12-11 09:38:20 -08:00
|
|
|
if ((ed->collection) && (ed->world))
|
2016-08-01 03:04:42 -07:00
|
|
|
{
|
|
|
|
if (EPH_LOAD())
|
|
|
|
EPH_CALL(ephysics_world_render_geometry_set)
|
|
|
|
(ed->world, ed->x, ed->y, ed->collection->physics.world.z,
|
|
|
|
ed->w, ed->h, ed->collection->physics.world.depth);
|
|
|
|
}
|
2012-11-28 14:38:47 -08:00
|
|
|
#endif
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
2012-09-04 22:38:01 -07:00
|
|
|
ed->all_part_change = EINA_TRUE;
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
From: "Hanspeter Portner" <ventosus@airpost.net>
This concerns Ticket #109: Add Lua support for Edje
It adds Lua as scripting facility to Edje, letting Embryo untouched.
It should be easier to use and be more flexible than Embryo, imho ;-)
---
The patch
---
Lua 5.1 is used in sandboxed mode. Lua byte code is not
platform/architecture independent, Lua code is saved as text in the Edje
container and parsed at load time, therefore.
The patch goes in two directions
1) Analogous to Embryo for scripting logic, messaging and custom states.
The same things are implemented as in Embryo:
- messaging from and to C
- manual creation of timers, animators, pollers for custom events /
animations
- manual manipulation of Edje parts by means of the public
edje_object_part_* and internal functions and custom states
-> those routines are actually implemented as Lua
bindings to
functions in Edje.h and Ecore.h
-> the implementation is done in an object oriented way, so that the
interface gives the feel of an object description language, pretty
similar to EDC itself
-> combining custom states and custom animators allows
for fancy
animations and transitions, e.g circular/spline translations or
complex/conditional transitions, etc.
-> this is just the same as Embryo does, but implemented in Lua, so
nothing new here, actually
2) Dynamic object creation and manipulation
- this interface stems from the 'script_only' objects in
Edje. Those
objects are a kind of scriptable Edje counterparts to Evas_Smart
objects. The infrastructure for Embryo is already there, but has
never been used
- I added this in Lua and added some first bindings to
experiment
with
- I thought it would be useful to allow for a limited dynamic
creation of ui parts
- We can create instances of groups from within the same Edje
container and use them just like the main Edje object as
stated in
1)
- And there are some stand-alone bindings to dynamically create
Evas_Image, Evas_Table, Evas_Line, Evas_Polygon as examples
-> this may be useful to decouple the program from the ui
even more,
to be able to do things that have to be done in the program itself
atm, but actually belong to the user interface, but need dynamic
creation of objects or complex interactions
-> those objects are manipulated manually with Lua bindings
to the
corresponding edje_object_* and evas_object_* functions
---
Discussion points
---
Both stuff in 1) & 2) is functioning, but needs testing, feedback,
improvements, ...
Stuff in 1) can already fully replace Embryo scripting with Lua
scripting. There still is space for improvements/additions, though.
Of the stuff in 2), I think it may only make sense to add the dynamic
creation of groups defined in the same Edje container. Dynamic creation
of other Evas_Objects makes not much sense, as most of them can already
be used as Edje parts and be manipulated with custom states (apart from
polygons and lines) and it would make the whole theming potentially more
programing-like and much more susceptible for errors, etc.
Would this be useful, or drop it all?
The scripting should be there just for logic, conditionals, custom
states and animations, not for a whole dynamic canvas, imho.
There is a patch around with EXTERNAL Edje parts. Seems to be a better,
faster, more secure way to extend Edje with custom objects.
There would be the possibility of precompiling Lua code at compile time
(edje_cc) for faster loading, but we would have to patch and run our own
Lua version.
The Lua parser is pretty fast, though, and using
byte-converted/endianness-swapped byte-code does only pay off for Lua
chunks of some kilo lines.
Byte code also occupies much more space than text in the final Edje
container, as it includes debug symbols.
---
Cedric and Vincent told me, that the plan was to replace Embryo totally
by Lua before the official release of Edje at the end of the year? So it
would make sense to bring Lua to svn soon and look how it fits in, test,
debug, adapt it further to the themers needs, decide on its final shape,
GATHER SOME PEOPLE TO HELP ;-)
---
The Lua enhanced Edje is in sync with svn and can be get directly here
git clone git://repo.or.cz/edje_lua.git
cd edje_lua
git checkout -b lua_patch origin/lua_patch
or apply the attached patch
There are also some examples to show the usage of the things
mentioned
above
- showcase.edj: shows usage of custom animators, custom states,
messaging and the script_only object
- test.edj: test cases of script usage and bindings (custom states,
custom transitions, tween_states, animators, timers,
object_parts),
but most of it are experimental script_only objects
http://didgmo.sourceforge.net/showcase.edj
http://didgmo.sourceforge.net/test.edj
The source of showcase.edc is attached, too, to just have a glimpse at
Lua inside of EDC
---
So, what do you guys think?
Thanks and sry for the looong mail, hehe ;-)
SVN revision: 41802
2009-08-15 19:34:02 -07:00
|
|
|
if (_edje_lua_script_only(ed))
|
|
|
|
{
|
2011-04-07 17:30:40 -07:00
|
|
|
_edje_lua_script_only_resize(ed);
|
evas/elm: Remove function group_resize
This is an override of efl_gfx_size_set. Same as before, the
order of operations matter so it is possible that a corner
case will break. In particular, legacy code was:
- intercept
- smart resize (do stuff), super, super, super
- evas object resize
The new code is more like:
- intercept
- super, super, super, evas object resize
- do stuff
But unfortunately this broke elm_widget (read: all widgets) as
the internal resize was done before the object resize. So,
inside the resize event cb, the resize_obj size would not match
the smart object size. >_<
2016-10-11 00:54:31 -07:00
|
|
|
goto super;
|
From: "Hanspeter Portner" <ventosus@airpost.net>
This concerns Ticket #109: Add Lua support for Edje
It adds Lua as scripting facility to Edje, letting Embryo untouched.
It should be easier to use and be more flexible than Embryo, imho ;-)
---
The patch
---
Lua 5.1 is used in sandboxed mode. Lua byte code is not
platform/architecture independent, Lua code is saved as text in the Edje
container and parsed at load time, therefore.
The patch goes in two directions
1) Analogous to Embryo for scripting logic, messaging and custom states.
The same things are implemented as in Embryo:
- messaging from and to C
- manual creation of timers, animators, pollers for custom events /
animations
- manual manipulation of Edje parts by means of the public
edje_object_part_* and internal functions and custom states
-> those routines are actually implemented as Lua
bindings to
functions in Edje.h and Ecore.h
-> the implementation is done in an object oriented way, so that the
interface gives the feel of an object description language, pretty
similar to EDC itself
-> combining custom states and custom animators allows
for fancy
animations and transitions, e.g circular/spline translations or
complex/conditional transitions, etc.
-> this is just the same as Embryo does, but implemented in Lua, so
nothing new here, actually
2) Dynamic object creation and manipulation
- this interface stems from the 'script_only' objects in
Edje. Those
objects are a kind of scriptable Edje counterparts to Evas_Smart
objects. The infrastructure for Embryo is already there, but has
never been used
- I added this in Lua and added some first bindings to
experiment
with
- I thought it would be useful to allow for a limited dynamic
creation of ui parts
- We can create instances of groups from within the same Edje
container and use them just like the main Edje object as
stated in
1)
- And there are some stand-alone bindings to dynamically create
Evas_Image, Evas_Table, Evas_Line, Evas_Polygon as examples
-> this may be useful to decouple the program from the ui
even more,
to be able to do things that have to be done in the program itself
atm, but actually belong to the user interface, but need dynamic
creation of objects or complex interactions
-> those objects are manipulated manually with Lua bindings
to the
corresponding edje_object_* and evas_object_* functions
---
Discussion points
---
Both stuff in 1) & 2) is functioning, but needs testing, feedback,
improvements, ...
Stuff in 1) can already fully replace Embryo scripting with Lua
scripting. There still is space for improvements/additions, though.
Of the stuff in 2), I think it may only make sense to add the dynamic
creation of groups defined in the same Edje container. Dynamic creation
of other Evas_Objects makes not much sense, as most of them can already
be used as Edje parts and be manipulated with custom states (apart from
polygons and lines) and it would make the whole theming potentially more
programing-like and much more susceptible for errors, etc.
Would this be useful, or drop it all?
The scripting should be there just for logic, conditionals, custom
states and animations, not for a whole dynamic canvas, imho.
There is a patch around with EXTERNAL Edje parts. Seems to be a better,
faster, more secure way to extend Edje with custom objects.
There would be the possibility of precompiling Lua code at compile time
(edje_cc) for faster loading, but we would have to patch and run our own
Lua version.
The Lua parser is pretty fast, though, and using
byte-converted/endianness-swapped byte-code does only pay off for Lua
chunks of some kilo lines.
Byte code also occupies much more space than text in the final Edje
container, as it includes debug symbols.
---
Cedric and Vincent told me, that the plan was to replace Embryo totally
by Lua before the official release of Edje at the end of the year? So it
would make sense to bring Lua to svn soon and look how it fits in, test,
debug, adapt it further to the themers needs, decide on its final shape,
GATHER SOME PEOPLE TO HELP ;-)
---
The Lua enhanced Edje is in sync with svn and can be get directly here
git clone git://repo.or.cz/edje_lua.git
cd edje_lua
git checkout -b lua_patch origin/lua_patch
or apply the attached patch
There are also some examples to show the usage of the things
mentioned
above
- showcase.edj: shows usage of custom animators, custom states,
messaging and the script_only object
- test.edj: test cases of script usage and bindings (custom states,
custom transitions, tween_states, animators, timers,
object_parts),
but most of it are experimental script_only objects
http://didgmo.sourceforge.net/showcase.edj
http://didgmo.sourceforge.net/test.edj
The source of showcase.edc is attached, too, to just have a glimpse at
Lua inside of EDC
---
So, what do you guys think?
Thanks and sry for the looong mail, hehe ;-)
SVN revision: 41802
2009-08-15 19:34:02 -07:00
|
|
|
}
|
2003-07-23 17:49:13 -07:00
|
|
|
// evas_object_resize(ed->clipper, ed->w, ed->h);
|
2012-09-04 22:38:01 -07:00
|
|
|
ed->dirty = EINA_TRUE;
|
2009-08-12 02:27:09 -07:00
|
|
|
_edje_recalc_do(ed);
|
2005-11-23 06:00:39 -08:00
|
|
|
_edje_emit(ed, "resize", NULL);
|
evas/elm: Remove function group_resize
This is an override of efl_gfx_size_set. Same as before, the
order of operations matter so it is possible that a corner
case will break. In particular, legacy code was:
- intercept
- smart resize (do stuff), super, super, super
- evas object resize
The new code is more like:
- intercept
- super, super, super, evas object resize
- do stuff
But unfortunately this broke elm_widget (read: all widgets) as
the internal resize was done before the object resize. So,
inside the resize event cb, the resize_obj size would not match
the smart object size. >_<
2016-10-11 00:54:31 -07:00
|
|
|
|
|
|
|
super:
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), sz);
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
|
2016-10-10 02:59:42 -07:00
|
|
|
static void
|
|
|
|
_edje_object_show(Eo *obj, Edje *ed)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2014-05-26 09:25:07 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Edje *edg;
|
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(efl_super(obj, MY_CLASS), EINA_TRUE);
|
From: "Hanspeter Portner" <ventosus@airpost.net>
This concerns Ticket #109: Add Lua support for Edje
It adds Lua as scripting facility to Edje, letting Embryo untouched.
It should be easier to use and be more flexible than Embryo, imho ;-)
---
The patch
---
Lua 5.1 is used in sandboxed mode. Lua byte code is not
platform/architecture independent, Lua code is saved as text in the Edje
container and parsed at load time, therefore.
The patch goes in two directions
1) Analogous to Embryo for scripting logic, messaging and custom states.
The same things are implemented as in Embryo:
- messaging from and to C
- manual creation of timers, animators, pollers for custom events /
animations
- manual manipulation of Edje parts by means of the public
edje_object_part_* and internal functions and custom states
-> those routines are actually implemented as Lua
bindings to
functions in Edje.h and Ecore.h
-> the implementation is done in an object oriented way, so that the
interface gives the feel of an object description language, pretty
similar to EDC itself
-> combining custom states and custom animators allows
for fancy
animations and transitions, e.g circular/spline translations or
complex/conditional transitions, etc.
-> this is just the same as Embryo does, but implemented in Lua, so
nothing new here, actually
2) Dynamic object creation and manipulation
- this interface stems from the 'script_only' objects in
Edje. Those
objects are a kind of scriptable Edje counterparts to Evas_Smart
objects. The infrastructure for Embryo is already there, but has
never been used
- I added this in Lua and added some first bindings to
experiment
with
- I thought it would be useful to allow for a limited dynamic
creation of ui parts
- We can create instances of groups from within the same Edje
container and use them just like the main Edje object as
stated in
1)
- And there are some stand-alone bindings to dynamically create
Evas_Image, Evas_Table, Evas_Line, Evas_Polygon as examples
-> this may be useful to decouple the program from the ui
even more,
to be able to do things that have to be done in the program itself
atm, but actually belong to the user interface, but need dynamic
creation of objects or complex interactions
-> those objects are manipulated manually with Lua bindings
to the
corresponding edje_object_* and evas_object_* functions
---
Discussion points
---
Both stuff in 1) & 2) is functioning, but needs testing, feedback,
improvements, ...
Stuff in 1) can already fully replace Embryo scripting with Lua
scripting. There still is space for improvements/additions, though.
Of the stuff in 2), I think it may only make sense to add the dynamic
creation of groups defined in the same Edje container. Dynamic creation
of other Evas_Objects makes not much sense, as most of them can already
be used as Edje parts and be manipulated with custom states (apart from
polygons and lines) and it would make the whole theming potentially more
programing-like and much more susceptible for errors, etc.
Would this be useful, or drop it all?
The scripting should be there just for logic, conditionals, custom
states and animations, not for a whole dynamic canvas, imho.
There is a patch around with EXTERNAL Edje parts. Seems to be a better,
faster, more secure way to extend Edje with custom objects.
There would be the possibility of precompiling Lua code at compile time
(edje_cc) for faster loading, but we would have to patch and run our own
Lua version.
The Lua parser is pretty fast, though, and using
byte-converted/endianness-swapped byte-code does only pay off for Lua
chunks of some kilo lines.
Byte code also occupies much more space than text in the final Edje
container, as it includes debug symbols.
---
Cedric and Vincent told me, that the plan was to replace Embryo totally
by Lua before the official release of Edje at the end of the year? So it
would make sense to bring Lua to svn soon and look how it fits in, test,
debug, adapt it further to the themers needs, decide on its final shape,
GATHER SOME PEOPLE TO HELP ;-)
---
The Lua enhanced Edje is in sync with svn and can be get directly here
git clone git://repo.or.cz/edje_lua.git
cd edje_lua
git checkout -b lua_patch origin/lua_patch
or apply the attached patch
There are also some examples to show the usage of the things
mentioned
above
- showcase.edj: shows usage of custom animators, custom states,
messaging and the script_only object
- test.edj: test cases of script usage and bindings (custom states,
custom transitions, tween_states, animators, timers,
object_parts),
but most of it are experimental script_only objects
http://didgmo.sourceforge.net/showcase.edj
http://didgmo.sourceforge.net/test.edj
The source of showcase.edc is attached, too, to just have a glimpse at
Lua inside of EDC
---
So, what do you guys think?
Thanks and sry for the looong mail, hehe ;-)
SVN revision: 41802
2009-08-15 19:34:02 -07:00
|
|
|
if (_edje_lua_script_only(ed))
|
2010-02-23 00:37:30 -08:00
|
|
|
{
|
|
|
|
_edje_lua_script_only_show(ed);
|
|
|
|
return;
|
|
|
|
}
|
2014-05-26 09:25:07 -07:00
|
|
|
if (eina_list_count(ed->groups) > 1)
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(ed->groups, l, edg)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
if (edg == ed) continue;
|
|
|
|
rp = evas_object_data_get(edg->obj, "\377 edje.part_obj");
|
2014-08-06 02:55:32 -07:00
|
|
|
if ((rp) && (rp->chosen_description->visible))
|
2014-05-26 09:25:07 -07:00
|
|
|
evas_object_show(edg->obj);
|
|
|
|
}
|
|
|
|
}
|
2005-11-23 06:00:39 -08:00
|
|
|
_edje_emit(ed, "show", NULL);
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
|
2016-10-10 02:59:42 -07:00
|
|
|
static void
|
|
|
|
_edje_object_hide(Eo *obj, Edje *ed)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
2014-05-26 09:25:07 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Edje *edg;
|
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(efl_super(obj, MY_CLASS), EINA_FALSE);
|
From: "Hanspeter Portner" <ventosus@airpost.net>
This concerns Ticket #109: Add Lua support for Edje
It adds Lua as scripting facility to Edje, letting Embryo untouched.
It should be easier to use and be more flexible than Embryo, imho ;-)
---
The patch
---
Lua 5.1 is used in sandboxed mode. Lua byte code is not
platform/architecture independent, Lua code is saved as text in the Edje
container and parsed at load time, therefore.
The patch goes in two directions
1) Analogous to Embryo for scripting logic, messaging and custom states.
The same things are implemented as in Embryo:
- messaging from and to C
- manual creation of timers, animators, pollers for custom events /
animations
- manual manipulation of Edje parts by means of the public
edje_object_part_* and internal functions and custom states
-> those routines are actually implemented as Lua
bindings to
functions in Edje.h and Ecore.h
-> the implementation is done in an object oriented way, so that the
interface gives the feel of an object description language, pretty
similar to EDC itself
-> combining custom states and custom animators allows
for fancy
animations and transitions, e.g circular/spline translations or
complex/conditional transitions, etc.
-> this is just the same as Embryo does, but implemented in Lua, so
nothing new here, actually
2) Dynamic object creation and manipulation
- this interface stems from the 'script_only' objects in
Edje. Those
objects are a kind of scriptable Edje counterparts to Evas_Smart
objects. The infrastructure for Embryo is already there, but has
never been used
- I added this in Lua and added some first bindings to
experiment
with
- I thought it would be useful to allow for a limited dynamic
creation of ui parts
- We can create instances of groups from within the same Edje
container and use them just like the main Edje object as
stated in
1)
- And there are some stand-alone bindings to dynamically create
Evas_Image, Evas_Table, Evas_Line, Evas_Polygon as examples
-> this may be useful to decouple the program from the ui
even more,
to be able to do things that have to be done in the program itself
atm, but actually belong to the user interface, but need dynamic
creation of objects or complex interactions
-> those objects are manipulated manually with Lua bindings
to the
corresponding edje_object_* and evas_object_* functions
---
Discussion points
---
Both stuff in 1) & 2) is functioning, but needs testing, feedback,
improvements, ...
Stuff in 1) can already fully replace Embryo scripting with Lua
scripting. There still is space for improvements/additions, though.
Of the stuff in 2), I think it may only make sense to add the dynamic
creation of groups defined in the same Edje container. Dynamic creation
of other Evas_Objects makes not much sense, as most of them can already
be used as Edje parts and be manipulated with custom states (apart from
polygons and lines) and it would make the whole theming potentially more
programing-like and much more susceptible for errors, etc.
Would this be useful, or drop it all?
The scripting should be there just for logic, conditionals, custom
states and animations, not for a whole dynamic canvas, imho.
There is a patch around with EXTERNAL Edje parts. Seems to be a better,
faster, more secure way to extend Edje with custom objects.
There would be the possibility of precompiling Lua code at compile time
(edje_cc) for faster loading, but we would have to patch and run our own
Lua version.
The Lua parser is pretty fast, though, and using
byte-converted/endianness-swapped byte-code does only pay off for Lua
chunks of some kilo lines.
Byte code also occupies much more space than text in the final Edje
container, as it includes debug symbols.
---
Cedric and Vincent told me, that the plan was to replace Embryo totally
by Lua before the official release of Edje at the end of the year? So it
would make sense to bring Lua to svn soon and look how it fits in, test,
debug, adapt it further to the themers needs, decide on its final shape,
GATHER SOME PEOPLE TO HELP ;-)
---
The Lua enhanced Edje is in sync with svn and can be get directly here
git clone git://repo.or.cz/edje_lua.git
cd edje_lua
git checkout -b lua_patch origin/lua_patch
or apply the attached patch
There are also some examples to show the usage of the things
mentioned
above
- showcase.edj: shows usage of custom animators, custom states,
messaging and the script_only object
- test.edj: test cases of script usage and bindings (custom states,
custom transitions, tween_states, animators, timers,
object_parts),
but most of it are experimental script_only objects
http://didgmo.sourceforge.net/showcase.edj
http://didgmo.sourceforge.net/test.edj
The source of showcase.edc is attached, too, to just have a glimpse at
Lua inside of EDC
---
So, what do you guys think?
Thanks and sry for the looong mail, hehe ;-)
SVN revision: 41802
2009-08-15 19:34:02 -07:00
|
|
|
if (_edje_lua_script_only(ed))
|
2010-02-23 00:37:30 -08:00
|
|
|
{
|
|
|
|
_edje_lua_script_only_hide(ed);
|
|
|
|
return;
|
|
|
|
}
|
2014-05-26 09:25:07 -07:00
|
|
|
EINA_LIST_FOREACH(ed->groups, l, edg)
|
|
|
|
if (edg != ed) evas_object_hide(edg->obj);
|
2005-11-23 06:00:39 -08:00
|
|
|
_edje_emit(ed, "hide", NULL);
|
2003-06-23 19:33:04 -07:00
|
|
|
}
|
|
|
|
|
2016-10-10 02:59:42 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_efl_canvas_layout_efl_gfx_entity_visible_set(Eo *obj, Edje *ed, Eina_Bool vis)
|
2016-10-10 02:59:42 -07:00
|
|
|
{
|
|
|
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, vis))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (vis) _edje_object_show(obj, ed);
|
|
|
|
else _edje_object_hide(obj, ed);
|
|
|
|
}
|
|
|
|
|
2016-03-28 01:47:02 -07:00
|
|
|
EOLIAN static void
|
2017-12-05 19:15:39 -08:00
|
|
|
_efl_canvas_layout_efl_canvas_object_no_render_set(Eo *obj, Edje *ed, Eina_Bool enable)
|
2016-03-28 01:47:02 -07:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Edje *edg;
|
|
|
|
|
2016-09-06 04:02:34 -07:00
|
|
|
enable = !!enable;
|
|
|
|
if (efl_canvas_object_no_render_get(obj) == enable) return;
|
|
|
|
efl_canvas_object_no_render_set(efl_super(obj, MY_CLASS), enable);
|
2016-03-28 01:47:02 -07:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ed->groups, l, edg)
|
2016-09-06 04:02:34 -07:00
|
|
|
if (edg != ed) efl_canvas_object_no_render_set(edg->obj, enable);
|
2016-03-28 01:47:02 -07:00
|
|
|
}
|
|
|
|
|
2014-03-18 07:00:14 -07:00
|
|
|
EOLIAN static void
|
2017-12-05 19:15:39 -08:00
|
|
|
_efl_canvas_layout_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Edje *ed)
|
2008-11-14 03:06:15 -08:00
|
|
|
{
|
|
|
|
_edje_recalc_do(ed);
|
|
|
|
}
|
2010-04-08 12:21:54 -07:00
|
|
|
|
2019-08-29 06:26:15 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_efl_canvas_layout_efl_file_unload(Eo *obj, Edje *ed)
|
|
|
|
{
|
|
|
|
efl_file_unload(efl_super(obj, MY_CLASS));
|
|
|
|
if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed);
|
|
|
|
#ifdef HAVE_EPHYSICS
|
|
|
|
/* clear physics world / shutdown ephysics */
|
|
|
|
if ((ed->collection) && (ed->collection->physics_enabled) && (ed->world))
|
|
|
|
{
|
|
|
|
if (EPH_LOAD())
|
|
|
|
{
|
|
|
|
EPH_CALL(ephysics_world_del)(ed->world);
|
|
|
|
EPH_CALL(ephysics_shutdown)();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (ed->persp) edje_object_perspective_set(obj, NULL);
|
|
|
|
_edje_file_del(ed);
|
|
|
|
eina_stringshare_replace(&ed->path, NULL);
|
|
|
|
eina_stringshare_replace(&ed->group, NULL);
|
|
|
|
eina_stringshare_replace(&ed->parent, NULL);
|
|
|
|
}
|
|
|
|
|
2019-02-27 10:17:09 -08:00
|
|
|
EOLIAN static Eina_Error
|
|
|
|
_efl_canvas_layout_efl_file_load(Eo *obj, Edje *ed)
|
2013-08-09 04:49:52 -07:00
|
|
|
{
|
2019-02-27 10:17:09 -08:00
|
|
|
Eina_Error err;
|
2013-08-09 04:49:52 -07:00
|
|
|
Eina_Array *nested;
|
|
|
|
|
2019-02-27 10:17:09 -08:00
|
|
|
if (efl_file_loaded_get(obj)) return 0;
|
|
|
|
|
|
|
|
err = efl_file_load(efl_super(obj, MY_CLASS));
|
|
|
|
if (err)
|
|
|
|
{
|
|
|
|
if (err == ENOENT)
|
|
|
|
ed->load_error = EDJE_LOAD_ERROR_DOES_NOT_EXIST;
|
|
|
|
else if (err == ENOMEM)
|
|
|
|
ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
|
|
|
|
else if ((err == EPERM) || (err == EACCES))
|
|
|
|
ed->load_error = EDJE_LOAD_ERROR_PERMISSION_DENIED;
|
|
|
|
else
|
|
|
|
ed->load_error = EDJE_LOAD_ERROR_GENERIC;
|
|
|
|
return err;
|
|
|
|
}
|
2013-08-09 04:49:52 -07:00
|
|
|
|
|
|
|
nested = eina_array_new(8);
|
|
|
|
|
2019-02-27 10:17:09 -08:00
|
|
|
err = _edje_object_file_set_internal(obj, efl_file_mmap_get(obj), efl_file_key_get(obj), NULL, NULL, nested);
|
2013-08-09 04:49:52 -07:00
|
|
|
|
2012-12-12 21:30:54 -08:00
|
|
|
eina_array_free(nested);
|
2013-02-19 07:49:41 -08:00
|
|
|
_edje_object_orientation_inform(obj);
|
2012-10-21 03:46:58 -07:00
|
|
|
|
2019-02-27 10:17:09 -08:00
|
|
|
return err;
|
2015-04-03 07:23:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_object_mmap_set(Edje_Object *obj, const Eina_File *file, const char *group)
|
|
|
|
{
|
2019-02-27 10:17:09 -08:00
|
|
|
return efl_file_simple_mmap_load(obj, file, group);
|
2015-04-03 07:23:13 -07:00
|
|
|
}
|
|
|
|
|
2014-06-19 07:24:40 -07:00
|
|
|
EAPI Eina_Bool
|
2015-04-07 22:34:46 -07:00
|
|
|
edje_object_file_set(Edje_Object *obj, const char *file, const char *group)
|
2014-06-19 07:24:40 -07:00
|
|
|
{
|
2019-09-11 10:38:21 -07:00
|
|
|
/* mtime checking of file is handled in efl.file mixin */
|
2019-02-27 10:17:09 -08:00
|
|
|
return efl_file_simple_load(obj, file, group);
|
2014-06-19 07:24:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2015-04-07 22:34:46 -07:00
|
|
|
edje_object_file_get(const Edje_Object *obj, const char **file, const char **group)
|
2014-06-19 07:24:40 -07:00
|
|
|
{
|
2019-02-27 10:17:09 -08:00
|
|
|
if (file) *file = efl_file_get(obj);
|
|
|
|
if (group) *group = efl_file_key_get(obj);
|
2014-06-19 07:24:40 -07:00
|
|
|
}
|
|
|
|
|
2015-11-19 03:37:07 -08:00
|
|
|
EOLIAN static void
|
2019-03-07 14:42:43 -08:00
|
|
|
_efl_canvas_layout_efl_canvas_object_paragraph_direction_set(Eo *obj, Edje *ed, Efl_Text_Bidirectional_Type dir)
|
2015-11-19 03:37:07 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_object_paragraph_direction_set(efl_super(obj, MY_CLASS), dir);
|
2015-11-19 03:37:07 -08:00
|
|
|
|
|
|
|
/* Make it dirty to recalculate edje.
|
|
|
|
It needs to move text objects according to new paragraph direction */
|
|
|
|
ed->dirty = EINA_TRUE;
|
2016-06-17 01:26:08 -07:00
|
|
|
efl_canvas_group_need_recalculate_set(obj, 1);
|
2015-11-19 03:37:07 -08:00
|
|
|
}
|
|
|
|
|
2016-11-01 10:59:09 -07:00
|
|
|
EOLIAN static void
|
2017-12-05 19:15:39 -08:00
|
|
|
_efl_canvas_layout_efl_observer_update(Eo *obj EINA_UNUSED, Edje *ed, Efl_Object *obs, const char *key, void *data)
|
2016-11-01 10:59:09 -07:00
|
|
|
{
|
|
|
|
if (!obs) return;
|
|
|
|
|
|
|
|
ed->dirty = EINA_TRUE;
|
|
|
|
ed->recalc_call = EINA_TRUE;
|
|
|
|
|
|
|
|
if ((obs == _edje_color_class_member) || (obs == _edje_size_class_member))
|
|
|
|
{
|
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
ed->all_part_change = EINA_TRUE;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else if (obs == _edje_text_class_member)
|
|
|
|
{
|
2019-08-29 07:07:25 -07:00
|
|
|
_edje_file_textblock_style_all_update_text_class(ed->file, key);
|
2016-11-01 10:59:09 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
ed->text_part_change = EINA_TRUE;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
_edje_recalc(ed);
|
|
|
|
|
|
|
|
if (obs == _edje_color_class_member)
|
|
|
|
{
|
|
|
|
if (data)
|
|
|
|
_edje_emit(ed, (const char *)data, key);
|
|
|
|
|
|
|
|
if ((ed->file) && (ed->file->color_tree))
|
|
|
|
{
|
|
|
|
Edje_Color_Tree_Node *ctn = NULL;
|
|
|
|
Eina_List *l = NULL;
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ed->file->color_tree, l, ctn)
|
|
|
|
{
|
|
|
|
if (!strcmp(ctn->name, key) && (ctn->color_classes))
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(ctn->color_classes, l, name)
|
|
|
|
efl_observable_observers_update(_edje_color_class_member, name, data);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-27 19:48:34 -07:00
|
|
|
EOLIAN Eina_Bool
|
2019-09-24 06:39:21 -07:00
|
|
|
_efl_canvas_layout_efl_playable_playable_get(const Eo *obj EINA_UNUSED, Edje *pd EINA_UNUSED)
|
2017-07-27 19:48:34 -07:00
|
|
|
{
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2019-09-24 08:18:57 -07:00
|
|
|
EOLIAN Eina_Bool
|
|
|
|
_efl_canvas_layout_efl_player_paused_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool paused)
|
2017-07-27 19:48:34 -07:00
|
|
|
{
|
|
|
|
double t;
|
|
|
|
Eina_List *l;
|
|
|
|
Edje_Running_Program *runp;
|
|
|
|
unsigned short i;
|
|
|
|
|
2019-09-24 08:18:57 -07:00
|
|
|
if (!ed) return EINA_FALSE;
|
|
|
|
if (ed->delete_me) return EINA_FALSE;
|
|
|
|
paused = !!paused;
|
|
|
|
if (ed->paused == paused) return EINA_TRUE;
|
|
|
|
if (!paused)
|
2017-07-27 19:48:34 -07:00
|
|
|
{
|
|
|
|
t = ecore_time_get() - ed->paused_at;
|
|
|
|
EINA_LIST_FOREACH(ed->actions, l, runp)
|
|
|
|
runp->start_time += t;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ed->paused_at = ecore_time_get();
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
rp = ed->table_parts[i];
|
|
|
|
if ((rp->part->type == EDJE_PART_TYPE_GROUP) &&
|
|
|
|
((rp->type == EDJE_RP_TYPE_SWALLOW) &&
|
|
|
|
(rp->typedata.swallow)) &&
|
|
|
|
(rp->typedata.swallow->swallowed_object))
|
2019-09-24 08:18:57 -07:00
|
|
|
efl_player_paused_set(rp->typedata.swallow->swallowed_object, paused);
|
2017-07-27 19:48:34 -07:00
|
|
|
}
|
2019-09-24 08:18:57 -07:00
|
|
|
return EINA_TRUE;
|
2017-07-27 19:48:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN Eina_Bool
|
2019-09-24 08:18:57 -07:00
|
|
|
_efl_canvas_layout_efl_player_paused_get(const Eo *obj EINA_UNUSED, Edje *ed)
|
2017-07-27 19:48:34 -07:00
|
|
|
{
|
|
|
|
if (!ed) return EINA_FALSE;
|
|
|
|
if (ed->delete_me) return EINA_FALSE;
|
2019-09-24 08:18:57 -07:00
|
|
|
return ed->paused;
|
2017-07-27 19:48:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN void
|
2017-12-05 19:15:39 -08:00
|
|
|
_efl_canvas_layout_efl_player_play_speed_set(Eo *obj EINA_UNUSED, Edje *pd , double speed)
|
2017-07-27 19:48:34 -07:00
|
|
|
{
|
|
|
|
if (speed <= 0.0) speed = 1.0;
|
|
|
|
pd->duration_scale = 1.0/speed;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN double
|
2018-04-17 11:09:44 -07:00
|
|
|
_efl_canvas_layout_efl_player_play_speed_get(const Eo *obj EINA_UNUSED, Edje *pd)
|
2017-07-27 19:48:34 -07:00
|
|
|
{
|
|
|
|
return 1.0/pd->duration_scale;
|
|
|
|
}
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
2017-12-05 19:15:39 -08:00
|
|
|
#define EFL_CANVAS_LAYOUT_EXTRA_OPS \
|
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_canvas_layout), \
|
|
|
|
EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _efl_canvas_layout_efl_object_dbg_info_get)
|
2017-04-21 08:58:38 -07:00
|
|
|
|
2017-12-05 19:15:39 -08:00
|
|
|
#include "efl_canvas_layout.eo.c"
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "efl_canvas_layout_eo.legacy.c"
|
2017-11-08 02:04:26 -08:00
|
|
|
#include "edje_global.eo.c"
|
2017-12-04 22:29:07 -08:00
|
|
|
#include "efl_layout_calc.eo.c"
|
2017-12-04 21:39:20 -08:00
|
|
|
#include "efl_layout_signal.eo.c"
|
2017-12-04 23:00:08 -08:00
|
|
|
#include "efl_layout_group.eo.c"
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "efl_layout_group_eo.legacy.c"
|