forked from enlightenment/efl
start some serious work on script_only edje objects - for efficiency sake i'm
having an almost parallel codepath for script_only objects - they dont get to use the older edje api calls for part defined objects. they will have a new set of calls specifically for them. it's partly done - very little available now, but will expand. lots of fixme's. SVN revision: 34699
This commit is contained in:
parent
14042818cc
commit
15cd1238db
|
@ -1,3 +1,34 @@
|
||||||
|
/* ************************** */
|
||||||
|
/* This is for script-only objects */
|
||||||
|
/* ************************** */
|
||||||
|
|
||||||
|
native e_obj_rect_add();
|
||||||
|
native e_obj_show(obj);
|
||||||
|
native e_obj_move(obj, x, y);
|
||||||
|
native e_obj_resize(obj, w, h);
|
||||||
|
native e_obj_color_set(obj, r, g, b, a);
|
||||||
|
|
||||||
|
/* threw this in for debug... but need it */
|
||||||
|
native e_signal_emit(sig[], src[]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ************************** */
|
||||||
|
/* The below is for non-script-only objects. these calls will not work for */
|
||||||
|
/* script-only objects. above are for script-only. perhaps this will be */
|
||||||
|
/* deprecated sometime? or merged to the above partly? */
|
||||||
|
/* ************************** */
|
||||||
|
|
||||||
/* Edje exported calls */
|
/* Edje exported calls */
|
||||||
|
|
||||||
/************************************************/
|
/************************************************/
|
||||||
|
|
|
@ -38,7 +38,8 @@ edje_private.h \
|
||||||
edje_cache.c \
|
edje_cache.c \
|
||||||
edje_match.c \
|
edje_match.c \
|
||||||
edje_textblock_styles.c \
|
edje_textblock_styles.c \
|
||||||
edje_edit.c
|
edje_edit.c \
|
||||||
|
edje_script_only.c
|
||||||
|
|
||||||
libedje_la_LIBADD = -lm @EDJE_LIBS@
|
libedje_la_LIBADD = -lm @EDJE_LIBS@
|
||||||
libedje_la_DEPENDENCIES = $(top_builddir)/config.h
|
libedje_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||||
|
|
|
@ -387,5 +387,5 @@ _edje_edd_setup(void)
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.max.w", prop.max.w, EET_T_INT);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.max.w", prop.max.w, EET_T_INT);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.max.h", prop.max.h, EET_T_INT);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.max.h", prop.max.h, EET_T_INT);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "id", id, EET_T_INT);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "id", id, EET_T_INT);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "script_only", id, EET_T_UCHAR);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "script_only", script_only, EET_T_UCHAR);
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,54 +182,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CHKPARAM(n) if (params[0] != (sizeof(Embryo_Cell) * (n))) return 0;
|
|
||||||
#define GETSTR(str, par) { \
|
|
||||||
Embryo_Cell *___cptr; \
|
|
||||||
int ___l; \
|
|
||||||
str = NULL; \
|
|
||||||
if ((___cptr = embryo_data_address_get(ep, (par)))) { \
|
|
||||||
___l = embryo_data_string_length_get(ep, ___cptr); \
|
|
||||||
if (((str) = alloca(___l + 1))) \
|
|
||||||
embryo_data_string_get(ep, ___cptr, (str));}}
|
|
||||||
#define GETSTREVAS(str, par) { \
|
|
||||||
if ((str)) { \
|
|
||||||
if ((par) && (!strcmp((par), (str)))) return 0; \
|
|
||||||
if ((par)) evas_stringshare_del((par)); \
|
|
||||||
(par) = (char *)evas_stringshare_add((str)); } \
|
|
||||||
else (par) = NULL; }
|
|
||||||
#define GETFLOAT(val, par) { \
|
|
||||||
float *___cptr; \
|
|
||||||
if ((___cptr = (float *)embryo_data_address_get(ep, (par)))) { \
|
|
||||||
val = *___cptr;}}
|
|
||||||
#define GETINT(val, par) { \
|
|
||||||
int *___cptr; \
|
|
||||||
if ((___cptr = (int *)embryo_data_address_get(ep, (par)))) { \
|
|
||||||
val = *___cptr;}}
|
|
||||||
#define SETSTR(str, par) { \
|
|
||||||
Embryo_Cell *___cptr; \
|
|
||||||
if ((___cptr = embryo_data_address_get(ep, (par)))) { \
|
|
||||||
embryo_data_string_set(ep, str, ___cptr);}}
|
|
||||||
#define SETSTRALLOCATE(s) { \
|
|
||||||
if (s) { \
|
|
||||||
if (strlen((s)) < params[4]) { \
|
|
||||||
SETSTR((s), params[3]); } \
|
|
||||||
else { \
|
|
||||||
char *ss; \
|
|
||||||
ss = alloca(strlen((s)) + 1); \
|
|
||||||
strcpy(ss, (s)); \
|
|
||||||
ss[params[4] - 2] = 0; \
|
|
||||||
SETSTR(ss, params[3]); }} \
|
|
||||||
else \
|
|
||||||
SETSTR("", params[3]);}
|
|
||||||
#define SETFLOAT(val, par) { \
|
|
||||||
float *___cptr; \
|
|
||||||
if ((___cptr = (float *)embryo_data_address_get(ep, (par)))) { \
|
|
||||||
*___cptr = (float)val;}}
|
|
||||||
#define SETINT(val, par) { \
|
|
||||||
int *___cptr; \
|
|
||||||
if ((___cptr = (int *)embryo_data_address_get(ep, (par)))) { \
|
|
||||||
*___cptr = (int)val;}}
|
|
||||||
|
|
||||||
/* get_int(id) */
|
/* get_int(id) */
|
||||||
static Embryo_Cell
|
static Embryo_Cell
|
||||||
_edje_embryo_fn_get_int(Embryo_Program *ep, Embryo_Cell *params)
|
_edje_embryo_fn_get_int(Embryo_Program *ep, Embryo_Cell *params)
|
||||||
|
|
|
@ -248,6 +248,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *p
|
||||||
|
|
||||||
old_swallows = _edje_swallows_collect(ed);
|
old_swallows = _edje_swallows_collect(ed);
|
||||||
|
|
||||||
|
if (_edje_script_only(ed)) _edje_script_only_shutdown(ed);
|
||||||
_edje_file_del(ed);
|
_edje_file_del(ed);
|
||||||
|
|
||||||
if (ed->path) evas_stringshare_del(ed->path);
|
if (ed->path) evas_stringshare_del(ed->path);
|
||||||
|
@ -256,318 +257,324 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *p
|
||||||
ed->part = evas_stringshare_add(part);
|
ed->part = evas_stringshare_add(part);
|
||||||
|
|
||||||
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
||||||
_edje_file_add(ed);
|
_edje_file_add(ed);
|
||||||
|
|
||||||
_edje_textblock_styles_add(ed);
|
_edje_textblock_styles_add(ed);
|
||||||
_edje_textblock_style_all_update(ed);
|
_edje_textblock_style_all_update(ed);
|
||||||
|
|
||||||
if (ed->collection)
|
if (ed->collection)
|
||||||
{
|
{
|
||||||
Evas_List *l;
|
printf("%s %s = %i\n", file, part, ed->collection->script_only);
|
||||||
int i;
|
if (ed->collection->script_only)
|
||||||
int errors = 0;
|
_edje_script_only_init(ed);
|
||||||
|
else
|
||||||
/* colorclass stuff */
|
|
||||||
for (l = ed->collection->parts; (l && ! errors); l = l->next)
|
|
||||||
{
|
{
|
||||||
Edje_Part *ep;
|
Evas_List *l;
|
||||||
Evas_List *hist = NULL;
|
int i;
|
||||||
|
int errors = 0;
|
||||||
|
|
||||||
/* Register any color classes in this parts descriptions. */
|
/* colorclass stuff */
|
||||||
ep = l->data;
|
for (l = ed->collection->parts; (l && ! errors); l = l->next)
|
||||||
if ((ep->default_desc) && (ep->default_desc->color_class))
|
|
||||||
_edje_color_class_member_add(ed, ep->default_desc->color_class);
|
|
||||||
for (hist = ep->other_desc; hist; hist = hist->next)
|
|
||||||
{
|
{
|
||||||
Edje_Part_Description *desc;
|
Edje_Part *ep;
|
||||||
|
Evas_List *hist = NULL;
|
||||||
desc = hist->data;
|
|
||||||
if (desc->color_class)
|
/* Register any color classes in this parts descriptions. */
|
||||||
_edje_color_class_member_add(ed, desc->color_class);
|
ep = l->data;
|
||||||
}
|
if ((ep->default_desc) && (ep->default_desc->color_class))
|
||||||
}
|
_edje_color_class_member_add(ed, ep->default_desc->color_class);
|
||||||
/* build real parts */
|
for (hist = ep->other_desc; hist; hist = hist->next)
|
||||||
for (n = 0, l = ed->collection->parts; l; l = l->next, n++)
|
|
||||||
{
|
|
||||||
Edje_Part *ep;
|
|
||||||
Edje_Real_Part *rp;
|
|
||||||
|
|
||||||
ep = l->data;
|
|
||||||
rp = calloc(1, sizeof(Edje_Real_Part));
|
|
||||||
if (!rp)
|
|
||||||
{
|
|
||||||
ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
rp->edje = ed;
|
|
||||||
_edje_ref(rp->edje);
|
|
||||||
rp->part = ep;
|
|
||||||
parts = evas_list_append(parts, rp);
|
|
||||||
rp->param1.description = ep->default_desc;
|
|
||||||
rp->chosen_description = rp->param1.description;
|
|
||||||
if (!rp->param1.description)
|
|
||||||
printf("EDJE ERROR: no default part description!\n");
|
|
||||||
if (ep->type == EDJE_PART_TYPE_RECTANGLE)
|
|
||||||
rp->object = evas_object_rectangle_add(ed->evas);
|
|
||||||
else if (ep->type == EDJE_PART_TYPE_IMAGE)
|
|
||||||
rp->object = evas_object_image_add(ed->evas);
|
|
||||||
else if (ep->type == EDJE_PART_TYPE_TEXT)
|
|
||||||
{
|
|
||||||
_edje_text_part_on_add(ed, rp);
|
|
||||||
rp->object = evas_object_text_add(ed->evas);
|
|
||||||
evas_object_text_font_source_set(rp->object, ed->path);
|
|
||||||
}
|
|
||||||
else if (ep->type == EDJE_PART_TYPE_SWALLOW || ep->type == EDJE_PART_TYPE_GROUP)
|
|
||||||
{
|
|
||||||
rp->object = evas_object_rectangle_add(ed->evas);
|
|
||||||
evas_object_color_set(rp->object, 0, 0, 0, 0);
|
|
||||||
evas_object_pass_events_set(rp->object, 1);
|
|
||||||
evas_object_pointer_mode_set(rp->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
|
|
||||||
}
|
|
||||||
else if (ep->type == EDJE_PART_TYPE_TEXTBLOCK)
|
|
||||||
rp->object = evas_object_textblock_add(ed->evas);
|
|
||||||
else if (ep->type == EDJE_PART_TYPE_GRADIENT)
|
|
||||||
rp->object = evas_object_gradient_add(ed->evas);
|
|
||||||
else
|
|
||||||
printf("EDJE ERROR: wrong part type %i!\n", ep->type);
|
|
||||||
if (rp->object)
|
|
||||||
{
|
|
||||||
evas_object_smart_member_add(rp->object, ed->obj);
|
|
||||||
evas_object_layer_set(rp->object, evas_object_layer_get(ed->obj));
|
|
||||||
if (ep->type != EDJE_PART_TYPE_SWALLOW && ep->type != EDJE_PART_TYPE_GROUP)
|
|
||||||
{
|
{
|
||||||
if (ep->mouse_events)
|
Edje_Part_Description *desc;
|
||||||
{
|
|
||||||
_edje_callbacks_add(rp->object, ed, rp);
|
desc = hist->data;
|
||||||
if (ep->repeat_events)
|
if (desc->color_class)
|
||||||
evas_object_repeat_events_set(rp->object, 1);
|
_edje_color_class_member_add(ed, desc->color_class);
|
||||||
|
|
||||||
if (ep->pointer_mode != EVAS_OBJECT_POINTER_MODE_AUTOGRAB)
|
|
||||||
evas_object_pointer_mode_set(rp->object, ep->pointer_mode);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
evas_object_pass_events_set(rp->object, 1);
|
|
||||||
evas_object_pointer_mode_set(rp->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
|
|
||||||
}
|
|
||||||
if (ep->precise_is_inside)
|
|
||||||
evas_object_precise_is_inside_set(rp->object, 1);
|
|
||||||
}
|
}
|
||||||
if (rp->part->clip_to_id < 0)
|
|
||||||
evas_object_clip_set(rp->object, ed->clipper);
|
|
||||||
}
|
}
|
||||||
rp->drag.step.x = ep->dragable.step_x;
|
/* build real parts */
|
||||||
rp->drag.step.y = ep->dragable.step_y;
|
for (n = 0, l = ed->collection->parts; l; l = l->next, n++)
|
||||||
rp->gradient_id = -1;
|
|
||||||
}
|
|
||||||
if (n > 0)
|
|
||||||
{
|
|
||||||
Edje_Real_Part *rp;
|
|
||||||
ed->table_parts = malloc(sizeof(Edje_Real_Part *) * n);
|
|
||||||
ed->table_parts_size = n;
|
|
||||||
/* FIXME: check malloc return */
|
|
||||||
n = 0;
|
|
||||||
for (l = parts; l; l = l->next)
|
|
||||||
{
|
{
|
||||||
rp = l->data;
|
Edje_Part *ep;
|
||||||
ed->table_parts[n] = rp;
|
Edje_Real_Part *rp;
|
||||||
n++;
|
|
||||||
|
ep = l->data;
|
||||||
|
rp = calloc(1, sizeof(Edje_Real_Part));
|
||||||
|
if (!rp)
|
||||||
|
{
|
||||||
|
ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
rp->edje = ed;
|
||||||
|
_edje_ref(rp->edje);
|
||||||
|
rp->part = ep;
|
||||||
|
parts = evas_list_append(parts, rp);
|
||||||
|
rp->param1.description = ep->default_desc;
|
||||||
|
rp->chosen_description = rp->param1.description;
|
||||||
|
if (!rp->param1.description)
|
||||||
|
printf("EDJE ERROR: no default part description!\n");
|
||||||
|
if (ep->type == EDJE_PART_TYPE_RECTANGLE)
|
||||||
|
rp->object = evas_object_rectangle_add(ed->evas);
|
||||||
|
else if (ep->type == EDJE_PART_TYPE_IMAGE)
|
||||||
|
rp->object = evas_object_image_add(ed->evas);
|
||||||
|
else if (ep->type == EDJE_PART_TYPE_TEXT)
|
||||||
|
{
|
||||||
|
_edje_text_part_on_add(ed, rp);
|
||||||
|
rp->object = evas_object_text_add(ed->evas);
|
||||||
|
evas_object_text_font_source_set(rp->object, ed->path);
|
||||||
|
}
|
||||||
|
else if (ep->type == EDJE_PART_TYPE_SWALLOW || ep->type == EDJE_PART_TYPE_GROUP)
|
||||||
|
{
|
||||||
|
rp->object = evas_object_rectangle_add(ed->evas);
|
||||||
|
evas_object_color_set(rp->object, 0, 0, 0, 0);
|
||||||
|
evas_object_pass_events_set(rp->object, 1);
|
||||||
|
evas_object_pointer_mode_set(rp->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
|
||||||
|
}
|
||||||
|
else if (ep->type == EDJE_PART_TYPE_TEXTBLOCK)
|
||||||
|
rp->object = evas_object_textblock_add(ed->evas);
|
||||||
|
else if (ep->type == EDJE_PART_TYPE_GRADIENT)
|
||||||
|
rp->object = evas_object_gradient_add(ed->evas);
|
||||||
|
else
|
||||||
|
printf("EDJE ERROR: wrong part type %i!\n", ep->type);
|
||||||
|
if (rp->object)
|
||||||
|
{
|
||||||
|
evas_object_smart_member_add(rp->object, ed->obj);
|
||||||
|
// evas_object_layer_set(rp->object, evas_object_layer_get(ed->obj));
|
||||||
|
if (ep->type != EDJE_PART_TYPE_SWALLOW && ep->type != EDJE_PART_TYPE_GROUP)
|
||||||
|
{
|
||||||
|
if (ep->mouse_events)
|
||||||
|
{
|
||||||
|
_edje_callbacks_add(rp->object, ed, rp);
|
||||||
|
if (ep->repeat_events)
|
||||||
|
evas_object_repeat_events_set(rp->object, 1);
|
||||||
|
|
||||||
|
if (ep->pointer_mode != EVAS_OBJECT_POINTER_MODE_AUTOGRAB)
|
||||||
|
evas_object_pointer_mode_set(rp->object, ep->pointer_mode);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
evas_object_pass_events_set(rp->object, 1);
|
||||||
|
evas_object_pointer_mode_set(rp->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
|
||||||
|
}
|
||||||
|
if (ep->precise_is_inside)
|
||||||
|
evas_object_precise_is_inside_set(rp->object, 1);
|
||||||
|
}
|
||||||
|
if (rp->part->clip_to_id < 0)
|
||||||
|
evas_object_clip_set(rp->object, ed->clipper);
|
||||||
|
}
|
||||||
|
rp->drag.step.x = ep->dragable.step_x;
|
||||||
|
rp->drag.step.y = ep->dragable.step_y;
|
||||||
|
rp->gradient_id = -1;
|
||||||
}
|
}
|
||||||
evas_list_free(parts);
|
if (n > 0)
|
||||||
|
{
|
||||||
|
Edje_Real_Part *rp;
|
||||||
|
ed->table_parts = malloc(sizeof(Edje_Real_Part *) * n);
|
||||||
|
ed->table_parts_size = n;
|
||||||
|
/* FIXME: check malloc return */
|
||||||
|
n = 0;
|
||||||
|
for (l = parts; l; l = l->next)
|
||||||
|
{
|
||||||
|
rp = l->data;
|
||||||
|
ed->table_parts[n] = rp;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
evas_list_free(parts);
|
||||||
|
for (i = 0; i < ed->table_parts_size; i++)
|
||||||
|
{
|
||||||
|
rp = ed->table_parts[i];
|
||||||
|
if (rp->param1.description->rel1.id_x >= 0)
|
||||||
|
rp->param1.rel1_to_x = ed->table_parts[rp->param1.description->rel1.id_x % ed->table_parts_size];
|
||||||
|
if (rp->param1.description->rel1.id_y >= 0)
|
||||||
|
rp->param1.rel1_to_y = ed->table_parts[rp->param1.description->rel1.id_y % ed->table_parts_size];
|
||||||
|
if (rp->param1.description->rel2.id_x >= 0)
|
||||||
|
rp->param1.rel2_to_x = ed->table_parts[rp->param1.description->rel2.id_x % ed->table_parts_size];
|
||||||
|
if (rp->param1.description->rel2.id_y >= 0)
|
||||||
|
rp->param1.rel2_to_y = ed->table_parts[rp->param1.description->rel2.id_y % ed->table_parts_size];
|
||||||
|
_edje_text_part_on_add_clippers(ed, rp);
|
||||||
|
if (rp->part->clip_to_id >= 0)
|
||||||
|
{
|
||||||
|
rp->clip_to = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size];
|
||||||
|
if (rp->clip_to)
|
||||||
|
{
|
||||||
|
evas_object_pass_events_set(rp->clip_to->object, 1);
|
||||||
|
evas_object_pointer_mode_set(rp->clip_to->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
|
||||||
|
evas_object_clip_set(rp->object, rp->clip_to->object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rp->part->dragable.confine_id >= 0)
|
||||||
|
rp->confine_to = ed->table_parts[rp->part->dragable.confine_id % ed->table_parts_size];
|
||||||
|
|
||||||
|
/* replay events for dragable */
|
||||||
|
if (rp->part->dragable.events_id >= 0)
|
||||||
|
{
|
||||||
|
rp->events_to =
|
||||||
|
ed->table_parts[rp->part->dragable.events_id % ed->table_parts_size];
|
||||||
|
/* events_to may be used only with dragable */
|
||||||
|
if (!rp->events_to->part->dragable.x &&
|
||||||
|
!rp->events_to->part->dragable.y)
|
||||||
|
rp->events_to = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
rp->swallow_params.min.w = 0;
|
||||||
|
rp->swallow_params.min.w = 0;
|
||||||
|
rp->swallow_params.max.w = -1;
|
||||||
|
rp->swallow_params.max.h = -1;
|
||||||
|
|
||||||
|
if (ed->file->feature_ver < 1)
|
||||||
|
{
|
||||||
|
rp->param1.description->text.id_source = -1;
|
||||||
|
rp->param1.description->text.id_text_source = -1;
|
||||||
|
}
|
||||||
|
if (rp->param1.description->text.id_source >= 0)
|
||||||
|
rp->text.source = ed->table_parts[rp->param1.description->text.id_source % ed->table_parts_size];
|
||||||
|
if (rp->param1.description->text.id_text_source >= 0)
|
||||||
|
rp->text.text_source = ed->table_parts[rp->param1.description->text.id_text_source % ed->table_parts_size];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_edje_programs_patterns_init(ed);
|
||||||
|
|
||||||
|
n = evas_list_count(ed->collection->programs);
|
||||||
|
if (n > 0)
|
||||||
|
{
|
||||||
|
/* FIXME: keeping a table AND a list is just bad - nuke list */
|
||||||
|
ed->table_programs = malloc(sizeof(Edje_Program *) * n);
|
||||||
|
ed->table_programs_size = n;
|
||||||
|
/* FIXME: check malloc return */
|
||||||
|
n = 0;
|
||||||
|
for (l = ed->collection->programs; l; l = l->next)
|
||||||
|
{
|
||||||
|
Edje_Program *pr;
|
||||||
|
|
||||||
|
pr = l->data;
|
||||||
|
ed->table_programs[n] = pr;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_edje_ref(ed);
|
||||||
|
_edje_block(ed);
|
||||||
|
_edje_freeze(ed);
|
||||||
|
if (ed->collection->script) _edje_embryo_script_init(ed);
|
||||||
|
_edje_var_init(ed);
|
||||||
for (i = 0; i < ed->table_parts_size; i++)
|
for (i = 0; i < ed->table_parts_size; i++)
|
||||||
{
|
{
|
||||||
|
Edje_Real_Part *rp;
|
||||||
|
|
||||||
rp = ed->table_parts[i];
|
rp = ed->table_parts[i];
|
||||||
if (rp->param1.description->rel1.id_x >= 0)
|
evas_object_show(rp->object);
|
||||||
rp->param1.rel1_to_x = ed->table_parts[rp->param1.description->rel1.id_x % ed->table_parts_size];
|
if (_edje_block_break(ed)) break;
|
||||||
if (rp->param1.description->rel1.id_y >= 0)
|
if (rp->part->dragable.x < 0) rp->drag.val.x = 1.0;
|
||||||
rp->param1.rel1_to_y = ed->table_parts[rp->param1.description->rel1.id_y % ed->table_parts_size];
|
if (rp->part->dragable.y < 0) rp->drag.val.x = 1.0;
|
||||||
if (rp->param1.description->rel2.id_x >= 0)
|
_edje_dragable_pos_set(ed, rp, rp->drag.val.x, rp->drag.val.y);
|
||||||
rp->param1.rel2_to_x = ed->table_parts[rp->param1.description->rel2.id_x % ed->table_parts_size];
|
}
|
||||||
if (rp->param1.description->rel2.id_y >= 0)
|
ed->dirty = 1;
|
||||||
rp->param1.rel2_to_y = ed->table_parts[rp->param1.description->rel2.id_y % ed->table_parts_size];
|
if ((evas_object_clipees_get(ed->clipper)) &&
|
||||||
_edje_text_part_on_add_clippers(ed, rp);
|
(evas_object_visible_get(obj)))
|
||||||
if (rp->part->clip_to_id >= 0)
|
evas_object_show(ed->clipper);
|
||||||
|
|
||||||
|
/* instantiate 'internal swallows' */
|
||||||
|
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) continue;
|
||||||
|
if (rp->part->source)
|
||||||
{
|
{
|
||||||
rp->clip_to = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size];
|
Evas_List *l;
|
||||||
if (rp->clip_to)
|
Evas_Object *child_obj;
|
||||||
|
Edje *child_ed;
|
||||||
|
const char *group_path_entry = evas_stringshare_add(rp->part->source);
|
||||||
|
if (!group_path)
|
||||||
{
|
{
|
||||||
evas_object_pass_events_set(rp->clip_to->object, 1);
|
group_path = evas_list_append(NULL, evas_stringshare_add(part));
|
||||||
evas_object_pointer_mode_set(rp->clip_to->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
|
group_path_started = 1;
|
||||||
evas_object_clip_set(rp->object, rp->clip_to->object);
|
|
||||||
}
|
}
|
||||||
}
|
/* make sure that this group isn't already in the tree of parents */
|
||||||
if (rp->part->dragable.confine_id >= 0)
|
for (l = group_path; l; l = l->next)
|
||||||
rp->confine_to = ed->table_parts[rp->part->dragable.confine_id % ed->table_parts_size];
|
{
|
||||||
|
if (l->data == group_path_entry)
|
||||||
/* replay events for dragable */
|
{
|
||||||
if (rp->part->dragable.events_id >= 0)
|
_edje_thaw(ed);
|
||||||
{
|
_edje_unblock(ed);
|
||||||
rp->events_to =
|
_edje_unref(ed);
|
||||||
ed->table_parts[rp->part->dragable.events_id % ed->table_parts_size];
|
_edje_file_del(ed);
|
||||||
/* events_to may be used only with dragable */
|
evas_stringshare_del(group_path_entry);
|
||||||
if (!rp->events_to->part->dragable.x &&
|
if (group_path_started)
|
||||||
!rp->events_to->part->dragable.y)
|
{
|
||||||
rp->events_to = NULL;
|
evas_stringshare_del(group_path->data);
|
||||||
}
|
evas_list_free(group_path);
|
||||||
|
}
|
||||||
rp->swallow_params.min.w = 0;
|
ed->load_error = EDJE_LOAD_ERROR_RECURSIVE_REFERENCE;
|
||||||
rp->swallow_params.min.w = 0;
|
return 0;
|
||||||
rp->swallow_params.max.w = -1;
|
}
|
||||||
rp->swallow_params.max.h = -1;
|
}
|
||||||
|
|
||||||
if (ed->file->feature_ver < 1)
|
child_obj = edje_object_add(ed->evas);
|
||||||
{
|
group_path = evas_list_append(group_path, group_path_entry);
|
||||||
rp->param1.description->text.id_source = -1;
|
if (!_edje_object_file_set_internal(child_obj, file, rp->part->source, group_path))
|
||||||
rp->param1.description->text.id_text_source = -1;
|
|
||||||
}
|
|
||||||
if (rp->param1.description->text.id_source >= 0)
|
|
||||||
rp->text.source = ed->table_parts[rp->param1.description->text.id_source % ed->table_parts_size];
|
|
||||||
if (rp->param1.description->text.id_text_source >= 0)
|
|
||||||
rp->text.text_source = ed->table_parts[rp->param1.description->text.id_text_source % ed->table_parts_size];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_edje_programs_patterns_init(ed);
|
|
||||||
|
|
||||||
n = evas_list_count(ed->collection->programs);
|
|
||||||
if (n > 0)
|
|
||||||
{
|
|
||||||
/* FIXME: keeping a table AND a list is just bad - nuke list */
|
|
||||||
ed->table_programs = malloc(sizeof(Edje_Program *) * n);
|
|
||||||
ed->table_programs_size = n;
|
|
||||||
/* FIXME: check malloc return */
|
|
||||||
n = 0;
|
|
||||||
for (l = ed->collection->programs; l; l = l->next)
|
|
||||||
{
|
|
||||||
Edje_Program *pr;
|
|
||||||
|
|
||||||
pr = l->data;
|
|
||||||
ed->table_programs[n] = pr;
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_edje_ref(ed);
|
|
||||||
_edje_block(ed);
|
|
||||||
_edje_freeze(ed);
|
|
||||||
if (ed->collection->script) _edje_embryo_script_init(ed);
|
|
||||||
_edje_var_init(ed);
|
|
||||||
for (i = 0; i < ed->table_parts_size; i++)
|
|
||||||
{
|
|
||||||
Edje_Real_Part *rp;
|
|
||||||
|
|
||||||
rp = ed->table_parts[i];
|
|
||||||
evas_object_show(rp->object);
|
|
||||||
if (_edje_block_break(ed)) break;
|
|
||||||
if (rp->part->dragable.x < 0) rp->drag.val.x = 1.0;
|
|
||||||
if (rp->part->dragable.y < 0) rp->drag.val.x = 1.0;
|
|
||||||
_edje_dragable_pos_set(ed, rp, rp->drag.val.x, rp->drag.val.y);
|
|
||||||
}
|
|
||||||
ed->dirty = 1;
|
|
||||||
if ((evas_object_clipees_get(ed->clipper)) &&
|
|
||||||
(evas_object_visible_get(obj)))
|
|
||||||
evas_object_show(ed->clipper);
|
|
||||||
|
|
||||||
/* instantiate 'internal swallows' */
|
|
||||||
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) continue;
|
|
||||||
if (rp->part->source)
|
|
||||||
{
|
|
||||||
Evas_List *l;
|
|
||||||
Evas_Object *child_obj;
|
|
||||||
Edje *child_ed;
|
|
||||||
const char *group_path_entry = evas_stringshare_add(rp->part->source);
|
|
||||||
if (!group_path)
|
|
||||||
{
|
|
||||||
group_path = evas_list_append(NULL, evas_stringshare_add(part));
|
|
||||||
group_path_started = 1;
|
|
||||||
}
|
|
||||||
/* make sure that this group isn't already in the tree of parents */
|
|
||||||
for (l = group_path; l; l = l->next)
|
|
||||||
{
|
|
||||||
if (l->data == group_path_entry)
|
|
||||||
{
|
{
|
||||||
_edje_thaw(ed);
|
_edje_thaw(ed);
|
||||||
_edje_unblock(ed);
|
_edje_unblock(ed);
|
||||||
_edje_unref(ed);
|
_edje_unref(ed);
|
||||||
_edje_file_del(ed);
|
_edje_file_del(ed);
|
||||||
evas_stringshare_del(group_path_entry);
|
|
||||||
if (group_path_started)
|
if (group_path_started)
|
||||||
{
|
{
|
||||||
evas_stringshare_del(group_path->data);
|
while (group_path)
|
||||||
evas_list_free(group_path);
|
{
|
||||||
|
evas_stringshare_del(group_path->data);
|
||||||
|
group_path = evas_list_remove_list(group_path, group_path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ed->load_error = EDJE_LOAD_ERROR_RECURSIVE_REFERENCE;
|
ed->load_error = edje_object_load_error_get(child_obj);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
child_ed = _edje_fetch(child_obj);
|
||||||
|
child_ed->parent = evas_stringshare_add(rp->part->name);
|
||||||
|
|
||||||
|
group_path = evas_list_remove(group_path, group_path_entry);
|
||||||
|
evas_stringshare_del(group_path_entry);
|
||||||
|
|
||||||
|
edje_object_signal_callback_add(child_obj, "*", "*", _cb_signal_repeat, obj);
|
||||||
|
_edje_real_part_swallow(rp, child_obj);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
child_obj = edje_object_add(ed->evas);
|
|
||||||
group_path = evas_list_append(group_path, group_path_entry);
|
if (group_path_started)
|
||||||
if (!_edje_object_file_set_internal(child_obj, file, rp->part->source, group_path))
|
{
|
||||||
|
while (group_path)
|
||||||
{
|
{
|
||||||
_edje_thaw(ed);
|
evas_stringshare_del(group_path->data);
|
||||||
_edje_unblock(ed);
|
group_path = evas_list_remove_list(group_path, group_path);
|
||||||
_edje_unref(ed);
|
|
||||||
_edje_file_del(ed);
|
|
||||||
|
|
||||||
if (group_path_started)
|
|
||||||
{
|
|
||||||
while (group_path)
|
|
||||||
{
|
|
||||||
evas_stringshare_del(group_path->data);
|
|
||||||
group_path = evas_list_remove_list(group_path, group_path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ed->load_error = edje_object_load_error_get(child_obj);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
child_ed = _edje_fetch(child_obj);
|
|
||||||
child_ed->parent = evas_stringshare_add(rp->part->name);
|
|
||||||
|
|
||||||
group_path = evas_list_remove(group_path, group_path_entry);
|
|
||||||
evas_stringshare_del(group_path_entry);
|
|
||||||
|
|
||||||
edje_object_signal_callback_add(child_obj, "*", "*", _cb_signal_repeat, obj);
|
|
||||||
_edje_real_part_swallow(rp, child_obj);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/* reswallow any swallows that existed before setting the file */
|
||||||
if (group_path_started)
|
if (old_swallows)
|
||||||
{
|
|
||||||
while (group_path)
|
|
||||||
{
|
{
|
||||||
evas_stringshare_del(group_path->data);
|
while (old_swallows)
|
||||||
group_path = evas_list_remove_list(group_path, group_path);
|
{
|
||||||
|
const char *name;
|
||||||
|
Evas_Object *swallow;
|
||||||
|
|
||||||
|
name = old_swallows->data;
|
||||||
|
old_swallows = evas_list_remove_list(old_swallows, old_swallows);
|
||||||
|
|
||||||
|
swallow = old_swallows->data;
|
||||||
|
old_swallows = evas_list_remove_list(old_swallows, old_swallows);
|
||||||
|
|
||||||
|
edje_object_part_swallow(obj, name, swallow);
|
||||||
|
evas_stringshare_del(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_edje_recalc(ed);
|
||||||
|
_edje_thaw(ed);
|
||||||
|
_edje_unblock(ed);
|
||||||
|
_edje_unref(ed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reswallow any swallows that existed before setting the file */
|
|
||||||
if (old_swallows)
|
|
||||||
{
|
|
||||||
while (old_swallows)
|
|
||||||
{
|
|
||||||
const char *name;
|
|
||||||
Evas_Object *swallow;
|
|
||||||
|
|
||||||
name = old_swallows->data;
|
|
||||||
old_swallows = evas_list_remove_list(old_swallows, old_swallows);
|
|
||||||
|
|
||||||
swallow = old_swallows->data;
|
|
||||||
old_swallows = evas_list_remove_list(old_swallows, old_swallows);
|
|
||||||
|
|
||||||
edje_object_part_swallow(obj, name, swallow);
|
|
||||||
evas_stringshare_del(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_edje_recalc(ed);
|
|
||||||
_edje_thaw(ed);
|
|
||||||
_edje_unblock(ed);
|
|
||||||
_edje_unref(ed);
|
|
||||||
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
||||||
_edje_emit(ed, "load", NULL);
|
_edje_emit(ed, "load", NULL);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -420,34 +420,10 @@ _edje_message_send(Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id, v
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_edje_message_process(Edje_Message *em)
|
_edje_message_parameters_push(Edje_Message *em)
|
||||||
{
|
{
|
||||||
Embryo_Function fn;
|
|
||||||
void *pdata;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* signals are only handled one way */
|
|
||||||
if (em->type == EDJE_MESSAGE_SIGNAL)
|
|
||||||
{
|
|
||||||
_edje_emit_handle(em->edje,
|
|
||||||
((Edje_Message_Signal *)em->msg)->sig,
|
|
||||||
((Edje_Message_Signal *)em->msg)->src);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* if this has been queued up for the app then just call the callback */
|
|
||||||
if (em->queue == EDJE_QUEUE_APP)
|
|
||||||
{
|
|
||||||
if (em->edje->message.func)
|
|
||||||
em->edje->message.func(em->edje->message.data, em->edje->obj,
|
|
||||||
em->type, em->id, em->msg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* now this message is destined for the script message handler fn */
|
|
||||||
if (!((em->edje->collection) && (em->edje->collection->script))) return;
|
|
||||||
fn = embryo_program_function_find(em->edje->collection->script, "message");
|
|
||||||
if (fn == EMBRYO_FUNCTION_NONE) return;
|
|
||||||
/* reset the engine */
|
|
||||||
_edje_embryo_script_reset(em->edje);
|
|
||||||
/* these params ALWAYS go on */
|
/* these params ALWAYS go on */
|
||||||
/* first param is the message type - always */
|
/* first param is the message type - always */
|
||||||
embryo_parameter_cell_push(em->edje->collection->script,
|
embryo_parameter_cell_push(em->edje->collection->script,
|
||||||
|
@ -556,6 +532,44 @@ _edje_message_process(Edje_Message *em)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_edje_message_process(Edje_Message *em)
|
||||||
|
{
|
||||||
|
Embryo_Function fn;
|
||||||
|
void *pdata;
|
||||||
|
|
||||||
|
/* signals are only handled one way */
|
||||||
|
if (em->type == EDJE_MESSAGE_SIGNAL)
|
||||||
|
{
|
||||||
|
_edje_emit_handle(em->edje,
|
||||||
|
((Edje_Message_Signal *)em->msg)->sig,
|
||||||
|
((Edje_Message_Signal *)em->msg)->src);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* if this has been queued up for the app then just call the callback */
|
||||||
|
if (em->queue == EDJE_QUEUE_APP)
|
||||||
|
{
|
||||||
|
if (em->edje->message.func)
|
||||||
|
em->edje->message.func(em->edje->message.data, em->edje->obj,
|
||||||
|
em->type, em->id, em->msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* now this message is destined for the script message handler fn */
|
||||||
|
if (!((em->edje->collection) && (em->edje->collection->script))) return;
|
||||||
|
if (_edje_script_only(em->edje))
|
||||||
|
{
|
||||||
|
_edje_script_only_message(em->edje, em);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fn = embryo_program_function_find(em->edje->collection->script, "message");
|
||||||
|
if (fn == EMBRYO_FUNCTION_NONE) return;
|
||||||
|
/* reset the engine */
|
||||||
|
_edje_embryo_script_reset(em->edje);
|
||||||
|
|
||||||
|
_edje_message_parameters_push(em);
|
||||||
|
|
||||||
embryo_program_vm_push(em->edje->collection->script);
|
embryo_program_vm_push(em->edje->collection->script);
|
||||||
_edje_embryo_globals_init(em->edje);
|
_edje_embryo_globals_init(em->edje);
|
||||||
pdata = embryo_program_data_get(em->edje->collection->script);
|
pdata = embryo_program_data_get(em->edje->collection->script);
|
||||||
|
|
|
@ -647,6 +647,7 @@ struct _Edje
|
||||||
/* for faster lookups to avoid nth list walks */
|
/* for faster lookups to avoid nth list walks */
|
||||||
Edje_Real_Part **table_parts;
|
Edje_Real_Part **table_parts;
|
||||||
Edje_Program **table_programs;
|
Edje_Program **table_programs;
|
||||||
|
void *script_only_data;
|
||||||
int table_programs_size;
|
int table_programs_size;
|
||||||
int table_parts_size;
|
int table_parts_size;
|
||||||
|
|
||||||
|
@ -1147,6 +1148,7 @@ void _edje_message_cb_set (Edje *ed, void (*func) (void *data,
|
||||||
Edje_Message *_edje_message_new (Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id);
|
Edje_Message *_edje_message_new (Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id);
|
||||||
void _edje_message_free (Edje_Message *em);
|
void _edje_message_free (Edje_Message *em);
|
||||||
void _edje_message_send (Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id, void *emsg);
|
void _edje_message_send (Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id, void *emsg);
|
||||||
|
void _edje_message_parameters_push (Edje_Message *em);
|
||||||
void _edje_message_process (Edje_Message *em);
|
void _edje_message_process (Edje_Message *em);
|
||||||
void _edje_message_queue_process (void);
|
void _edje_message_queue_process (void);
|
||||||
void _edje_message_queue_clear (void);
|
void _edje_message_queue_clear (void);
|
||||||
|
@ -1165,4 +1167,61 @@ void _edje_cache_file_unref(Edje_File *edf);
|
||||||
|
|
||||||
void _edje_embryo_globals_init(Edje *ed);
|
void _edje_embryo_globals_init(Edje *ed);
|
||||||
|
|
||||||
|
#define CHKPARAM(n) if (params[0] != (sizeof(Embryo_Cell) * (n))) return -1;
|
||||||
|
#define GETSTR(str, par) { \
|
||||||
|
Embryo_Cell *___cptr; \
|
||||||
|
int ___l; \
|
||||||
|
str = NULL; \
|
||||||
|
if ((___cptr = embryo_data_address_get(ep, (par)))) { \
|
||||||
|
___l = embryo_data_string_length_get(ep, ___cptr); \
|
||||||
|
if (((str) = alloca(___l + 1))) \
|
||||||
|
embryo_data_string_get(ep, ___cptr, (str)); } }
|
||||||
|
#define GETSTREVAS(str, par) { \
|
||||||
|
if ((str)) { \
|
||||||
|
if ((par) && (!strcmp((par), (str)))) return 0; \
|
||||||
|
if ((par)) evas_stringshare_del((par)); \
|
||||||
|
(par) = (char *)evas_stringshare_add((str)); } \
|
||||||
|
else (par) = NULL; }
|
||||||
|
#define GETFLOAT(val, par) { \
|
||||||
|
float *___cptr; \
|
||||||
|
if ((___cptr = (float *)embryo_data_address_get(ep, (par)))) { \
|
||||||
|
val = *___cptr; } }
|
||||||
|
#define GETINT(val, par) { \
|
||||||
|
int *___cptr; \
|
||||||
|
if ((___cptr = (int *)embryo_data_address_get(ep, (par)))) { \
|
||||||
|
val = *___cptr; } }
|
||||||
|
#define SETSTR(str, par) { \
|
||||||
|
Embryo_Cell *___cptr; \
|
||||||
|
if ((___cptr = embryo_data_address_get(ep, (par)))) { \
|
||||||
|
embryo_data_string_set(ep, str, ___cptr); } }
|
||||||
|
#define SETSTRALLOCATE(s) { \
|
||||||
|
if (s) { \
|
||||||
|
if (strlen((s)) < params[4]) { \
|
||||||
|
SETSTR((s), params[3]); } \
|
||||||
|
else { \
|
||||||
|
char *ss; \
|
||||||
|
ss = alloca(strlen((s)) + 1); \
|
||||||
|
strcpy(ss, (s)); \
|
||||||
|
ss[params[4] - 2] = 0; \
|
||||||
|
SETSTR(ss, params[3]); } } \
|
||||||
|
else \
|
||||||
|
SETSTR("", params[3]); }
|
||||||
|
#define SETFLOAT(val, par) { \
|
||||||
|
float *___cptr; \
|
||||||
|
if ((___cptr = (float *)embryo_data_address_get(ep, (par)))) { \
|
||||||
|
*___cptr = (float)val; } }
|
||||||
|
#define SETINT(val, par) { \
|
||||||
|
int *___cptr; \
|
||||||
|
if ((___cptr = (int *)embryo_data_address_get(ep, (par)))) { \
|
||||||
|
*___cptr = (int)val; } }
|
||||||
|
|
||||||
|
int _edje_script_only(Edje *ed);
|
||||||
|
void _edje_script_only_init(Edje *ed);
|
||||||
|
void _edje_script_only_shutdown(Edje *ed);
|
||||||
|
void _edje_script_only_show(Edje *ed);
|
||||||
|
void _edje_script_only_hide(Edje *ed);
|
||||||
|
void _edje_script_only_move(Edje *ed);
|
||||||
|
void _edje_script_only_resize(Edje *ed);
|
||||||
|
void _edje_script_only_message(Edje *ed, Edje_Message *em);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,440 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Edje.h"
|
||||||
|
#include <Ecore_Job.h>
|
||||||
|
#include "edje_private.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ALREADY EXPORTED BY EMBRYO:
|
||||||
|
*
|
||||||
|
* enum Float_Round_Method {
|
||||||
|
* ROUND, FLOOR, CEIL, TOZERO
|
||||||
|
* };
|
||||||
|
* enum Float_Angle_Mode {
|
||||||
|
* RADIAN, DEGREES, GRADES
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* numargs();
|
||||||
|
* getarg(arg, index=0);
|
||||||
|
* setarg(arg, index=0, value);
|
||||||
|
*
|
||||||
|
* Float:atof(string[]);
|
||||||
|
* Float:fract(Float:value);
|
||||||
|
* round(Float:value, Float_Round_Method:method=ROUND);
|
||||||
|
* Float:sqrt(Float:value);
|
||||||
|
* Float:pow(Float:value, Float:exponent);
|
||||||
|
* Float:log(Float:value, Float:base=10.0);
|
||||||
|
* Float:sin(Float:value, Float_Angle_Mode:mode=RADIAN);
|
||||||
|
* Float:cos(Float:value, Float_Angle_Mode:mode=RADIAN);
|
||||||
|
* Float:tan(Float:value, Float_Angle_Mode:mode=RADIAN);
|
||||||
|
* Float:abs(Float:value);
|
||||||
|
* atoi(str[]);
|
||||||
|
* fnmatch(glob[], str[]);
|
||||||
|
* strcmp(str1[], str2[]);
|
||||||
|
* strncmp(str1[], str2[]);
|
||||||
|
* strcpy(dst[], src[]);
|
||||||
|
* strncpy(dst[], src[], n);
|
||||||
|
* strlen(str[]);
|
||||||
|
* strcat(dst[], src[]);
|
||||||
|
* strncat(dst[], src[], n);
|
||||||
|
* strprep(dst[], src[]);
|
||||||
|
* strnprep(dst[], src[], n);
|
||||||
|
* strcut(dst[], str[], n, n2);
|
||||||
|
* snprintf(dst[], dstn, fmt[], ...);
|
||||||
|
* strstr(str[], ndl[]);
|
||||||
|
* strchr(str[], ch[]);
|
||||||
|
* strrchr(str[], ch[]);
|
||||||
|
* rand();
|
||||||
|
* Float:randf();
|
||||||
|
* Float:seconds();
|
||||||
|
* date(&year, &month, &day, &yearday, &weekday, &hr, &min, &Float:sec);
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct _Sinfo Sinfo;
|
||||||
|
|
||||||
|
struct _Sinfo
|
||||||
|
{
|
||||||
|
struct {
|
||||||
|
Embryo_Function
|
||||||
|
obj_init, obj_shutdown, obj_show, obj_show_immediate,
|
||||||
|
obj_hide, obj_hide_immediate, obj_move, obj_move_immediate,
|
||||||
|
obj_resize, obj_resize_immediate, obj_message
|
||||||
|
;
|
||||||
|
} fn;
|
||||||
|
struct {
|
||||||
|
Ecore_Job
|
||||||
|
*show, *hide, *move, *resize
|
||||||
|
;
|
||||||
|
} job;
|
||||||
|
struct {
|
||||||
|
int id;
|
||||||
|
Evas_Hash *hash; // FIXME: hash -> bad. too big. one-way lookup etc.
|
||||||
|
} oid;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void _call_fn(Edje *ed, const char *fname, Embryo_Function fn);
|
||||||
|
|
||||||
|
/* frankly - these make the code shorter to type and read - just sanity for
|
||||||
|
* development */
|
||||||
|
#define IFFN(func) if (si->fn.func != EMBRYO_FUNCTION_NONE)
|
||||||
|
#define IFNO(func) if (si->fn.func == EMBRYO_FUNCTION_NONE)
|
||||||
|
#define CLFN(func) IFFN(func) {_call_fn(ed, #func, si->fn.func);}
|
||||||
|
#define SI Sinfo *si; si = ed->script_only_data; if (!si) return
|
||||||
|
#define PINT(val) embryo_parameter_cell_push(ed->collection->script, (Embryo_Cell)(val))
|
||||||
|
#define PSTR(val) embryo_parameter_string_push(ed->collection->script, val)
|
||||||
|
#define GTFN(func) si->fn.func = embryo_program_function_find(ed->collection->script, #func)
|
||||||
|
#define DELJ(type) if (si->job.type) ecore_job_del(si->job.type);
|
||||||
|
#define ADDJ(type, func) si->job.type = ecore_job_add(func, ed);
|
||||||
|
#define ZERJ(type) si->job.type = NULL;
|
||||||
|
#define IFNJ(type) if (!si->job.type)
|
||||||
|
#define EXPF(func) embryo_program_native_call_add(ed->collection->script, #func, _exp_##func)
|
||||||
|
|
||||||
|
/* FIXME: need an oid -> ptr translation here. this is a hack. id # is linear\
|
||||||
|
* and runs out after 2billion uses or so. the hash is fat if all u have is
|
||||||
|
* a few objects... doesn't know how to do anything but evas_object as it
|
||||||
|
* will evas_object_del at the end... so for now this is a testing stub. */
|
||||||
|
static int
|
||||||
|
_oid_track(Edje *ed, void *o)
|
||||||
|
{
|
||||||
|
char buf[64];
|
||||||
|
SI;
|
||||||
|
|
||||||
|
si->oid.id++;
|
||||||
|
snprintf(buf, sizeof(buf), "%i", si->oid.id);
|
||||||
|
si->oid.hash = evas_hash_add(si->oid.hash, buf, o);
|
||||||
|
return si->oid.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
_oid_find(Edje *ed, int oid)
|
||||||
|
{
|
||||||
|
char buf[64];
|
||||||
|
SI;
|
||||||
|
|
||||||
|
snprintf(buf, sizeof(buf), "%i", si->oid.id);
|
||||||
|
return evas_hash_find(si->oid.hash, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_oid_del(Edje *ed, int oid)
|
||||||
|
{
|
||||||
|
char buf[64];
|
||||||
|
SI;
|
||||||
|
|
||||||
|
snprintf(buf, sizeof(buf), "%i", si->oid.id);
|
||||||
|
si->oid.hash = evas_hash_del(si->oid.hash, buf, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Embryo_Cell
|
||||||
|
_exp_e_obj_rect_add(Embryo_Program *ep, Embryo_Cell *params)
|
||||||
|
{
|
||||||
|
Edje *ed = embryo_program_data_get(ep);
|
||||||
|
Evas_Object *o;
|
||||||
|
int oid;
|
||||||
|
SI;
|
||||||
|
|
||||||
|
o = evas_object_rectangle_add(evas_object_evas_get(ed->obj));
|
||||||
|
if (!o) return 0;
|
||||||
|
evas_object_smart_member_add(o, ed->obj);
|
||||||
|
evas_object_clip_set(o, ed->clipper);
|
||||||
|
_oid_track(ed, o);
|
||||||
|
return oid;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Embryo_Cell
|
||||||
|
_exp_e_obj_show(Embryo_Program *ep, Embryo_Cell *params)
|
||||||
|
{
|
||||||
|
Edje *ed = embryo_program_data_get(ep);
|
||||||
|
Evas_Object *o;
|
||||||
|
SI;
|
||||||
|
|
||||||
|
CHKPARAM(1);
|
||||||
|
if (!(o = _oid_find(ed, params[1]))) return -1;
|
||||||
|
evas_object_show(o);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Embryo_Cell
|
||||||
|
_exp_e_obj_move(Embryo_Program *ep, Embryo_Cell *params)
|
||||||
|
{
|
||||||
|
Edje *ed = embryo_program_data_get(ep);
|
||||||
|
Evas_Object *o;
|
||||||
|
SI;
|
||||||
|
|
||||||
|
CHKPARAM(3);
|
||||||
|
if (!(o = _oid_find(ed, params[1]))) return -1;
|
||||||
|
evas_object_move(o, ed->x + params[2], ed->y + params[3]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Embryo_Cell
|
||||||
|
_exp_e_obj_resize(Embryo_Program *ep, Embryo_Cell *params)
|
||||||
|
{
|
||||||
|
Edje *ed = embryo_program_data_get(ep);
|
||||||
|
Evas_Object *o;
|
||||||
|
SI;
|
||||||
|
|
||||||
|
CHKPARAM(3);
|
||||||
|
if (!(o = _oid_find(ed, params[1]))) return -1;
|
||||||
|
evas_object_resize(o, params[2], params[3]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Embryo_Cell
|
||||||
|
_exp_e_obj_color_set(Embryo_Program *ep, Embryo_Cell *params)
|
||||||
|
{
|
||||||
|
Edje *ed = embryo_program_data_get(ep);
|
||||||
|
Evas_Object *o;
|
||||||
|
SI;
|
||||||
|
|
||||||
|
CHKPARAM(5);
|
||||||
|
if (!(o = _oid_find(ed, params[1]))) return -1;
|
||||||
|
evas_object_color_set(o, params[2], params[3], params[4], params[5]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Embryo_Cell
|
||||||
|
_exp_e_signal_emit(Embryo_Program *ep, Embryo_Cell *params)
|
||||||
|
{
|
||||||
|
Edje *ed = embryo_program_data_get(ep);
|
||||||
|
char *sig = NULL, *src = NULL;
|
||||||
|
SI;
|
||||||
|
|
||||||
|
CHKPARAM(2);
|
||||||
|
GETSTR(sig, params[1]);
|
||||||
|
GETSTR(src, params[2]);
|
||||||
|
if ((!sig) || (!src)) return -1;
|
||||||
|
_edje_emit(ed, sig, src);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
_edje_script_only(Edje *ed)
|
||||||
|
{
|
||||||
|
if ((ed->collection) && (ed->collection->script) &&
|
||||||
|
(ed->collection->script_only))
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_edje_script_only_init(Edje *ed)
|
||||||
|
{
|
||||||
|
Embryo_Function fn;
|
||||||
|
Sinfo *si;
|
||||||
|
|
||||||
|
si = calloc(1, sizeof(Sinfo));
|
||||||
|
if (!si) return;
|
||||||
|
ed->script_only_data = si;
|
||||||
|
|
||||||
|
embryo_program_data_set(ed->collection->script, ed);
|
||||||
|
|
||||||
|
EXPF(e_obj_rect_add);
|
||||||
|
EXPF(e_obj_show);
|
||||||
|
EXPF(e_obj_move);
|
||||||
|
EXPF(e_obj_resize);
|
||||||
|
EXPF(e_obj_color_set);
|
||||||
|
EXPF(e_signal_emit);
|
||||||
|
|
||||||
|
embryo_program_vm_push(ed->collection->script);
|
||||||
|
embryo_program_max_cycle_run_set(ed->collection->script, 5000000);
|
||||||
|
|
||||||
|
GTFN(obj_init);
|
||||||
|
GTFN(obj_shutdown);
|
||||||
|
GTFN(obj_show);
|
||||||
|
GTFN(obj_show_immediate);
|
||||||
|
GTFN(obj_hide);
|
||||||
|
GTFN(obj_hide_immediate);
|
||||||
|
GTFN(obj_move);
|
||||||
|
GTFN(obj_move_immediate);
|
||||||
|
GTFN(obj_resize);
|
||||||
|
GTFN(obj_resize_immediate);
|
||||||
|
GTFN(obj_message);
|
||||||
|
|
||||||
|
CLFN(obj_init);
|
||||||
|
_edje_script_only_move(ed);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Bool
|
||||||
|
_shutdown_oid_hash(const Evas_Hash *hash, const char *key, void *data, void *fdata)
|
||||||
|
{
|
||||||
|
evas_object_del(data);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
void
|
||||||
|
_edje_script_only_shutdown(Edje *ed)
|
||||||
|
{
|
||||||
|
Embryo_Function fn;
|
||||||
|
SI;
|
||||||
|
|
||||||
|
CLFN(obj_shutdown);
|
||||||
|
DELJ(show);
|
||||||
|
DELJ(hide);
|
||||||
|
DELJ(move);
|
||||||
|
DELJ(resize);
|
||||||
|
if (si->oid.hash)
|
||||||
|
{
|
||||||
|
evas_hash_foreach(si->oid.hash, _shutdown_oid_hash, ed);
|
||||||
|
evas_hash_free(si->oid.hash);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_show_job(void *data)
|
||||||
|
{
|
||||||
|
Edje *ed = data;
|
||||||
|
SI;
|
||||||
|
|
||||||
|
ZERJ(show);
|
||||||
|
CLFN(obj_show);
|
||||||
|
}
|
||||||
|
void
|
||||||
|
_edje_script_only_show(Edje *ed)
|
||||||
|
{
|
||||||
|
SI;
|
||||||
|
|
||||||
|
IFFN(obj_show)
|
||||||
|
{
|
||||||
|
IFNJ(hide)
|
||||||
|
{
|
||||||
|
DELJ(show);
|
||||||
|
ADDJ(show, _show_job);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DELJ(hide);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IFNO(obj_show_immediate) return;
|
||||||
|
CLFN(obj_show_immediate);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_hide_job(void *data)
|
||||||
|
{
|
||||||
|
Edje *ed = data;
|
||||||
|
SI;
|
||||||
|
|
||||||
|
ZERJ(hide);
|
||||||
|
CLFN(obj_hide);
|
||||||
|
}
|
||||||
|
void
|
||||||
|
_edje_script_only_hide(Edje *ed)
|
||||||
|
{
|
||||||
|
SI;
|
||||||
|
|
||||||
|
IFFN(obj_hide)
|
||||||
|
{
|
||||||
|
IFNJ(show)
|
||||||
|
{
|
||||||
|
DELJ(hide);
|
||||||
|
ADDJ(hide, _hide_job);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DELJ(show);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IFNO(obj_hide_immediate) return;
|
||||||
|
CLFN(obj_hide_immediate);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_move_job(void *data)
|
||||||
|
{
|
||||||
|
Edje *ed = data;
|
||||||
|
SI;
|
||||||
|
|
||||||
|
ZERJ(move);
|
||||||
|
PINT(ed->x);
|
||||||
|
PINT(ed->y);
|
||||||
|
CLFN(obj_move);
|
||||||
|
}
|
||||||
|
void
|
||||||
|
_edje_script_only_move(Edje *ed)
|
||||||
|
{
|
||||||
|
SI;
|
||||||
|
|
||||||
|
if ((si->fn.obj_move == EMBRYO_FUNCTION_NONE) &&
|
||||||
|
(si->fn.obj_move_immediate == EMBRYO_FUNCTION_NONE))
|
||||||
|
{
|
||||||
|
/* FIXME: auto-move sub-objects. this means we need to store in-edje
|
||||||
|
* x,y and other stuff... */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
IFFN(obj_move)
|
||||||
|
{
|
||||||
|
DELJ(move);
|
||||||
|
ADDJ(move, _move_job);
|
||||||
|
}
|
||||||
|
IFNO(obj_move_immediate) return;
|
||||||
|
PINT(ed->x);
|
||||||
|
PINT(ed->y);
|
||||||
|
CLFN(obj_move_immediate);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_resize_job(void *data)
|
||||||
|
{
|
||||||
|
Edje *ed = data;
|
||||||
|
SI;
|
||||||
|
|
||||||
|
ZERJ(resize);
|
||||||
|
PINT(ed->w);
|
||||||
|
PINT(ed->h);
|
||||||
|
CLFN(obj_resize);
|
||||||
|
}
|
||||||
|
void
|
||||||
|
_edje_script_only_resize(Edje *ed)
|
||||||
|
{
|
||||||
|
SI;
|
||||||
|
|
||||||
|
IFFN(obj_resize)
|
||||||
|
{
|
||||||
|
DELJ(resize);
|
||||||
|
ADDJ(resize, _resize_job);
|
||||||
|
}
|
||||||
|
PINT(ed->w);
|
||||||
|
PINT(ed->h);
|
||||||
|
CLFN(obj_resize_immediate);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_edje_script_only_message(Edje *ed, Edje_Message *em)
|
||||||
|
{
|
||||||
|
SI;
|
||||||
|
|
||||||
|
IFNO(obj_message) return;
|
||||||
|
_edje_message_parameters_push(em);
|
||||||
|
CLFN(obj_message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************/
|
||||||
|
|
||||||
|
static void
|
||||||
|
_call_fn(Edje *ed, const char *fname, Embryo_Function fn)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = embryo_program_run(ed->collection->script, fn);
|
||||||
|
if (ret == EMBRYO_PROGRAM_FAIL)
|
||||||
|
{
|
||||||
|
printf("EDJE: ERROR with embryo script.\n"
|
||||||
|
"ENTRY POINT: %s\n"
|
||||||
|
"ERROR: %s\n",
|
||||||
|
fname,
|
||||||
|
embryo_error_string_get(embryo_program_error_get(ed->collection->script)));
|
||||||
|
}
|
||||||
|
else if (ret == EMBRYO_PROGRAM_TOOLONG)
|
||||||
|
{
|
||||||
|
printf("EDJE: ERROR with embryo script.\n"
|
||||||
|
"ENTRY POINT: %s\n"
|
||||||
|
"ERROR: Script exceeded maximum allowed cycle count of %i\n",
|
||||||
|
fname,
|
||||||
|
embryo_program_max_cycle_run_get(ed->collection->script));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -88,6 +88,7 @@ _edje_smart_del(Evas_Object * obj)
|
||||||
_edje_clean_objects(ed);
|
_edje_clean_objects(ed);
|
||||||
_edje_edjes = evas_list_remove(_edje_edjes, obj);
|
_edje_edjes = evas_list_remove(_edje_edjes, obj);
|
||||||
evas_object_smart_data_set(obj, NULL);
|
evas_object_smart_data_set(obj, NULL);
|
||||||
|
if (_edje_script_only(ed)) _edje_script_only_shutdown(ed);
|
||||||
_edje_file_del(ed);
|
_edje_file_del(ed);
|
||||||
_edje_unref(ed);
|
_edje_unref(ed);
|
||||||
}
|
}
|
||||||
|
@ -105,6 +106,12 @@ _edje_smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y)
|
||||||
ed->y = y;
|
ed->y = y;
|
||||||
// evas_object_move(ed->clipper, ed->x, ed->y);
|
// evas_object_move(ed->clipper, ed->x, ed->y);
|
||||||
|
|
||||||
|
if (_edje_script_only(ed))
|
||||||
|
{
|
||||||
|
_edje_script_only_move(ed);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < ed->table_parts_size; i++)
|
for (i = 0; i < ed->table_parts_size; i++)
|
||||||
{
|
{
|
||||||
Edje_Real_Part *ep;
|
Edje_Real_Part *ep;
|
||||||
|
@ -146,6 +153,11 @@ _edje_smart_resize(Evas_Object * obj, Evas_Coord w, Evas_Coord h)
|
||||||
if ((w == ed->w) && (h == ed->h)) return;
|
if ((w == ed->w) && (h == ed->h)) return;
|
||||||
ed->w = w;
|
ed->w = w;
|
||||||
ed->h = h;
|
ed->h = h;
|
||||||
|
if (_edje_script_only(ed))
|
||||||
|
{
|
||||||
|
_edje_script_only_resize(ed);
|
||||||
|
return;
|
||||||
|
}
|
||||||
// evas_object_resize(ed->clipper, ed->w, ed->h);
|
// evas_object_resize(ed->clipper, ed->w, ed->h);
|
||||||
ed->dirty = 1;
|
ed->dirty = 1;
|
||||||
_edje_recalc(ed);
|
_edje_recalc(ed);
|
||||||
|
@ -162,6 +174,11 @@ _edje_smart_show(Evas_Object * obj)
|
||||||
if (evas_object_visible_get(ed->clipper)) return;
|
if (evas_object_visible_get(ed->clipper)) return;
|
||||||
if ((ed->collection) && (evas_object_clipees_get(ed->clipper)))
|
if ((ed->collection) && (evas_object_clipees_get(ed->clipper)))
|
||||||
evas_object_show(ed->clipper);
|
evas_object_show(ed->clipper);
|
||||||
|
if (_edje_script_only(ed))
|
||||||
|
{
|
||||||
|
_edje_script_only_show(ed);
|
||||||
|
return;
|
||||||
|
}
|
||||||
_edje_emit(ed, "show", NULL);
|
_edje_emit(ed, "show", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,6 +192,11 @@ _edje_smart_hide(Evas_Object * obj)
|
||||||
if (!evas_object_visible_get(ed->clipper)) return;
|
if (!evas_object_visible_get(ed->clipper)) return;
|
||||||
if ((ed->collection) && (evas_object_clipees_get(ed->clipper)))
|
if ((ed->collection) && (evas_object_clipees_get(ed->clipper)))
|
||||||
evas_object_hide(ed->clipper);
|
evas_object_hide(ed->clipper);
|
||||||
|
if (_edje_script_only(ed))
|
||||||
|
{
|
||||||
|
_edje_script_only_hide(ed);
|
||||||
|
return;
|
||||||
|
}
|
||||||
_edje_emit(ed, "hide", NULL);
|
_edje_emit(ed, "hide", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue