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 */
|
||||
|
||||
/************************************************/
|
||||
|
|
|
@ -38,7 +38,8 @@ edje_private.h \
|
|||
edje_cache.c \
|
||||
edje_match.c \
|
||||
edje_textblock_styles.c \
|
||||
edje_edit.c
|
||||
edje_edit.c \
|
||||
edje_script_only.c
|
||||
|
||||
libedje_la_LIBADD = -lm @EDJE_LIBS@
|
||||
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.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, "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) */
|
||||
static Embryo_Cell
|
||||
_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);
|
||||
|
||||
if (_edje_script_only(ed)) _edje_script_only_shutdown(ed);
|
||||
_edje_file_del(ed);
|
||||
|
||||
if (ed->path) evas_stringshare_del(ed->path);
|
||||
|
@ -262,6 +263,11 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *p
|
|||
_edje_textblock_style_all_update(ed);
|
||||
|
||||
if (ed->collection)
|
||||
{
|
||||
printf("%s %s = %i\n", file, part, ed->collection->script_only);
|
||||
if (ed->collection->script_only)
|
||||
_edje_script_only_init(ed);
|
||||
else
|
||||
{
|
||||
Evas_List *l;
|
||||
int i;
|
||||
|
@ -333,7 +339,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *p
|
|||
if (rp->object)
|
||||
{
|
||||
evas_object_smart_member_add(rp->object, ed->obj);
|
||||
evas_object_layer_set(rp->object, evas_object_layer_get(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)
|
||||
|
@ -568,6 +574,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *p
|
|||
_edje_thaw(ed);
|
||||
_edje_unblock(ed);
|
||||
_edje_unref(ed);
|
||||
}
|
||||
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
||||
_edje_emit(ed, "load", NULL);
|
||||
return 1;
|
||||
|
|
|
@ -420,34 +420,10 @@ _edje_message_send(Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id, v
|
|||
}
|
||||
|
||||
void
|
||||
_edje_message_process(Edje_Message *em)
|
||||
_edje_message_parameters_push(Edje_Message *em)
|
||||
{
|
||||
Embryo_Function fn;
|
||||
void *pdata;
|
||||
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 */
|
||||
/* first param is the message type - always */
|
||||
embryo_parameter_cell_push(em->edje->collection->script,
|
||||
|
@ -556,6 +532,44 @@ _edje_message_process(Edje_Message *em)
|
|||
default:
|
||||
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);
|
||||
_edje_embryo_globals_init(em->edje);
|
||||
pdata = embryo_program_data_get(em->edje->collection->script);
|
||||
|
|
|
@ -647,6 +647,7 @@ struct _Edje
|
|||
/* for faster lookups to avoid nth list walks */
|
||||
Edje_Real_Part **table_parts;
|
||||
Edje_Program **table_programs;
|
||||
void *script_only_data;
|
||||
int table_programs_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);
|
||||
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_parameters_push (Edje_Message *em);
|
||||
void _edje_message_process (Edje_Message *em);
|
||||
void _edje_message_queue_process (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);
|
||||
|
||||
#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
|
||||
|
|
|
@ -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_edjes = evas_list_remove(_edje_edjes, obj);
|
||||
evas_object_smart_data_set(obj, NULL);
|
||||
if (_edje_script_only(ed)) _edje_script_only_shutdown(ed);
|
||||
_edje_file_del(ed);
|
||||
_edje_unref(ed);
|
||||
}
|
||||
|
@ -105,6 +106,12 @@ _edje_smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y)
|
|||
ed->y = 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++)
|
||||
{
|
||||
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;
|
||||
ed->w = w;
|
||||
ed->h = h;
|
||||
if (_edje_script_only(ed))
|
||||
{
|
||||
_edje_script_only_resize(ed);
|
||||
return;
|
||||
}
|
||||
// evas_object_resize(ed->clipper, ed->w, ed->h);
|
||||
ed->dirty = 1;
|
||||
_edje_recalc(ed);
|
||||
|
@ -162,6 +174,11 @@ _edje_smart_show(Evas_Object * obj)
|
|||
if (evas_object_visible_get(ed->clipper)) return;
|
||||
if ((ed->collection) && (evas_object_clipees_get(ed->clipper)))
|
||||
evas_object_show(ed->clipper);
|
||||
if (_edje_script_only(ed))
|
||||
{
|
||||
_edje_script_only_show(ed);
|
||||
return;
|
||||
}
|
||||
_edje_emit(ed, "show", NULL);
|
||||
}
|
||||
|
||||
|
@ -175,6 +192,11 @@ _edje_smart_hide(Evas_Object * obj)
|
|||
if (!evas_object_visible_get(ed->clipper)) return;
|
||||
if ((ed->collection) && (evas_object_clipees_get(ed->clipper)))
|
||||
evas_object_hide(ed->clipper);
|
||||
if (_edje_script_only(ed))
|
||||
{
|
||||
_edje_script_only_hide(ed);
|
||||
return;
|
||||
}
|
||||
_edje_emit(ed, "hide", NULL);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue