From 172a0ccf0cd609dac4a3c0b48965c96afd3e1b01 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 8 Jun 2015 14:43:00 -0400 Subject: [PATCH] edje: reformat all C files this has been unreadable for years due to the french tabber. --- src/lib/edje/edje_box_layout.c | 45 +- src/lib/edje/edje_cache.c | 538 ++- src/lib/edje/edje_calc.c | 1925 +++++---- src/lib/edje/edje_callbacks.c | 270 +- src/lib/edje/edje_container.c | 264 +- src/lib/edje/edje_convert.c | 355 +- src/lib/edje/edje_data.c | 606 +-- src/lib/edje/edje_edit.c | 5891 +++++++++++++------------- src/lib/edje/edje_embryo.c | 2304 +++++----- src/lib/edje/edje_entry.c | 260 +- src/lib/edje/edje_external.c | 234 +- src/lib/edje/edje_load.c | 1556 +++---- src/lib/edje/edje_lua.c | 1686 ++++---- src/lib/edje/edje_lua2.c | 3370 +++++++-------- src/lib/edje/edje_lua_script_only.c | 26 +- src/lib/edje/edje_main.c | 73 +- src/lib/edje/edje_match.c | 747 ++-- src/lib/edje/edje_message_queue.c | 820 ++-- src/lib/edje/edje_module.c | 91 +- src/lib/edje/edje_multisense.c | 222 +- src/lib/edje/edje_program.c | 1384 +++--- src/lib/edje/edje_signal.c | 103 +- src/lib/edje/edje_smart.c | 29 +- src/lib/edje/edje_text.c | 553 +-- src/lib/edje/edje_textblock_styles.c | 231 +- src/lib/edje/edje_util.c | 556 +-- src/lib/edje/edje_var.c | 816 ++-- 27 files changed, 12764 insertions(+), 12191 deletions(-) mode change 100755 => 100644 src/lib/edje/edje_calc.c diff --git a/src/lib/edje/edje_box_layout.c b/src/lib/edje/edje_box_layout.c index 791e6fb2bb..35bcd2d673 100644 --- a/src/lib/edje/edje_box_layout.c +++ b/src/lib/edje/edje_box_layout.c @@ -17,21 +17,21 @@ struct _Edje_Part_Box_Animation struct { Evas_Object_Box_Layout layout; - void *data; - void(*free_data)(void *data); - Edje_Alignment align; - Evas_Point padding; + void *data; + void (*free_data)(void *data); + Edje_Alignment align; + Evas_Point padding; } start, end; - Eina_List *objs; - Eina_Bool recalculate:1; + Eina_List *objs; + Eina_Bool recalculate : 1; Evas_Object *box; - double progress; - double start_progress; - int box_start_w, box_start_h; + double progress; + double start_progress; + int box_start_w, box_start_h; }; static void -_edje_box_layout_find_all(const char *name, const char *name_alt, Evas_Object_Box_Layout *cb, void **data, void (**free_data)(void *data)) +_edje_box_layout_find_all(const char *name, const char *name_alt, Evas_Object_Box_Layout *cb, void **data, void(**free_data) (void *data)) { if (!_edje_box_layout_find(name, cb, data, free_data)) { @@ -58,7 +58,7 @@ _edje_box_layout_calculate_coords(Evas_Object *obj, Evas_Object_Box_Data *priv, EINA_LIST_FOREACH(anim->objs, l, tad) { evas_object_geometry_get(tad->obj, &tad->start.x, &tad->start.y, - &tad->start.w, &tad->start.h); + &tad->start.w, &tad->start.h); tad->start.x = tad->start.x - x; tad->start.y = tad->start.y - y; } @@ -72,7 +72,7 @@ _edje_box_layout_calculate_coords(Evas_Object *obj, Evas_Object_Box_Data *priv, EINA_LIST_FOREACH(anim->objs, l, tad) { evas_object_geometry_get(tad->obj, &tad->end.x, &tad->end.y, - &tad->end.w, &tad->end.h); + &tad->end.w, &tad->end.h); tad->end.x = tad->end.x - x; tad->end.y = tad->end.y - y; } @@ -124,7 +124,7 @@ _edje_box_layout(Evas_Object *obj, Evas_Object_Box_Data *priv, void *data) } if ((anim->progress > 0) && (anim->start_progress < 1)) - _edje_box_layout_exec(obj, anim); + _edje_box_layout_exec(obj, anim); } void @@ -133,11 +133,11 @@ _edje_box_layout_free_data(void *data) Edje_Transition_Animation_Data *tad; Edje_Part_Box_Animation *anim = data; if (anim->start.free_data && anim->start.data) - anim->start.free_data(anim->start.data); + anim->start.free_data(anim->start.data); if (anim->end.free_data && anim->end.data) - anim->end.free_data(anim->end.data); + anim->end.free_data(anim->end.data); EINA_LIST_FREE(anim->objs, tad) - free(tad); + free(tad); free(data); } @@ -146,7 +146,7 @@ _edje_box_layout_anim_new(Evas_Object *box) { Edje_Part_Box_Animation *anim = calloc(1, sizeof(Edje_Part_Box_Animation)); if (!anim) - return NULL; + return NULL; anim->box = box; evas_object_box_layout_set(box, _edje_box_layout, anim, NULL); @@ -163,7 +163,7 @@ _edje_box_recalc_apply(Edje *ed EINA_UNUSED, Edje_Real_Part *ep, Edje_Calc_Param #endif if ((ep->type != EDJE_RP_TYPE_CONTAINER) || (!ep->typedata.container)) return; - + if ((ep->param2) && (ep->description_pos != ZERO)) { Edje_Part_Description_Box *param2_desc = (Edje_Part_Description_Box *)ep->param2->description; @@ -177,7 +177,7 @@ _edje_box_recalc_apply(Edje *ed EINA_UNUSED, Edje_Real_Part *ep, Edje_Calc_Param priv = eo_data_scope_get(ep->object, EVAS_BOX_CLASS); if (priv == NULL) - return; + return; evas_object_box_padding_set(ep->object, ep->typedata.container->anim->start.padding.x, ep->typedata.container->anim->start.padding.y); evas_object_box_align_set(ep->object, TO_DOUBLE(ep->typedata.container->anim->start.align.x), TO_DOUBLE(ep->typedata.container->anim->start.align.y)); @@ -206,8 +206,8 @@ _edje_box_recalc_apply(Edje *ed EINA_UNUSED, Edje_Real_Part *ep, Edje_Calc_Param if (evas_object_smart_need_recalculate_get(ep->object)) { - evas_object_smart_need_recalculate_set(ep->object, 0); - evas_object_smart_calculate(ep->object); + evas_object_smart_need_recalculate_set(ep->object, 0); + evas_object_smart_calculate(ep->object); } #if 0 /* Why the hell do we affect part size after resize ??? */ evas_object_size_hint_min_get(ep->object, &min_w, &min_h); @@ -222,7 +222,7 @@ Eina_Bool _edje_box_layout_add_child(Edje_Real_Part *rp, Evas_Object *child_obj) { Edje_Transition_Animation_Data *tad; - + if ((rp->type != EDJE_RP_TYPE_CONTAINER) || (!rp->typedata.container)) return EINA_FALSE; tad = calloc(1, sizeof(Edje_Transition_Animation_Data)); @@ -253,3 +253,4 @@ _edje_box_layout_remove_child(Edje_Real_Part *rp, Evas_Object *child_obj) } rp->typedata.container->anim->recalculate = EINA_TRUE; } + diff --git a/src/lib/edje/edje_cache.c b/src/lib/edje/edje_cache.c index 4477ac80c2..13f83767f9 100644 --- a/src/lib/edje/edje_cache.c +++ b/src/lib/edje/edje_cache.c @@ -1,75 +1,74 @@ #include "edje_private.h" -Eina_Hash *_edje_file_hash = NULL; +Eina_Hash *_edje_file_hash = NULL; -static int _edje_file_cache_size = 16; -static Eina_List *_edje_file_cache = NULL; +static int _edje_file_cache_size = 16; +static Eina_List *_edje_file_cache = NULL; -static int _edje_collection_cache_size = 16; +static int _edje_collection_cache_size = 16; EAPI void edje_cache_emp_alloc(Edje_Part_Collection_Directory_Entry *ce) { /* Init Eina Mempools this is also used in edje_pick.c */ - char *buffer; -#define INIT_EMP(Tp, Sz, Ce) \ - buffer = alloca(strlen(ce->entry) + strlen(#Tp) + 2); \ - sprintf(buffer, "%s/%s", ce->entry, #Tp); \ - Ce->mp.Tp = eina_mempool_add("one_big", buffer, NULL, sizeof (Sz), Ce->count.Tp); \ - _emp_##Tp = Ce->mp.Tp; + char *buffer; +#define INIT_EMP(Tp, Sz, Ce) \ + buffer = alloca(strlen(ce->entry) + strlen(#Tp) + 2); \ + sprintf(buffer, "%s/%s", ce->entry, #Tp); \ + Ce->mp.Tp = eina_mempool_add("one_big", buffer, NULL, sizeof (Sz), Ce->count.Tp); \ + _emp_##Tp = Ce->mp.Tp; -#define INIT_EMP_BOTH(Tp, Sz, Ce) \ - INIT_EMP(Tp, Sz, Ce) \ - Ce->mp_rtl.Tp = eina_mempool_add("one_big", buffer, NULL, \ - sizeof (Sz), Ce->count.Tp); +#define INIT_EMP_BOTH(Tp, Sz, Ce) \ + INIT_EMP(Tp, Sz, Ce) \ + Ce->mp_rtl.Tp = eina_mempool_add("one_big", buffer, NULL, \ + sizeof (Sz), Ce->count.Tp); - INIT_EMP_BOTH(RECTANGLE, Edje_Part_Description_Common, ce); - INIT_EMP_BOTH(TEXT, Edje_Part_Description_Text, ce); - INIT_EMP_BOTH(IMAGE, Edje_Part_Description_Image, ce); - INIT_EMP_BOTH(PROXY, Edje_Part_Description_Proxy, ce); - INIT_EMP_BOTH(SWALLOW, Edje_Part_Description_Common, ce); - INIT_EMP_BOTH(TEXTBLOCK, Edje_Part_Description_Text, ce); - INIT_EMP_BOTH(GROUP, Edje_Part_Description_Common, ce); - INIT_EMP_BOTH(BOX, Edje_Part_Description_Box, ce); - INIT_EMP_BOTH(TABLE, Edje_Part_Description_Table, ce); - INIT_EMP_BOTH(EXTERNAL, Edje_Part_Description_External, ce); - INIT_EMP_BOTH(SPACER, Edje_Part_Description_Common, ce); - INIT_EMP(part, Edje_Part, ce); + INIT_EMP_BOTH(RECTANGLE, Edje_Part_Description_Common, ce); + INIT_EMP_BOTH(TEXT, Edje_Part_Description_Text, ce); + INIT_EMP_BOTH(IMAGE, Edje_Part_Description_Image, ce); + INIT_EMP_BOTH(PROXY, Edje_Part_Description_Proxy, ce); + INIT_EMP_BOTH(SWALLOW, Edje_Part_Description_Common, ce); + INIT_EMP_BOTH(TEXTBLOCK, Edje_Part_Description_Text, ce); + INIT_EMP_BOTH(GROUP, Edje_Part_Description_Common, ce); + INIT_EMP_BOTH(BOX, Edje_Part_Description_Box, ce); + INIT_EMP_BOTH(TABLE, Edje_Part_Description_Table, ce); + INIT_EMP_BOTH(EXTERNAL, Edje_Part_Description_External, ce); + INIT_EMP_BOTH(SPACER, Edje_Part_Description_Common, ce); + INIT_EMP(part, Edje_Part, ce); } EAPI void edje_cache_emp_free(Edje_Part_Collection_Directory_Entry *ce) { /* Free Eina Mempools this is also used in edje_pick.c */ /* Destroy all part and description. */ - eina_mempool_del(ce->mp.RECTANGLE); - eina_mempool_del(ce->mp.TEXT); - eina_mempool_del(ce->mp.IMAGE); - eina_mempool_del(ce->mp.PROXY); - eina_mempool_del(ce->mp.SWALLOW); - eina_mempool_del(ce->mp.TEXTBLOCK); - eina_mempool_del(ce->mp.GROUP); - eina_mempool_del(ce->mp.BOX); - eina_mempool_del(ce->mp.TABLE); - eina_mempool_del(ce->mp.EXTERNAL); - eina_mempool_del(ce->mp.SPACER); - eina_mempool_del(ce->mp.part); - memset(&ce->mp, 0, sizeof (ce->mp)); + eina_mempool_del(ce->mp.RECTANGLE); + eina_mempool_del(ce->mp.TEXT); + eina_mempool_del(ce->mp.IMAGE); + eina_mempool_del(ce->mp.PROXY); + eina_mempool_del(ce->mp.SWALLOW); + eina_mempool_del(ce->mp.TEXTBLOCK); + eina_mempool_del(ce->mp.GROUP); + eina_mempool_del(ce->mp.BOX); + eina_mempool_del(ce->mp.TABLE); + eina_mempool_del(ce->mp.EXTERNAL); + eina_mempool_del(ce->mp.SPACER); + eina_mempool_del(ce->mp.part); + memset(&ce->mp, 0, sizeof (ce->mp)); - eina_mempool_del(ce->mp_rtl.RECTANGLE); - eina_mempool_del(ce->mp_rtl.TEXT); - eina_mempool_del(ce->mp_rtl.IMAGE); - eina_mempool_del(ce->mp_rtl.PROXY); - eina_mempool_del(ce->mp_rtl.SWALLOW); - eina_mempool_del(ce->mp_rtl.TEXTBLOCK); - eina_mempool_del(ce->mp_rtl.GROUP); - eina_mempool_del(ce->mp_rtl.BOX); - eina_mempool_del(ce->mp_rtl.TABLE); - eina_mempool_del(ce->mp_rtl.EXTERNAL); - eina_mempool_del(ce->mp_rtl.SPACER); - memset(&ce->mp_rtl, 0, sizeof (ce->mp_rtl)); - ce->ref = NULL; + eina_mempool_del(ce->mp_rtl.RECTANGLE); + eina_mempool_del(ce->mp_rtl.TEXT); + eina_mempool_del(ce->mp_rtl.IMAGE); + eina_mempool_del(ce->mp_rtl.PROXY); + eina_mempool_del(ce->mp_rtl.SWALLOW); + eina_mempool_del(ce->mp_rtl.TEXTBLOCK); + eina_mempool_del(ce->mp_rtl.GROUP); + eina_mempool_del(ce->mp_rtl.BOX); + eina_mempool_del(ce->mp_rtl.TABLE); + eina_mempool_del(ce->mp_rtl.EXTERNAL); + eina_mempool_del(ce->mp_rtl.SPACER); + memset(&ce->mp_rtl, 0, sizeof (ce->mp_rtl)); + ce->ref = NULL; } - void _edje_programs_patterns_init(Edje_Part_Collection *edc) { @@ -82,21 +81,21 @@ _edje_programs_patterns_init(Edje_Part_Collection *edc) if (getenv("EDJE_DUMP_PROGRAMS")) { - INF("Group '%s' programs:", edc->part); -#define EDJE_DUMP_PROGRAM(Section) \ - for (i = 0; i < edc->programs.Section##_count; i++) \ - INF(#Section" for ('%s', '%s')", edc->programs.Section[i]->signal, edc->programs.Section[i]->source); + INF("Group '%s' programs:", edc->part); +#define EDJE_DUMP_PROGRAM(Section) \ + for (i = 0; i < edc->programs.Section##_count; i++) \ + INF(#Section " for ('%s', '%s')", edc->programs.Section[i]->signal, edc->programs.Section[i]->source); - EDJE_DUMP_PROGRAM(strcmp); - EDJE_DUMP_PROGRAM(strncmp); - EDJE_DUMP_PROGRAM(strrncmp); - EDJE_DUMP_PROGRAM(fnmatch); - EDJE_DUMP_PROGRAM(nocmp); + EDJE_DUMP_PROGRAM(strcmp); + EDJE_DUMP_PROGRAM(strncmp); + EDJE_DUMP_PROGRAM(strrncmp); + EDJE_DUMP_PROGRAM(fnmatch); + EDJE_DUMP_PROGRAM(nocmp); } edje_match_program_hash_build(edc->programs.strcmp, - edc->programs.strcmp_count, - &ssp->exact_match); + edc->programs.strcmp_count, + &ssp->exact_match); j = edc->programs.strncmp_count + edc->programs.strrncmp_count @@ -109,9 +108,9 @@ _edje_programs_patterns_init(Edje_Part_Collection *edc) j = 0; /* FIXME: Build specialized data type for each case */ -#define EDJE_LOAD_PROGRAMS_ADD(Array, Edc, It, Git, All) \ - for (It = 0; It < Edc->programs.Array##_count; ++It, ++Git) \ - All[Git] = Edc->programs.Array[It]; +#define EDJE_LOAD_PROGRAMS_ADD(Array, Edc, It, Git, All) \ + for (It = 0; It < Edc->programs.Array##_count; ++It, ++Git) \ + All[Git] = Edc->programs.Array[It]; EDJE_LOAD_PROGRAMS_ADD(fnmatch, edc, i, j, all); EDJE_LOAD_PROGRAMS_ADD(strncmp, edc, i, j, all); @@ -141,20 +140,20 @@ _edje_file_coll_open(Edje_File *edf, const char *coll) if (ce->ref) { - ce->ref->references++; - return ce->ref; + ce->ref->references++; + return ce->ref; } EINA_LIST_FOREACH(edf->collection_cache, l, edc) { - if (!strcmp(edc->part, coll)) - { - edc->references = 1; - ce->ref = edc; + if (!strcmp(edc->part, coll)) + { + edc->references = 1; + ce->ref = edc; - edf->collection_cache = eina_list_remove_list(edf->collection_cache, l); - return ce->ref; - } + edf->collection_cache = eina_list_remove_list(edf->collection_cache, l); + return ce->ref; + } } id = ce->id; @@ -174,10 +173,10 @@ _edje_file_coll_open(Edje_File *edf, const char *coll) /* This will preserve previous rendering */ unsigned int i; - /* people expect signal to not be broadcasted */ - edc->broadcast_signal = EINA_FALSE; + /* people expect signal to not be broadcasted */ + edc->broadcast_signal = EINA_FALSE; - /* people expect text.align to be 0.0 0.0 */ + /* people expect text.align to be 0.0 0.0 */ for (i = 0; i < edc->parts_count; ++i) { if (edc->parts[i]->type == EDJE_PART_TYPE_TEXTBLOCK) @@ -185,13 +184,13 @@ _edje_file_coll_open(Edje_File *edf, const char *coll) Edje_Part_Description_Text *text; unsigned int j; - text = (Edje_Part_Description_Text*) edc->parts[i]->default_desc; + text = (Edje_Part_Description_Text *)edc->parts[i]->default_desc; text->text.align.x = TO_DOUBLE(0.0); text->text.align.y = TO_DOUBLE(0.0); for (j = 0; j < edc->parts[i]->other.desc_count; ++j) { - text = (Edje_Part_Description_Text*) edc->parts[i]->other.desc[j]; + text = (Edje_Part_Description_Text *)edc->parts[i]->other.desc[j]; text->text.align.x = TO_DOUBLE(0.0); text->text.align.y = TO_DOUBLE(0.0); } @@ -204,9 +203,9 @@ _edje_file_coll_open(Edje_File *edf, const char *coll) if (data) { - edc->script = embryo_program_new(data, size); - _edje_embryo_script_init(edc); - free(data); + edc->script = embryo_program_new(data, size); + _edje_embryo_script_init(edc); + free(data); } snprintf(buf, sizeof(buf), "edje/scripts/lua/%i", id); @@ -215,7 +214,7 @@ _edje_file_coll_open(Edje_File *edf, const char *coll) if (data) { _edje_lua2_script_load(edc, data, size); - free(data); + free(data); } ce->ref = edc; @@ -230,27 +229,27 @@ _edje_file_coll_open(Edje_File *edf, const char *coll) if (n > 0) { - Edje_Program *pr; - unsigned int i; + Edje_Program *pr; + unsigned int i; - edc->patterns.table_programs = malloc(sizeof(Edje_Program *) * n); - if (edc->patterns.table_programs) - { - edc->patterns.table_programs_size = n; + edc->patterns.table_programs = malloc(sizeof(Edje_Program *) * n); + if (edc->patterns.table_programs) + { + edc->patterns.table_programs_size = n; -#define EDJE_LOAD_BUILD_TABLE(Array, Edc, It, Tmp) \ - for (It = 0; It < Edc->programs.Array##_count; ++It) \ - { \ - Tmp = Edc->programs.Array[It]; \ - Edc->patterns.table_programs[Tmp->id] = Tmp; \ - } +#define EDJE_LOAD_BUILD_TABLE(Array, Edc, It, Tmp) \ + for (It = 0; It < Edc->programs.Array##_count; ++It) \ + { \ + Tmp = Edc->programs.Array[It]; \ + Edc->patterns.table_programs[Tmp->id] = Tmp; \ + } - EDJE_LOAD_BUILD_TABLE(fnmatch, edc, i, pr); - EDJE_LOAD_BUILD_TABLE(strcmp, edc, i, pr); - EDJE_LOAD_BUILD_TABLE(strncmp, edc, i, pr); - EDJE_LOAD_BUILD_TABLE(strrncmp, edc, i, pr); - EDJE_LOAD_BUILD_TABLE(nocmp, edc, i, pr); - } + EDJE_LOAD_BUILD_TABLE(fnmatch, edc, i, pr); + EDJE_LOAD_BUILD_TABLE(strcmp, edc, i, pr); + EDJE_LOAD_BUILD_TABLE(strncmp, edc, i, pr); + EDJE_LOAD_BUILD_TABLE(strrncmp, edc, i, pr); + EDJE_LOAD_BUILD_TABLE(nocmp, edc, i, pr); + } } return edc; @@ -268,15 +267,15 @@ _edje_file_open(const Eina_File *f, const char *coll, int *error_ret, Edje_Part_ ef = eet_mmap(f); if (!ef) { - *error_ret = EDJE_LOAD_ERROR_UNKNOWN_FORMAT; - return NULL; + *error_ret = EDJE_LOAD_ERROR_UNKNOWN_FORMAT; + return NULL; } edf = eet_data_read(ef, _edje_edd_edje_file, "edje/file"); if (!edf) { - *error_ret = EDJE_LOAD_ERROR_CORRUPT_FILE; - eet_close(ef); - return NULL; + *error_ret = EDJE_LOAD_ERROR_CORRUPT_FILE; + eet_close(ef); + return NULL; } edf->f = eina_file_dup(f); @@ -285,20 +284,20 @@ _edje_file_open(const Eina_File *f, const char *coll, int *error_ret, Edje_Part_ if (edf->version != EDJE_FILE_VERSION) { - *error_ret = EDJE_LOAD_ERROR_INCOMPATIBLE_FILE; - _edje_file_free(edf); - return NULL; + *error_ret = EDJE_LOAD_ERROR_INCOMPATIBLE_FILE; + _edje_file_free(edf); + return NULL; } if (!edf->collection) { - *error_ret = EDJE_LOAD_ERROR_CORRUPT_FILE; - _edje_file_free(edf); - return NULL; + *error_ret = EDJE_LOAD_ERROR_CORRUPT_FILE; + _edje_file_free(edf); + return NULL; } if (edf->minor > EDJE_FILE_MINOR) { - WRN("`%s` may use feature from a newer edje and could not show up as expected.", + WRN("`%s` may use feature from a newer edje and could not show up as expected.", eina_file_filename_get(f)); } if (edf->base_scale <= ZERO) @@ -319,12 +318,12 @@ _edje_file_open(const Eina_File *f, const char *coll, int *error_ret, Edje_Part_ if (coll) { - edc = _edje_file_coll_open(edf, coll); - if (!edc) - { - *error_ret = EDJE_LOAD_ERROR_UNKNOWN_COLLECTION; - } - if (edc_ret) *edc_ret = edc; + edc = _edje_file_coll_open(edf, coll); + if (!edc) + { + *error_ret = EDJE_LOAD_ERROR_UNKNOWN_COLLECTION; + } + if (edc_ret) *edc_ret = edc; } return edf; @@ -341,10 +340,11 @@ _edje_file_dangling(Edje_File *edf) eina_hash_del(_edje_file_hash, &edf->f, edf); if (!eina_hash_population(_edje_file_hash)) { - eina_hash_free(_edje_file_hash); - _edje_file_hash = NULL; + eina_hash_free(_edje_file_hash); + _edje_file_hash = NULL; } } + #endif Edje_File * @@ -357,27 +357,27 @@ _edje_cache_file_coll_open(const Eina_File *file, const char *coll, int *error_r if (!_edje_file_hash) { - _edje_file_hash = eina_hash_pointer_new(NULL); - goto find_list; + _edje_file_hash = eina_hash_pointer_new(NULL); + goto find_list; } edf = eina_hash_find(_edje_file_hash, &file); if (edf) { - edf->references++; - goto open; + edf->references++; + goto open; } - + find_list: EINA_LIST_FOREACH(_edje_file_cache, l, edf) { - if (edf->f == file) - { - edf->references = 1; - _edje_file_cache = eina_list_remove_list(_edje_file_cache, l); - eina_hash_direct_add(_edje_file_hash, &edf->f, edf); - goto open; - } + if (edf->f == file) + { + edf->references = 1; + _edje_file_cache = eina_list_remove_list(_edje_file_cache, l); + eina_hash_direct_add(_edje_file_hash, &edf->f, edf); + goto open; + } } edf = _edje_file_open(file, coll, error_ret, edc_ret, eina_file_mtime_get(file)); @@ -388,106 +388,106 @@ find_list: open: if (!coll) - return edf; + return edf; edc = _edje_file_coll_open(edf, coll); if (!edc) { - *error_ret = EDJE_LOAD_ERROR_UNKNOWN_COLLECTION; + *error_ret = EDJE_LOAD_ERROR_UNKNOWN_COLLECTION; } else { - if (!edc->checked) - { - unsigned int j; + if (!edc->checked) + { + unsigned int j; - for (j = 0; j < edc->parts_count; ++j) - { - Edje_Part *ep2; + for (j = 0; j < edc->parts_count; ++j) + { + Edje_Part *ep2; - ep = edc->parts[j]; + ep = edc->parts[j]; - /* Register any color classes in this parts descriptions. */ - hist = NULL; - hist = eina_list_append(hist, ep); - ep2 = ep; - while (ep2->dragable.confine_id >= 0) - { - if (ep2->dragable.confine_id >= (int) edc->parts_count) - { - ERR("confine_to above limit. invalidating it."); - ep2->dragable.confine_id = -1; - break; - } + /* Register any color classes in this parts descriptions. */ + hist = NULL; + hist = eina_list_append(hist, ep); + ep2 = ep; + while (ep2->dragable.confine_id >= 0) + { + if (ep2->dragable.confine_id >= (int)edc->parts_count) + { + ERR("confine_to above limit. invalidating it."); + ep2->dragable.confine_id = -1; + break; + } - ep2 = edc->parts[ep2->dragable.confine_id]; - if (eina_list_data_find(hist, ep2)) - { - ERR("confine_to loops. invalidating loop."); - ep2->dragable.confine_id = -1; - break; - } - hist = eina_list_append(hist, ep2); - } - eina_list_free(hist); - hist = NULL; - hist = eina_list_append(hist, ep); - ep2 = ep; - while (ep2->dragable.event_id >= 0) - { - Edje_Part* prev; + ep2 = edc->parts[ep2->dragable.confine_id]; + if (eina_list_data_find(hist, ep2)) + { + ERR("confine_to loops. invalidating loop."); + ep2->dragable.confine_id = -1; + break; + } + hist = eina_list_append(hist, ep2); + } + eina_list_free(hist); + hist = NULL; + hist = eina_list_append(hist, ep); + ep2 = ep; + while (ep2->dragable.event_id >= 0) + { + Edje_Part *prev; - if (ep2->dragable.event_id >= (int) edc->parts_count) - { - ERR("event_id above limit. invalidating it."); - ep2->dragable.event_id = -1; - break; - } - prev = ep2; + if (ep2->dragable.event_id >= (int)edc->parts_count) + { + ERR("event_id above limit. invalidating it."); + ep2->dragable.event_id = -1; + break; + } + prev = ep2; - ep2 = edc->parts[ep2->dragable.event_id]; - /* events_to may be used only with dragable */ - if (!ep2->dragable.x && !ep2->dragable.y) - { - prev->dragable.event_id = -1; - break; - } + ep2 = edc->parts[ep2->dragable.event_id]; + /* events_to may be used only with dragable */ + if (!ep2->dragable.x && !ep2->dragable.y) + { + prev->dragable.event_id = -1; + break; + } - if (eina_list_data_find(hist, ep2)) - { - ERR("events_to loops. invalidating loop."); - ep2->dragable.event_id = -1; - break; - } - hist = eina_list_append(hist, ep2); - } - eina_list_free(hist); - hist = NULL; - hist = eina_list_append(hist, ep); - ep2 = ep; - while (ep2->clip_to_id >= 0) - { - if (ep2->clip_to_id >= (int) edc->parts_count) - { - ERR("clip_to_id above limit. invalidating it."); - ep2->clip_to_id = -1; - break; - } + if (eina_list_data_find(hist, ep2)) + { + ERR("events_to loops. invalidating loop."); + ep2->dragable.event_id = -1; + break; + } + hist = eina_list_append(hist, ep2); + } + eina_list_free(hist); + hist = NULL; + hist = eina_list_append(hist, ep); + ep2 = ep; + while (ep2->clip_to_id >= 0) + { + if (ep2->clip_to_id >= (int)edc->parts_count) + { + ERR("clip_to_id above limit. invalidating it."); + ep2->clip_to_id = -1; + break; + } - ep2 = edc->parts[ep2->clip_to_id]; - if (eina_list_data_find(hist, ep2)) - { - ERR("clip_to loops. invalidating loop."); - ep2->clip_to_id = -1; - break; - } - hist = eina_list_append(hist, ep2); - } - eina_list_free(hist); - hist = NULL; - } - edc->checked = 1; - } + ep2 = edc->parts[ep2->clip_to_id]; + if (eina_list_data_find(hist, ep2)) + { + ERR("clip_to loops. invalidating loop."); + ep2->clip_to_id = -1; + break; + } + hist = eina_list_append(hist, ep2); + } + eina_list_free(hist); + hist = NULL; + } + edc->checked = 1; + } } if (edc_ret) *edc_ret = edc; @@ -499,16 +499,16 @@ void _edje_cache_coll_clean(Edje_File *edf) { while ((edf->collection_cache) && - (eina_list_count(edf->collection_cache) > (unsigned int) _edje_collection_cache_size)) + (eina_list_count(edf->collection_cache) > (unsigned int)_edje_collection_cache_size)) { - Edje_Part_Collection_Directory_Entry *ce; - Edje_Part_Collection *edc; + Edje_Part_Collection_Directory_Entry *ce; + Edje_Part_Collection *edc; - edc = eina_list_data_get(eina_list_last(edf->collection_cache)); - edf->collection_cache = eina_list_remove_list(edf->collection_cache, eina_list_last(edf->collection_cache)); + edc = eina_list_data_get(eina_list_last(edf->collection_cache)); + edf->collection_cache = eina_list_remove_list(edf->collection_cache, eina_list_last(edf->collection_cache)); - ce = eina_hash_find(edf->collection, edc->part); - _edje_collection_free(edf, edc, ce); + ce = eina_hash_find(edf->collection, edc->part); + _edje_collection_free(edf, edc, ce); } } @@ -517,17 +517,17 @@ _edje_cache_coll_flush(Edje_File *edf) { while (edf->collection_cache) { - Edje_Part_Collection_Directory_Entry *ce; - Edje_Part_Collection *edc; - Eina_List *last; + Edje_Part_Collection_Directory_Entry *ce; + Edje_Part_Collection *edc; + Eina_List *last; - last = eina_list_last(edf->collection_cache); - edc = eina_list_data_get(last); - edf->collection_cache = eina_list_remove_list(edf->collection_cache, - last); + last = eina_list_last(edf->collection_cache); + edc = eina_list_data_get(last); + edf->collection_cache = eina_list_remove_list(edf->collection_cache, + last); - ce = eina_hash_find(edf->collection, edc->part); - _edje_collection_free(edf, edc, ce); + ce = eina_hash_find(edf->collection, edc->part); + _edje_collection_free(edf, edc, ce); } } @@ -542,23 +542,23 @@ _edje_cache_coll_unref(Edje_File *edf, Edje_Part_Collection *edc) ce = eina_hash_find(edf->collection, edc->part); if (!ce) { - ERR("Something is wrong with reference count of '%s'.", edc->part); + ERR("Something is wrong with reference count of '%s'.", edc->part); } else if (ce->ref) { - ce->ref = NULL; + ce->ref = NULL; - if (edf->dangling) - { - /* No need to keep the collection around if the file is dangling */ - _edje_collection_free(edf, edc, ce); - _edje_cache_coll_flush(edf); - } - else - { - edf->collection_cache = eina_list_prepend(edf->collection_cache, edc); - _edje_cache_coll_clean(edf); - } + if (edf->dangling) + { + /* No need to keep the collection around if the file is dangling */ + _edje_collection_free(edf, edc, ce); + _edje_cache_coll_flush(edf); + } + else + { + edf->collection_cache = eina_list_prepend(edf->collection_cache, edc); + _edje_cache_coll_clean(edf); + } } } @@ -570,14 +570,14 @@ _edje_cache_file_clean(void) count = eina_list_count(_edje_file_cache); while ((_edje_file_cache) && (count > _edje_file_cache_size)) { - Eina_List *last; - Edje_File *edf; + Eina_List *last; + Edje_File *edf; - last = eina_list_last(_edje_file_cache); - edf = eina_list_data_get(last); - _edje_file_cache = eina_list_remove_list(_edje_file_cache, last); - _edje_file_free(edf); - count = eina_list_count(_edje_file_cache); + last = eina_list_last(_edje_file_cache); + edf = eina_list_data_get(last); + _edje_file_cache = eina_list_remove_list(_edje_file_cache, last); + _edje_file_free(edf); + count = eina_list_count(_edje_file_cache); } } @@ -589,15 +589,15 @@ _edje_cache_file_unref(Edje_File *edf) if (edf->dangling) { - _edje_file_free(edf); - return; + _edje_file_free(edf); + return; } eina_hash_del(_edje_file_hash, &edf->f, edf); if (!eina_hash_population(_edje_file_hash)) { - eina_hash_free(_edje_file_hash); - _edje_file_hash = NULL; + eina_hash_free(_edje_file_hash); + _edje_file_hash = NULL; } _edje_file_cache = eina_list_prepend(_edje_file_cache, edf); _edje_cache_file_clean(); @@ -609,15 +609,13 @@ _edje_file_cache_shutdown(void) edje_file_cache_flush(); } +/*============================================================================* +* Global * +*============================================================================*/ /*============================================================================* - * Global * - *============================================================================*/ - -/*============================================================================* - * API * - *============================================================================*/ - +* API * +*============================================================================*/ EAPI void edje_file_cache_set(int count) @@ -627,14 +625,12 @@ edje_file_cache_set(int count) _edje_cache_file_clean(); } - EAPI int edje_file_cache_get(void) { return _edje_file_cache_size; } - EAPI void edje_file_cache_flush(void) { @@ -646,7 +642,6 @@ edje_file_cache_flush(void) _edje_file_cache_size = ps; } - EAPI void edje_collection_cache_set(int count) { @@ -660,14 +655,12 @@ edje_collection_cache_set(int count) /* FIXME: freach in file hash too! */ } - EAPI int edje_collection_cache_get(void) { return _edje_collection_cache_size; } - EAPI void edje_collection_cache_flush(void) { @@ -682,3 +675,4 @@ edje_collection_cache_flush(void) /* FIXME: freach in file hash too! */ _edje_collection_cache_size = ps; } + diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c old mode 100755 new mode 100644 index 3d75e24eda..f6627152ed --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -1,28 +1,28 @@ #include "edje_private.h" -static void _edje_part_make_rtl(Edje_Part_Description_Common *desc); +static void _edje_part_make_rtl(Edje_Part_Description_Common *desc); static Edje_Part_Description_Common *_edje_get_description_by_orientation(Edje *ed, Edje_Part_Description_Common *src, Edje_Part_Description_Common **dst, unsigned char type); -static void _edje_part_recalc_single(Edje *ed, Edje_Real_Part *ep, - Edje_Part_Description_Common *desc, Edje_Part_Description_Common *chosen_desc, - Edje_Real_Part *center, Edje_Real_Part *light, Edje_Real_Part *persp, - Edje_Real_Part *rel1_to_x, Edje_Real_Part *rel1_to_y, - Edje_Real_Part *rel2_to_x, Edje_Real_Part *rel2_to_y, - Edje_Real_Part *confine_to, Edje_Real_Part *threshold, - Edje_Calc_Params *params, - Evas_Coord mmw, Evas_Coord mmh, - FLOAT_T pos); +static void _edje_part_recalc_single(Edje *ed, Edje_Real_Part *ep, + Edje_Part_Description_Common *desc, Edje_Part_Description_Common *chosen_desc, + Edje_Real_Part *center, Edje_Real_Part *light, Edje_Real_Part *persp, + Edje_Real_Part *rel1_to_x, Edje_Real_Part *rel1_to_y, + Edje_Real_Part *rel2_to_x, Edje_Real_Part *rel2_to_y, + Edje_Real_Part *confine_to, Edje_Real_Part *threshold, + Edje_Calc_Params *params, + Evas_Coord mmw, Evas_Coord mmh, + FLOAT_T pos); -#define EINA_COW_CALC_PHYSICS_BEGIN(Calc, Write) \ +#define EINA_COW_CALC_PHYSICS_BEGIN(Calc, Write) \ EINA_COW_WRITE_BEGIN(_edje_calc_params_physics_cow, Calc->physics, Edje_Calc_Params_Physics, Write) -#define EINA_COW_CALC_PHYSICS_END(Calc, Write) \ +#define EINA_COW_CALC_PHYSICS_END(Calc, Write) \ EINA_COW_WRITE_END(_edje_calc_params_physics_cow, Calc->physics, Write) -#define EINA_COW_CALC_MAP_BEGIN(Calc, Write) \ +#define EINA_COW_CALC_MAP_BEGIN(Calc, Write) \ EINA_COW_WRITE_BEGIN(_edje_calc_params_map_cow, Calc->map, Edje_Calc_Params_Map, Write) -#define EINA_COW_CALC_MAP_END(Calc, Write) \ +#define EINA_COW_CALC_MAP_END(Calc, Write) \ EINA_COW_WRITE_END(_edje_calc_params_map_cow, Calc->map, Write); void @@ -37,33 +37,37 @@ _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos, FLOAT_T fp_pos = pos; #if 0 // old code - easy to enable for comparing float vs fixed point - /* take linear pos along timescale and use interpolation method */ + /* take linear pos along timescale and use interpolation method */ switch (mode) { case EDJE_TWEEN_MODE_SINUSOIDAL: - /* npos = (1.0 - cos(pos * PI)) / 2.0; */ - npos = DIV2(SUB(FROM_INT(1), - COS(MUL(fp_pos, - PI)))); - break; + /* npos = (1.0 - cos(pos * PI)) / 2.0; */ + npos = DIV2(SUB(FROM_INT(1), + COS(MUL(fp_pos, + PI)))); + break; + case EDJE_TWEEN_MODE_ACCELERATE: - /* npos = 1.0 - sin((PI / 2.0) + (pos * PI / 2.0)); */ - npos = SUB(FROM_INT(1), - SIN(ADD(DIV2(PI), - MUL(fp_pos, - DIV2(PI))))); - break; + /* npos = 1.0 - sin((PI / 2.0) + (pos * PI / 2.0)); */ + npos = SUB(FROM_INT(1), + SIN(ADD(DIV2(PI), + MUL(fp_pos, + DIV2(PI))))); + break; + case EDJE_TWEEN_MODE_DECELERATE: - /* npos = sin(pos * PI / 2.0); */ - npos = SIN(MUL(fp_pos, - DIV2(PI))); - break; + /* npos = sin(pos * PI / 2.0); */ + npos = SIN(MUL(fp_pos, + DIV2(PI))); + break; + case EDJE_TWEEN_MODE_LINEAR: - npos = fp_pos; - break; + npos = fp_pos; + break; + default: - npos = fp_pos; - break; + npos = fp_pos; + break; } #else switch (mode & EDJE_TWEEN_MODE_MASK) @@ -73,53 +77,63 @@ _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos, FLOAT_T ECORE_POS_MAP_SINUSOIDAL, 0.0, 0.0)); break; + case EDJE_TWEEN_MODE_ACCELERATE: npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), ECORE_POS_MAP_ACCELERATE, 0.0, 0.0)); break; + case EDJE_TWEEN_MODE_DECELERATE: npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), ECORE_POS_MAP_DECELERATE, 0.0, 0.0)); break; + case EDJE_TWEEN_MODE_LINEAR: npos = fp_pos; /* npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), - ECORE_POS_MAP_LINEAR, + ECORE_POS_MAP_LINEAR, 0.0, 0.0)); */ break; + case EDJE_TWEEN_MODE_ACCELERATE_FACTOR: npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), ECORE_POS_MAP_ACCELERATE_FACTOR, TO_DOUBLE(v1), 0.0)); break; + case EDJE_TWEEN_MODE_DECELERATE_FACTOR: npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), ECORE_POS_MAP_DECELERATE_FACTOR, TO_DOUBLE(v1), 0.0)); break; + case EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR: npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), ECORE_POS_MAP_SINUSOIDAL_FACTOR, TO_DOUBLE(v1), 0.0)); break; + case EDJE_TWEEN_MODE_DIVISOR_INTERP: npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), ECORE_POS_MAP_DIVISOR_INTERP, TO_DOUBLE(v1), TO_DOUBLE(v2))); break; + case EDJE_TWEEN_MODE_BOUNCE: npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), ECORE_POS_MAP_BOUNCE, TO_DOUBLE(v1), TO_DOUBLE(v2))); break; + case EDJE_TWEEN_MODE_SPRING: npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), ECORE_POS_MAP_SPRING, TO_DOUBLE(v1), TO_DOUBLE(v2))); break; + case EDJE_TWEEN_MODE_CUBIC_BEZIER: v[0] = TO_DOUBLE(v1); v[1] = TO_DOUBLE(v2); @@ -130,6 +144,7 @@ _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos, FLOAT_T ECORE_POS_MAP_CUBIC_BEZIER, 4, v)); break; + default: npos = fp_pos; break; @@ -146,7 +161,6 @@ _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos, FLOAT_T #endif } - /** * Returns part description * @@ -163,7 +177,7 @@ _edje_part_make_rtl(Edje_Part_Description_Common *desc) double t; int i; - if(!desc) + if (!desc) return; /* This makes alignment right-oriented */ @@ -216,62 +230,65 @@ _edje_get_description_by_orientation(Edje *ed, Edje_Part_Description_Common *src size_t memsize = 0; /* RTL flag is not set, return original description */ - if(!edje_object_mirrored_get(ed->obj)) - return src; + if (!edje_object_mirrored_get(ed->obj)) + return src; - if(*dst) - return *dst; /* Was allocated before and we should use it */ + if (*dst) + return *dst; /* Was allocated before and we should use it */ -#define EDIT_ALLOC_POOL_RTL(Short, Type, Name) \ - case EDJE_PART_TYPE_##Short: \ - { \ - Edje_Part_Description_##Type *Name; \ - Name = eina_mempool_malloc(ce->mp_rtl.Short, \ - sizeof (Edje_Part_Description_##Type)); \ - desc_rtl = &Name->common; \ - memsize = sizeof(Edje_Part_Description_##Type); \ - break; \ - } +#define EDIT_ALLOC_POOL_RTL(Short, Type, Name) \ +case EDJE_PART_TYPE_##Short: \ +{ \ + Edje_Part_Description_##Type * Name; \ + Name = eina_mempool_malloc(ce->mp_rtl.Short, \ + sizeof (Edje_Part_Description_##Type)); \ + desc_rtl = &Name->common; \ + memsize = sizeof(Edje_Part_Description_##Type); \ + break; \ +} ce = eina_hash_find(ed->file->collection, ed->group); switch (type) { case EDJE_PART_TYPE_RECTANGLE: - desc_rtl = eina_mempool_malloc(ce->mp_rtl.RECTANGLE, - sizeof (Edje_Part_Description_Common)); - ce->count.RECTANGLE++; - memsize = sizeof(Edje_Part_Description_Common); - break; + desc_rtl = eina_mempool_malloc(ce->mp_rtl.RECTANGLE, + sizeof (Edje_Part_Description_Common)); + ce->count.RECTANGLE++; + memsize = sizeof(Edje_Part_Description_Common); + break; + case EDJE_PART_TYPE_SWALLOW: - desc_rtl = eina_mempool_malloc(ce->mp_rtl.SWALLOW, - sizeof (Edje_Part_Description_Common)); - ce->count.SWALLOW++; - memsize = sizeof(Edje_Part_Description_Common); - break; + desc_rtl = eina_mempool_malloc(ce->mp_rtl.SWALLOW, + sizeof (Edje_Part_Description_Common)); + ce->count.SWALLOW++; + memsize = sizeof(Edje_Part_Description_Common); + break; + case EDJE_PART_TYPE_GROUP: - desc_rtl = eina_mempool_malloc(ce->mp_rtl.GROUP, - sizeof (Edje_Part_Description_Common)); - ce->count.GROUP++; - memsize = sizeof(Edje_Part_Description_Common); - break; - case EDJE_PART_TYPE_SPACER: - desc_rtl = eina_mempool_malloc(ce->mp_rtl.SPACER, - sizeof (Edje_Part_Description_Common)); - ce->count.SPACER++; - memsize = sizeof(Edje_Part_Description_Common); - break; - EDIT_ALLOC_POOL_RTL(TEXT, Text, text); - EDIT_ALLOC_POOL_RTL(TEXTBLOCK, Text, text); - EDIT_ALLOC_POOL_RTL(IMAGE, Image, image); - EDIT_ALLOC_POOL_RTL(PROXY, Proxy, proxy); - EDIT_ALLOC_POOL_RTL(BOX, Box, box); - EDIT_ALLOC_POOL_RTL(TABLE, Table, table); - EDIT_ALLOC_POOL_RTL(EXTERNAL, External, external_params); + desc_rtl = eina_mempool_malloc(ce->mp_rtl.GROUP, + sizeof (Edje_Part_Description_Common)); + ce->count.GROUP++; + memsize = sizeof(Edje_Part_Description_Common); + break; + + case EDJE_PART_TYPE_SPACER: + desc_rtl = eina_mempool_malloc(ce->mp_rtl.SPACER, + sizeof (Edje_Part_Description_Common)); + ce->count.SPACER++; + memsize = sizeof(Edje_Part_Description_Common); + break; + EDIT_ALLOC_POOL_RTL(TEXT, Text, text); + EDIT_ALLOC_POOL_RTL(TEXTBLOCK, Text, text); + EDIT_ALLOC_POOL_RTL(IMAGE, Image, image); + EDIT_ALLOC_POOL_RTL(PROXY, Proxy, proxy); + EDIT_ALLOC_POOL_RTL(BOX, Box, box); + EDIT_ALLOC_POOL_RTL(TABLE, Table, table); + EDIT_ALLOC_POOL_RTL(EXTERNAL, External, external_params); } if (desc_rtl) - memcpy(desc_rtl, src, memsize); + memcpy(desc_rtl, src, memsize); _edje_part_make_rtl(desc_rtl); @@ -291,20 +308,20 @@ _edje_part_description_find(Edje *ed, Edje_Real_Part *rp, const char *state_name unsigned int i; /* RTL flag is set, return RTL description */ - if(edje_object_mirrored_get(ed->obj)) - if(!ep->other.desc_rtl) + if (edje_object_mirrored_get(ed->obj)) + if (!ep->other.desc_rtl) ep->other.desc_rtl = (Edje_Part_Description_Common **) - calloc(ep->other.desc_count, + calloc(ep->other.desc_count, sizeof (Edje_Part_Description_Common *)); if (!strcmp(state_name, "default") && state_val == 0.0) return _edje_get_description_by_orientation(ed, - ep->default_desc, &ep->default_desc_rtl, ep->type); + ep->default_desc, &ep->default_desc_rtl, ep->type); if (!strcmp(state_name, "custom")) return rp->custom ? - _edje_get_description_by_orientation(ed, rp->custom->description, - &rp->custom->description_rtl, ep->type) : NULL; + _edje_get_description_by_orientation(ed, rp->custom->description, + &rp->custom->description_rtl, ep->type) : NULL; if (!strcmp(state_name, "default") && approximate) { @@ -349,31 +366,31 @@ _edje_part_description_find(Edje *ed, Edje_Real_Part *rp, const char *state_name } static int -_edje_image_find(Evas_Object *obj, Edje *ed, Edje_Real_Part_Set **eps, +_edje_image_find(Evas_Object *obj, Edje *ed, Edje_Real_Part_Set **eps, Edje_Part_Description_Image *st, Edje_Part_Image_Id *imid) { Edje_Image_Directory_Set_Entry *entry; Edje_Image_Directory_Set *set = NULL; Eina_List *l; int w = 0, h = 0, id; - - if (!st && !imid) return -1; + + if (!st && !imid) return -1; if (st && !st->image.set) return st->image.id; - if (imid && !imid->set) return imid->id; - + if (imid && !imid->set) return imid->id; + if (imid) id = imid->id; - else id = st->image.id; - + else id = st->image.id; + evas_object_geometry_get(obj, NULL, NULL, &w, &h); if (eps && *eps) { if ((*eps)->id == id) set = (*eps)->set; if (set) { - if (((*eps)->entry->size.min.w <= w) && + if (((*eps)->entry->size.min.w <= w) && (w <= (*eps)->entry->size.max.w)) { - if (((*eps)->entry->size.min.h <= h) && + if (((*eps)->entry->size.min.h <= h) && (h <= (*eps)->entry->size.max.h)) { return (*eps)->entry->id; @@ -381,9 +398,9 @@ _edje_image_find(Evas_Object *obj, Edje *ed, Edje_Real_Part_Set **eps, } } } - + if (!set) set = ed->file->image_dir->sets + id; - + EINA_LIST_FOREACH(set->entries, l, entry) { if ((entry->size.min.w <= w) && (w <= entry->size.max.w)) @@ -404,23 +421,23 @@ _edje_image_find(Evas_Object *obj, Edje *ed, Edje_Real_Part_Set **eps, } } } - - entry = eina_list_data_get(set->entries); - if (entry) - { - if (eps) - { - if (!*eps) - *eps = calloc(1, sizeof (Edje_Real_Part_Set)); - if (*eps) - { - (*eps)->entry = entry; - (*eps)->set = set; - (*eps)->id = id; - } - } - return entry->id; - } + + entry = eina_list_data_get(set->entries); + if (entry) + { + if (eps) + { + if (!*eps) + *eps = calloc(1, sizeof (Edje_Real_Part_Set)); + if (*eps) + { + (*eps)->entry = entry; + (*eps)->set = set; + (*eps)->id = id; + } + } + return entry->id; + } return -1; } @@ -433,7 +450,7 @@ _edje_real_part_image_set(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part_Set **set image_id = _edje_image_find(ep->object, ed, &ep->param1.set, - (Edje_Part_Description_Image*) ep->param1.description, + (Edje_Part_Description_Image *)ep->param1.description, NULL); if (set) *set = ep->param1.set; if (image_id < 0) @@ -453,7 +470,7 @@ _edje_real_part_image_set(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part_Set **set { image_count = 2; if (ep->param2) - image_count += ((Edje_Part_Description_Image*) ep->param2->description)->image.tweens_count; + image_count += ((Edje_Part_Description_Image *)ep->param2->description)->image.tweens_count; image_num = TO_INT(MUL(pos, SUB(FROM_INT(image_count), FROM_DOUBLE(0.5)))); if (image_num > (image_count - 1)) @@ -462,30 +479,30 @@ _edje_real_part_image_set(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part_Set **set { image_id = _edje_image_find(ep->object, ed, &ep->param1.set, - (Edje_Part_Description_Image*) ep->param1.description, + (Edje_Part_Description_Image *)ep->param1.description, NULL); if (set) *set = ep->param1.set; } else - if (ep->param2) - { - if (image_num == (image_count - 1)) - { - image_id = _edje_image_find(ep->object, ed, - &ep->param2->set, - (Edje_Part_Description_Image*) ep->param2->description, - NULL); - if (set) *set = ep->param2->set; - } - else - { - Edje_Part_Image_Id *imid; + if (ep->param2) + { + if (image_num == (image_count - 1)) + { + image_id = _edje_image_find(ep->object, ed, + &ep->param2->set, + (Edje_Part_Description_Image *)ep->param2->description, + NULL); + if (set) *set = ep->param2->set; + } + else + { + Edje_Part_Image_Id *imid; - imid = ((Edje_Part_Description_Image*) ep->param2->description)->image.tweens[image_num - 1]; - image_id = _edje_image_find(ep->object, ed, NULL, NULL, imid); - if (set) *set = NULL; - } - } + imid = ((Edje_Part_Description_Image *)ep->param2->description)->image.tweens[image_num - 1]; + image_id = _edje_image_find(ep->object, ed, NULL, NULL, imid); + if (set) *set = NULL; + } + } if (image_id < 0) { ERR("¨Part \"%s\" description, " @@ -512,26 +529,32 @@ _edje_real_part_image_set(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part_Set **set switch (evas_object_image_load_error_get(ep->object)) { case EVAS_LOAD_ERROR_GENERIC: - ERR("Error type: EVAS_LOAD_ERROR_GENERIC"); - break; + ERR("Error type: EVAS_LOAD_ERROR_GENERIC"); + break; + case EVAS_LOAD_ERROR_DOES_NOT_EXIST: - ERR("Error type: EVAS_LOAD_ERROR_DOES_NOT_EXIST"); - break; + ERR("Error type: EVAS_LOAD_ERROR_DOES_NOT_EXIST"); + break; + case EVAS_LOAD_ERROR_PERMISSION_DENIED: - ERR("Error type: EVAS_LOAD_ERROR_PERMISSION_DENIED"); - break; + ERR("Error type: EVAS_LOAD_ERROR_PERMISSION_DENIED"); + break; + case EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED: - ERR("Error type: EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED"); - break; + ERR("Error type: EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED"); + break; + case EVAS_LOAD_ERROR_CORRUPT_FILE: - ERR("Error type: EVAS_LOAD_ERROR_CORRUPT_FILE"); - break; + ERR("Error type: EVAS_LOAD_ERROR_CORRUPT_FILE"); + break; + case EVAS_LOAD_ERROR_UNKNOWN_FORMAT: - ERR("Error type: EVAS_LOAD_ERROR_UNKNOWN_FORMAT"); - break; + ERR("Error type: EVAS_LOAD_ERROR_UNKNOWN_FORMAT"); + break; + default: - ERR("Error type: ???"); - break; + ERR("Error type: ???"); + break; } } } @@ -540,8 +563,8 @@ _edje_real_part_image_set(Edje *ed, Edje_Real_Part *ep, Edje_Real_Part_Set **set static void _edje_real_part_rel_to_apply(Edje *ed EINA_UNUSED, - Edje_Real_Part *ep, - Edje_Real_Part_State *state) + Edje_Real_Part *ep, + Edje_Real_Part_State *state) { if (state->description) { @@ -551,9 +574,9 @@ _edje_real_part_rel_to_apply(Edje *ed EINA_UNUSED, if ((ep->type != EDJE_RP_TYPE_SWALLOW) || (!ep->typedata.swallow)) return; - - external = (Edje_Part_Description_External*)state->description; - + + external = (Edje_Part_Description_External *)state->description; + if (state->external_params) _edje_external_parsed_params_free(ep->typedata.swallow->swallowed_object, state->external_params); state->external_params = _edje_external_params_parse(ep->typedata.swallow->swallowed_object, external->external_params); @@ -574,12 +597,12 @@ _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, doubl epd1 = _edje_part_description_find(ed, ep, d1, v1, EINA_TRUE); if (!epd1) - epd1 = ep->part->default_desc; /* never NULL */ + epd1 = ep->part->default_desc; /* never NULL */ if (d2) epd2 = _edje_part_description_find(ed, ep, d2, v2, EINA_TRUE); - epdi = (Edje_Part_Description_Image*) epd2; + epdi = (Edje_Part_Description_Image *)epd2; /* There is an animation if both description are different or if description is an image with tweens */ if (epd2 && (epd1 != epd2 || (ep->part->type == EDJE_PART_TYPE_IMAGE && epdi->image.tweens_count))) { @@ -588,9 +611,9 @@ _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, doubl ep->param2 = eina_mempool_malloc(_edje_real_part_state_mp, sizeof(Edje_Real_Part_State)); memset(ep->param2, 0, sizeof(Edje_Real_Part_State)); - ep->param2->p.map = eina_cow_alloc(_edje_calc_params_map_cow); + ep->param2->p.map = eina_cow_alloc(_edje_calc_params_map_cow); #ifdef HAVE_EPHYSICS - ep->param2->p.physics = eina_cow_alloc(_edje_calc_params_physics_cow); + ep->param2->p.physics = eina_cow_alloc(_edje_calc_params_physics_cow); #endif } else if (ep->part->type == EDJE_PART_TYPE_EXTERNAL) @@ -603,26 +626,26 @@ _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, doubl ep->param2->external_params = NULL; } else - if (ep->param2) - { - if (ep->part->type == EDJE_PART_TYPE_EXTERNAL) - { - if ((ep->type == EDJE_RP_TYPE_SWALLOW) && - (ep->typedata.swallow)) - _edje_external_parsed_params_free(ep->typedata.swallow->swallowed_object, - ep->param2->external_params); - } - if (ep->param2) - { - free(ep->param2->set); - eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **) &ep->param2->p.map); + if (ep->param2) + { + if (ep->part->type == EDJE_PART_TYPE_EXTERNAL) + { + if ((ep->type == EDJE_RP_TYPE_SWALLOW) && + (ep->typedata.swallow)) + _edje_external_parsed_params_free(ep->typedata.swallow->swallowed_object, + ep->param2->external_params); + } + if (ep->param2) + { + free(ep->param2->set); + eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **)&ep->param2->p.map); #ifdef HAVE_EPHYSICS - eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **) &ep->param2->p.physics); + eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&ep->param2->p.physics); #endif - } - eina_mempool_free(_edje_real_part_state_mp, ep->param2); - ep->param2 = NULL; - } + } + eina_mempool_free(_edje_real_part_state_mp, ep->param2); + ep->param2 = NULL; + } last_desc = ep->chosen_description; ep->param1.description = epd1; @@ -657,8 +680,8 @@ _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, doubl pmin = &last_desc->min; pmax = &last_desc->max; if (change_w || change_h || - (((pmin->w == pmax->w) && (pmin->h == pmax->h) && (pmin->w > 0) && (pmin->h > 0)) && - (((min->w != max->w) || (min->h != max->h) || (min->w <= 0) || (min->h <= 0))))) + (((pmin->w == pmax->w) && (pmin->h == pmax->h) && (pmin->w > 0) && (pmin->h > 0)) && + (((min->w != max->w) || (min->h != max->h) || (min->w <= 0) || (min->h <= 0))))) { Edje *ted; @@ -700,7 +723,7 @@ _edje_recalc(Edje *ed) // XXX: dont need this with current smart calc infra. remove me later // if (ed->postponed) return; // if (!ed->calc_only) - evas_object_smart_changed(ed->obj); + evas_object_smart_changed(ed->obj); // XXX: dont need this with current smart calc infra. remove me later // ed->postponed = EINA_TRUE; } @@ -754,8 +777,8 @@ _edje_recalc_do(Edje *ed) ed->recalc_hints = EINA_FALSE; - eo_do(ed->obj, edje_obj_size_min_calc(&w, &h)); - eo_do(ed->obj, evas_obj_size_hint_min_set(w, h)); + eo_do(ed->obj, edje_obj_size_min_calc(&w, &h)); + eo_do(ed->obj, evas_obj_size_hint_min_set(w, h)); } if (!ed->collection) return; @@ -772,17 +795,20 @@ _edje_recalc_do(Edje *ed) switch (limit) { case 0: - ed->collection->limits.parts[i].width = EDJE_PART_LIMIT_UNKNOWN; - ed->collection->limits.parts[i].height = EDJE_PART_LIMIT_UNKNOWN; - break; + ed->collection->limits.parts[i].width = EDJE_PART_LIMIT_UNKNOWN; + ed->collection->limits.parts[i].height = EDJE_PART_LIMIT_UNKNOWN; + break; + case 1: - ed->collection->limits.parts[i].height = EDJE_PART_LIMIT_UNKNOWN; - break; + ed->collection->limits.parts[i].height = EDJE_PART_LIMIT_UNKNOWN; + break; + case 2: - ed->collection->limits.parts[i].width = EDJE_PART_LIMIT_UNKNOWN; - break; + ed->collection->limits.parts[i].width = EDJE_PART_LIMIT_UNKNOWN; + break; + case 3: - break; + break; } if ((limit & 1) == 1) @@ -850,9 +876,11 @@ _edje_part_dragable_calc(Edje *ed EINA_UNUSED, Edje_Real_Part *ep, FLOAT_T *x, F int ret = 0; if ((ep->part->dragable.x != 0) && - (ep->part->dragable.y != 0 )) ret = 3; - else if (ep->part->dragable.x != 0) ret = 1; - else if (ep->part->dragable.y != 0) ret = 2; + (ep->part->dragable.y != 0)) ret = 3; + else if (ep->part->dragable.x != 0) + ret = 1; + else if (ep->part->dragable.y != 0) + ret = 2; dx = FROM_INT(ep->x - ep->drag->confine_to->x); dw = FROM_INT(ep->drag->confine_to->w - ep->w); @@ -1004,8 +1032,8 @@ _edje_part_recalc_single_aspect(Edje *ed, if ((ep->typedata.swallow->swallow_params.aspect.w > 0) && (ep->typedata.swallow->swallow_params.aspect.h > 0)) amin = amax = - DIV(FROM_INT(ep->typedata.swallow->swallow_params.aspect.w), - FROM_INT(ep->typedata.swallow->swallow_params.aspect.h)); + DIV(FROM_INT(ep->typedata.swallow->swallow_params.aspect.w), + FROM_INT(ep->typedata.swallow->swallow_params.aspect.h)); } want_x = params->eval.x; want_w = new_w = params->eval.w; @@ -1026,15 +1054,19 @@ _edje_part_recalc_single_aspect(Edje *ed, case EDJE_ASPECT_CONTROL_NEITHER: apref = EDJE_ASPECT_PREFER_NONE; break; + case EDJE_ASPECT_CONTROL_HORIZONTAL: apref = EDJE_ASPECT_PREFER_HORIZONTAL; break; + case EDJE_ASPECT_CONTROL_VERTICAL: apref = EDJE_ASPECT_PREFER_VERTICAL; break; + case EDJE_ASPECT_CONTROL_BOTH: apref = EDJE_ASPECT_PREFER_BOTH; break; + default: break; } @@ -1043,68 +1075,72 @@ _edje_part_recalc_single_aspect(Edje *ed, switch (apref) { case EDJE_ASPECT_PREFER_NONE: - /* keep both dimensions in check */ - /* adjust for min aspect (width / height) */ - if ((amin > ZERO) && (aspect < amin)) - { - new_h = DIV(params->eval.w, amin); - new_w = MUL(amin, params->eval.h); - } - /* adjust for max aspect (width / height) */ - if ((amax > ZERO) && (aspect > amax)) - { - new_h = DIV(params->eval.w, amax); - new_w = MUL(amax, params->eval.h); - } - if ((amax > ZERO) && (new_w < params->eval.w)) - { - new_w = params->eval.w; - new_h = DIV(params->eval.w, amax); - } - if ((amax > ZERO) && (new_h < params->eval.h)) - { - new_w = MUL(amax, params->eval.h); - new_h = params->eval.h; - } - break; - /* prefer vertical size as determiner */ + /* keep both dimensions in check */ + /* adjust for min aspect (width / height) */ + if ((amin > ZERO) && (aspect < amin)) + { + new_h = DIV(params->eval.w, amin); + new_w = MUL(amin, params->eval.h); + } + /* adjust for max aspect (width / height) */ + if ((amax > ZERO) && (aspect > amax)) + { + new_h = DIV(params->eval.w, amax); + new_w = MUL(amax, params->eval.h); + } + if ((amax > ZERO) && (new_w < params->eval.w)) + { + new_w = params->eval.w; + new_h = DIV(params->eval.w, amax); + } + if ((amax > ZERO) && (new_h < params->eval.h)) + { + new_w = MUL(amax, params->eval.h); + new_h = params->eval.h; + } + break; + + /* prefer vertical size as determiner */ case EDJE_ASPECT_PREFER_VERTICAL: - /* keep both dimensions in check */ - /* adjust for max aspect (width / height) */ - if ((amax > ZERO) && (aspect > amax)) - new_w = MUL(amax, params->eval.h); - /* adjust for min aspect (width / height) */ - if ((amin > ZERO) && (aspect < amin)) - new_w = MUL(amin, params->eval.h); - break; - /* prefer horizontal size as determiner */ + /* keep both dimensions in check */ + /* adjust for max aspect (width / height) */ + if ((amax > ZERO) && (aspect > amax)) + new_w = MUL(amax, params->eval.h); + /* adjust for min aspect (width / height) */ + if ((amin > ZERO) && (aspect < amin)) + new_w = MUL(amin, params->eval.h); + break; + + /* prefer horizontal size as determiner */ case EDJE_ASPECT_PREFER_HORIZONTAL: - /* keep both dimensions in check */ - /* adjust for max aspect (width / height) */ - if ((amax > ZERO) && (aspect > amax)) - new_h = DIV(params->eval.w, amax); - /* adjust for min aspect (width / height) */ - if ((amin > ZERO) && (aspect < amin)) - new_h = DIV(params->eval.w, amin); - break; + /* keep both dimensions in check */ + /* adjust for max aspect (width / height) */ + if ((amax > ZERO) && (aspect > amax)) + new_h = DIV(params->eval.w, amax); + /* adjust for min aspect (width / height) */ + if ((amin > ZERO) && (aspect < amin)) + new_h = DIV(params->eval.w, amin); + break; + case EDJE_ASPECT_PREFER_SOURCE: case EDJE_ASPECT_PREFER_BOTH: - /* keep both dimensions in check */ - /* adjust for max aspect (width / height) */ - if ((amax > ZERO) && (aspect > amax)) - { - new_w = MUL(amax, params->eval.h); - new_h = DIV(params->eval.w, amax); - } - /* adjust for min aspect (width / height) */ - if ((amin > ZERO) && (aspect < amin)) - { - new_w = MUL(amin, params->eval.h); - new_h = DIV(params->eval.w, amin); - } - break; + /* keep both dimensions in check */ + /* adjust for max aspect (width / height) */ + if ((amax > ZERO) && (aspect > amax)) + { + new_w = MUL(amax, params->eval.h); + new_h = DIV(params->eval.w, amax); + } + /* adjust for min aspect (width / height) */ + if ((amin > ZERO) && (aspect < amin)) + { + new_w = MUL(amin, params->eval.h); + new_h = DIV(params->eval.w, amin); + } + break; + default: - break; + break; } if (!((amin > ZERO) && (amax > ZERO) && @@ -1186,8 +1222,8 @@ _edje_part_recalc_single_aspect(Edje *ed, } params->eval.x = ADD(want_x, - MUL(SUB(want_w, params->eval.w), - desc->align.x)); + MUL(SUB(want_w, params->eval.w), + desc->align.x)); params->eval.y = ADD(want_y, MUL(SUB(want_h, params->eval.h), desc->align.y)); @@ -1233,16 +1269,16 @@ _edje_part_recalc_single_textblock_scale_range_adjust(Edje_Part_Description_Text double size, min, max; if (chosen_desc->text.size == 0) - return scale; + return scale; min = base_scale * chosen_desc->text.size_range_min; max = chosen_desc->text.size_range_max * base_scale; size = chosen_desc->text.size * scale; if ((size > max) && (max > 0)) - scale = max / (double) chosen_desc->text.size; + scale = max / (double)chosen_desc->text.size; else if (size < min) - scale = min / (double) chosen_desc->text.size; + scale = min / (double)chosen_desc->text.size; return scale; } @@ -1264,7 +1300,7 @@ _edje_part_recalc_single_textblock(FLOAT_T sc, Evas_Coord tw, th, ins_l, ins_r, ins_t, ins_b; const char *text = ""; const char *style = ""; - Edje_Style *stl = NULL; + Edje_Style *stl = NULL; const char *tmp; Eina_List *l; @@ -1321,29 +1357,29 @@ _edje_part_recalc_single_textblock(FLOAT_T sc, double s = base_s; if (ep->part->scale) base_s = TO_DOUBLE(sc); - eo_do(ep->object, - evas_obj_scale_set(base_s), - evas_obj_textblock_size_native_get(&tw, &th)); + eo_do(ep->object, + evas_obj_scale_set(base_s), + evas_obj_textblock_size_native_get(&tw, &th)); orig_s = base_s; /* Now make it bigger so calculations will be more accurate * and less influenced by hinting... */ - { - orig_s = _edje_part_recalc_single_textblock_scale_range_adjust(chosen_desc, base_s, - orig_s * TO_INT(params->eval.w) / tw); - eo_do(ep->object, - evas_obj_scale_set(orig_s), - evas_obj_textblock_size_native_get(&tw, &th)); - } + { + orig_s = _edje_part_recalc_single_textblock_scale_range_adjust(chosen_desc, base_s, + orig_s * TO_INT(params->eval.w) / tw); + eo_do(ep->object, + evas_obj_scale_set(orig_s), + evas_obj_textblock_size_native_get(&tw, &th)); + } if (chosen_desc->text.fit_x) { if (tw > 0) { s = _edje_part_recalc_single_textblock_scale_range_adjust(chosen_desc, base_s, orig_s * TO_INT(params->eval.w) / tw); - eo_do(ep->object, - evas_obj_scale_set(s), - evas_obj_textblock_size_native_get(NULL, NULL)); + eo_do(ep->object, + evas_obj_scale_set(s), + evas_obj_textblock_size_native_get(NULL, NULL)); } } if (chosen_desc->text.fit_y) @@ -1359,40 +1395,39 @@ _edje_part_recalc_single_textblock(FLOAT_T sc, s = tmp_s; } - eo_do(ep->object, - evas_obj_scale_set(s), - evas_obj_textblock_size_native_get(NULL, NULL)); + eo_do(ep->object, + evas_obj_scale_set(s), + evas_obj_textblock_size_native_get(NULL, NULL)); } } /* Final tuning, try going down 90% at a time, hoping it'll * actually end up being correct. */ - { - int i = 5; /* Tries before we give up. */ - Evas_Coord fw, fh; - eo_do(ep->object, - evas_obj_textblock_size_native_get(&fw, &fh)); + { + int i = 5; /* Tries before we give up. */ + Evas_Coord fw, fh; + eo_do(ep->object, + evas_obj_textblock_size_native_get(&fw, &fh)); - /* If we are still too big, try reducing the size to - * 95% each try. */ - while ((i > 0) && - ((chosen_desc->text.fit_x && (fw > TO_INT(params->eval.w))) || - (chosen_desc->text.fit_y && (fh > TO_INT(params->eval.h))))) - { - double tmp_s = _edje_part_recalc_single_textblock_scale_range_adjust(chosen_desc, base_s, s * 0.95); + /* If we are still too big, try reducing the size to + * 95% each try. */ + while ((i > 0) && + ((chosen_desc->text.fit_x && (fw > TO_INT(params->eval.w))) || + (chosen_desc->text.fit_y && (fh > TO_INT(params->eval.h))))) + { + double tmp_s = _edje_part_recalc_single_textblock_scale_range_adjust(chosen_desc, base_s, s * 0.95); - /* Break if we are not making any progress. */ - if (tmp_s == s) - break; - s = tmp_s; - - eo_do(ep->object, - evas_obj_scale_set(s), - evas_obj_textblock_size_native_get(&fw, &fh)); - i--; - } - } + /* Break if we are not making any progress. */ + if (tmp_s == s) + break; + s = tmp_s; + eo_do(ep->object, + evas_obj_scale_set(s), + evas_obj_textblock_size_native_get(&fw, &fh)); + i--; + } + } } if (stl) @@ -1421,9 +1456,9 @@ _edje_part_recalc_single_textblock(FLOAT_T sc, tw = th = 0; if (!chosen_desc->text.min_x) { - eo_do(ep->object, - efl_gfx_size_set(TO_INT(params->eval.w), TO_INT(params->eval.h)), - evas_obj_textblock_size_formatted_get(&tw, &th)); + eo_do(ep->object, + efl_gfx_size_set(TO_INT(params->eval.w), TO_INT(params->eval.h)), + evas_obj_textblock_size_formatted_get(&tw, &th)); } else evas_object_textblock_size_native_get(ep->object, &tw, &th); @@ -1449,9 +1484,9 @@ _edje_part_recalc_single_textblock(FLOAT_T sc, tw = th = 0; if (!chosen_desc->text.max_x) { - eo_do(ep->object, - efl_gfx_size_set(TO_INT(params->eval.w), TO_INT(params->eval.h)), - evas_obj_textblock_size_formatted_get(&tw, &th)); + eo_do(ep->object, + efl_gfx_size_set(TO_INT(params->eval.w), TO_INT(params->eval.h)), + evas_obj_textblock_size_formatted_get(&tw, &th)); } else evas_object_textblock_size_native_get(ep->object, &tw, &th); @@ -1477,8 +1512,8 @@ _edje_part_recalc_single_textblock(FLOAT_T sc, static void _edje_textblock_recalc_apply(Edje *ed, Edje_Real_Part *ep, - Edje_Calc_Params *params, - Edje_Part_Description_Text *chosen_desc) + Edje_Calc_Params *params, + Edje_Part_Description_Text *chosen_desc) { /* FIXME: this is just an hack. */ FLOAT_T sc; @@ -1487,7 +1522,7 @@ _edje_textblock_recalc_apply(Edje *ed, Edje_Real_Part *ep, if (chosen_desc->text.fit_x || chosen_desc->text.fit_y) { _edje_part_recalc_single_textblock(sc, ed, ep, chosen_desc, params, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL); } } @@ -1523,7 +1558,7 @@ _edje_part_recalc_single_text(FLOAT_T sc EINA_UNUSED, * -- Gustavo Barbieri at 20-Aug-2011 */ { - int mw, mh,size; + int mw, mh, size; char *sfont = NULL; _edje_text_class_font_get(ed, desc, &size, &sfont); @@ -1557,6 +1592,7 @@ _edje_part_recalc_single_text(FLOAT_T sc EINA_UNUSED, if (mh > *minh) *minh = mh; } } + #else { char *sfont = NULL; @@ -1662,27 +1698,27 @@ _edje_part_recalc_single_text(FLOAT_T sc EINA_UNUSED, { int mw, mh; Evas_Text_Style_Type - style = EVAS_TEXT_STYLE_PLAIN, - shadow = EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT; + style = EVAS_TEXT_STYLE_PLAIN, + shadow = EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT; const Evas_Text_Style_Type styles[] = { - EVAS_TEXT_STYLE_PLAIN, - EVAS_TEXT_STYLE_PLAIN, - EVAS_TEXT_STYLE_OUTLINE, - EVAS_TEXT_STYLE_SOFT_OUTLINE, - EVAS_TEXT_STYLE_SHADOW, - EVAS_TEXT_STYLE_SOFT_SHADOW, - EVAS_TEXT_STYLE_OUTLINE_SHADOW, - EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW, - EVAS_TEXT_STYLE_FAR_SHADOW, - EVAS_TEXT_STYLE_FAR_SOFT_SHADOW, - EVAS_TEXT_STYLE_GLOW + EVAS_TEXT_STYLE_PLAIN, + EVAS_TEXT_STYLE_PLAIN, + EVAS_TEXT_STYLE_OUTLINE, + EVAS_TEXT_STYLE_SOFT_OUTLINE, + EVAS_TEXT_STYLE_SHADOW, + EVAS_TEXT_STYLE_SOFT_SHADOW, + EVAS_TEXT_STYLE_OUTLINE_SHADOW, + EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW, + EVAS_TEXT_STYLE_FAR_SHADOW, + EVAS_TEXT_STYLE_FAR_SOFT_SHADOW, + EVAS_TEXT_STYLE_GLOW }; const Evas_Text_Style_Type shadows[] = { - EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT, - EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM, - EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT, - EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT, - EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT, + EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT, + EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM, + EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT, + EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT, + EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT, EVAS_TEXT_STYLE_SHADOW_DIRECTION_RIGHT @@ -1692,13 +1728,13 @@ _edje_part_recalc_single_text(FLOAT_T sc EINA_UNUSED, < EDJE_TEXT_EFFECT_LAST) style = styles[ep->part->effect]; shadow = shadows - [(ep->part->effect & EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION) >> 4]; + [(ep->part->effect & EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION) >> 4]; EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(style, shadow); - eo_do(ep->object, - evas_obj_text_style_set(style), - evas_obj_text_set(text), - efl_gfx_size_get(&tw, &th)); + eo_do(ep->object, + evas_obj_text_style_set(style), + evas_obj_text_set(text), + efl_gfx_size_get(&tw, &th)); if (chosen_desc->text.max_x) { int l, r; @@ -1768,38 +1804,41 @@ _edje_part_recalc_single_min(Edje_Part_Description_Common *desc, switch (aspect) { case EDJE_ASPECT_PREFER_NONE: - break; + break; + case EDJE_ASPECT_PREFER_VERTICAL: - tmp = DIV(SCALE(params->eval.w, minh), h); - if (tmp >= FROM_INT(minw)) - { - minw = TO_INT(tmp); - break; - } + tmp = DIV(SCALE(params->eval.w, minh), h); + if (tmp >= FROM_INT(minw)) + { + minw = TO_INT(tmp); + break; + } + case EDJE_ASPECT_PREFER_HORIZONTAL: - tmp = DIV(SCALE(params->eval.h, minw), w); - if (tmp >= FROM_INT(minh)) - { - minh = TO_INT(tmp); - break; - } + tmp = DIV(SCALE(params->eval.h, minw), w); + if (tmp >= FROM_INT(minh)) + { + minh = TO_INT(tmp); + break; + } + case EDJE_ASPECT_PREFER_SOURCE: case EDJE_ASPECT_PREFER_BOTH: - tmp = DIV(SCALE(params->eval.w, minh), h); - if (tmp >= FROM_INT(minw)) - { - minw = TO_INT(tmp); - break; - } + tmp = DIV(SCALE(params->eval.w, minh), h); + if (tmp >= FROM_INT(minw)) + { + minw = TO_INT(tmp); + break; + } - tmp = DIV(SCALE(params->eval.h, minw), w); - if (tmp >= FROM_INT(minh)) - { - minh = TO_INT(tmp); - break; - } + tmp = DIV(SCALE(params->eval.h, minw), w); + if (tmp >= FROM_INT(minh)) + { + minh = TO_INT(tmp); + break; + } - break; + break; } _edje_part_recalc_single_min_length(desc->align.x, ¶ms->eval.x, ¶ms->eval.w, minw); @@ -1813,7 +1852,7 @@ _edje_part_recalc_single_max_length(FLOAT_T align, FLOAT_T *start, FLOAT_T *leng { if (*length > max) { - *start = ADD(*start, SCALE(align, (*length - max))); + *start = ADD(*start, SCALE(align, (*length - max))); *length = max; } } @@ -1835,38 +1874,41 @@ _edje_part_recalc_single_max(Edje_Part_Description_Common *desc, switch (aspect) { case EDJE_ASPECT_PREFER_NONE: - break; + break; + case EDJE_ASPECT_PREFER_VERTICAL: - tmp = DIV(SCALE(params->eval.w, maxh), h); - if (tmp <= FROM_INT(maxw)) - { - maxw = TO_INT(tmp); - break; - } + tmp = DIV(SCALE(params->eval.w, maxh), h); + if (tmp <= FROM_INT(maxw)) + { + maxw = TO_INT(tmp); + break; + } + case EDJE_ASPECT_PREFER_HORIZONTAL: - tmp = DIV(SCALE(params->eval.h, maxw), w); - if (tmp <= FROM_INT(maxh)) - { - maxh = TO_INT(tmp); - break; - } + tmp = DIV(SCALE(params->eval.h, maxw), w); + if (tmp <= FROM_INT(maxh)) + { + maxh = TO_INT(tmp); + break; + } + case EDJE_ASPECT_PREFER_SOURCE: case EDJE_ASPECT_PREFER_BOTH: - tmp = DIV(SCALE(params->eval.w, maxh), h); - if (tmp <= FROM_INT(maxw)) - { - maxw = TO_INT(tmp); - break; - } + tmp = DIV(SCALE(params->eval.w, maxh), h); + if (tmp <= FROM_INT(maxw)) + { + maxw = TO_INT(tmp); + break; + } - tmp = DIV(SCALE(params->eval.h, maxw), w); - if (tmp <= FROM_INT(maxh)) - { - maxh = TO_INT(tmp); - break; - } + tmp = DIV(SCALE(params->eval.h, maxw), w); + if (tmp <= FROM_INT(maxh)) + { + maxh = TO_INT(tmp); + break; + } - break; + break; } _edje_part_recalc_single_max_length(desc->align.x, ¶ms->eval.x, ¶ms->eval.w, maxw); @@ -1875,7 +1917,7 @@ _edje_part_recalc_single_max(Edje_Part_Description_Common *desc, static void _edje_part_recalc_single_drag_threshold(Edje_Real_Part *ep, - Edje_Real_Part *threshold, + Edje_Real_Part *threshold, Edje_Calc_Params *params) { if (threshold) @@ -1887,7 +1929,7 @@ _edje_part_recalc_single_drag_threshold(Edje_Real_Part *ep, // Cancel movement to previous position due to our presence inside the threshold params->eval.x = FROM_INT(params->req_drag.x); params->eval.w = FROM_INT(params->req_drag.w); - ep->drag->threshold_x = EINA_TRUE; + ep->drag->threshold_x = EINA_TRUE; } else { @@ -1902,7 +1944,7 @@ _edje_part_recalc_single_drag_threshold(Edje_Real_Part *ep, // Cancel movement to previous position due to our presence inside the threshold params->eval.y = FROM_INT(params->req_drag.y); params->eval.h = FROM_INT(params->req_drag.h); - ep->drag->threshold_y = EINA_TRUE; + ep->drag->threshold_y = EINA_TRUE; } else { @@ -1939,11 +1981,12 @@ _edje_part_recalc_single_drag(Edje_Real_Part *ep, v = SCALE(ep->drag->size.x, confine_to->w); if ((minw > 0) && (TO_INT(v) < minw)) params->eval.w = FROM_INT(minw); - else if ((maxw >= 0) && (TO_INT(v) > maxw)) params->eval.w = FROM_INT(maxw); + else if ((maxw >= 0) && (TO_INT(v) > maxw)) + params->eval.w = FROM_INT(maxw); else params->eval.w = v; offset = TO_INT(SCALE(ep->drag->x, (confine_to->w - TO_INT(params->eval.w)))) - + ep->drag->tmp.x; + + ep->drag->tmp.x; if (ep->part->dragable.step_x > 0) { params->eval.x = FROM_INT(confine_to->x + @@ -1960,11 +2003,12 @@ _edje_part_recalc_single_drag(Edje_Real_Part *ep, v = SCALE(ep->drag->size.y, confine_to->h); if ((minh > 0) && (TO_INT(v) < minh)) params->eval.h = FROM_INT(minh); - else if ((maxh >= 0) && (TO_INT(v) > maxh)) params->eval.h = FROM_INT(maxh); + else if ((maxh >= 0) && (TO_INT(v) > maxh)) + params->eval.h = FROM_INT(maxh); else params->eval.h = v; offset = TO_INT(SCALE(ep->drag->y, (confine_to->h - TO_INT(params->eval.h)))) - + ep->drag->tmp.y; + + ep->drag->tmp.y; if (ep->part->dragable.step_y > 0) { params->eval.y = FROM_INT(confine_to->y + @@ -2024,9 +2068,9 @@ _edje_part_recalc_single_fill(Edje_Real_Part *ep, fw = params->final.w; params->type.common.fill.x = fill->pos_abs_x - + TO_INT(SCALE(fill->pos_rel_x, fw)); + + TO_INT(SCALE(fill->pos_rel_x, fw)); params->type.common.fill.w = fill->abs_x - + TO_INT(SCALE(fill->rel_x, fw)); + + TO_INT(SCALE(fill->rel_x, fw)); if (fill->type == EDJE_FILL_TYPE_TILE) evas_object_image_size_get(ep->object, NULL, &fh); @@ -2034,9 +2078,9 @@ _edje_part_recalc_single_fill(Edje_Real_Part *ep, fh = params->final.h; params->type.common.fill.y = fill->pos_abs_y - + TO_INT(SCALE(fill->pos_rel_y, fh)); + + TO_INT(SCALE(fill->pos_rel_y, fh)); params->type.common.fill.h = fill->abs_y - + TO_INT(SCALE(fill->rel_y, fh)); + + TO_INT(SCALE(fill->rel_y, fh)); params->type.common.fill.angle = fill->angle; params->type.common.fill.spread = fill->spread; @@ -2044,7 +2088,7 @@ _edje_part_recalc_single_fill(Edje_Real_Part *ep, static void _edje_part_recalc_single_min_max(FLOAT_T sc, - Edje *ed, + Edje *ed, Edje_Real_Part *ep, Edje_Part_Description_Common *desc, int *minw, int *minh, @@ -2198,95 +2242,95 @@ _edje_part_recalc_single_map(Edje *ed, if (!params->mapped) return; EINA_COW_CALC_MAP_BEGIN(params, params_write) - { - if (center) - { - params_write->center.x = ed->x + center->x + (center->w / 2); - params_write->center.y = ed->y + center->y + (center->h / 2); - } - else - { - params_write->center.x = ed->x + params->final.x + (params->final.w / 2); - params_write->center.y = ed->y + params->final.y + (params->final.h / 2); - } - params_write->center.z = 0; + { + if (center) + { + params_write->center.x = ed->x + center->x + (center->w / 2); + params_write->center.y = ed->y + center->y + (center->h / 2); + } + else + { + params_write->center.x = ed->x + params->final.x + (params->final.w / 2); + params_write->center.y = ed->y + params->final.y + (params->final.h / 2); + } + params_write->center.z = 0; - params_write->rotation.x = desc->map.rot.x; - params_write->rotation.y = desc->map.rot.y; - params_write->rotation.z = desc->map.rot.z; - params_write->zoom.x = desc->map.zoom.x; - params_write->zoom.y = desc->map.zoom.y; + params_write->rotation.x = desc->map.rot.x; + params_write->rotation.y = desc->map.rot.y; + params_write->rotation.z = desc->map.rot.z; + params_write->zoom.x = desc->map.zoom.x; + params_write->zoom.y = desc->map.zoom.y; - if (light) - { - Edje_Part_Description_Common *light_desc2; - FLOAT_T pos, pos2; + if (light) + { + Edje_Part_Description_Common *light_desc2; + FLOAT_T pos, pos2; - params_write->light.x = ed->x + light->x + (light->w / 2); - params_write->light.y = ed->y + light->y + (light->h / 2); + params_write->light.x = ed->x + light->x + (light->w / 2); + params_write->light.y = ed->y + light->y + (light->h / 2); - pos = light->description_pos; - pos2 = (pos < ZERO) ? ZERO : ((pos > FROM_INT(1)) ? FROM_INT(1) : pos); + pos = light->description_pos; + pos2 = (pos < ZERO) ? ZERO : ((pos > FROM_INT(1)) ? FROM_INT(1) : pos); - light_desc2 = light->param2 ? light->param2->description : NULL; + light_desc2 = light->param2 ? light->param2->description : NULL; - /* take into account CURRENT state also */ - if (pos != ZERO && light_desc2) - { - params_write->light.z = light->param1.description->persp.zplane + - TO_INT(SCALE(pos, light_desc2->persp.zplane - light->param1.description->persp.zplane)); - params_write->light.r = light->param1.description->color.r + - TO_INT(SCALE(pos2, light_desc2->color.r - light->param1.description->color.r)); - params_write->light.g = light->param1.description->color.g + - TO_INT(SCALE(pos2, light_desc2->color.g - light->param1.description->color.g)); - params_write->light.b = light->param1.description->color.b + - TO_INT(SCALE(pos2, light_desc2->color.b - light->param1.description->color.b)); - params_write->light.ar = light->param1.description->color2.r + - TO_INT(SCALE(pos2, light_desc2->color2.r - light->param1.description->color2.r)); - params_write->light.ag = light->param1.description->color2.g + - TO_INT(SCALE(pos2, light_desc2->color2.g - light->param1.description->color2.g)); - params_write->light.ab = light->param1.description->color2.b + - TO_INT(SCALE(pos2, light_desc2->color2.b - light->param1.description->color2.b)); - } - else - { - params_write->light.z = light->param1.description->persp.zplane; - params_write->light.r = light->param1.description->color.r; - params_write->light.g = light->param1.description->color.g; - params_write->light.b = light->param1.description->color.b; - params_write->light.ar = light->param1.description->color2.r; - params_write->light.ag = light->param1.description->color2.g; - params_write->light.ab = light->param1.description->color2.b; - } - } + /* take into account CURRENT state also */ + if (pos != ZERO && light_desc2) + { + params_write->light.z = light->param1.description->persp.zplane + + TO_INT(SCALE(pos, light_desc2->persp.zplane - light->param1.description->persp.zplane)); + params_write->light.r = light->param1.description->color.r + + TO_INT(SCALE(pos2, light_desc2->color.r - light->param1.description->color.r)); + params_write->light.g = light->param1.description->color.g + + TO_INT(SCALE(pos2, light_desc2->color.g - light->param1.description->color.g)); + params_write->light.b = light->param1.description->color.b + + TO_INT(SCALE(pos2, light_desc2->color.b - light->param1.description->color.b)); + params_write->light.ar = light->param1.description->color2.r + + TO_INT(SCALE(pos2, light_desc2->color2.r - light->param1.description->color2.r)); + params_write->light.ag = light->param1.description->color2.g + + TO_INT(SCALE(pos2, light_desc2->color2.g - light->param1.description->color2.g)); + params_write->light.ab = light->param1.description->color2.b + + TO_INT(SCALE(pos2, light_desc2->color2.b - light->param1.description->color2.b)); + } + else + { + params_write->light.z = light->param1.description->persp.zplane; + params_write->light.r = light->param1.description->color.r; + params_write->light.g = light->param1.description->color.g; + params_write->light.b = light->param1.description->color.b; + params_write->light.ar = light->param1.description->color2.r; + params_write->light.ag = light->param1.description->color2.g; + params_write->light.ab = light->param1.description->color2.b; + } + } - if (persp) - { - FLOAT_T pos; + if (persp) + { + FLOAT_T pos; - params_write->persp.x = ed->x + persp->x + (persp->w / 2); - params_write->persp.y = ed->y + persp->y + (persp->h / 2); + params_write->persp.x = ed->x + persp->x + (persp->w / 2); + params_write->persp.y = ed->y + persp->y + (persp->h / 2); - pos = persp->description_pos; + pos = persp->description_pos; - if (pos != 0 && persp->param2) - { - params_write->persp.z = persp->param1.description->persp.zplane + - TO_INT(SCALE(pos, persp->param2->description->persp.zplane - - persp->param1.description->persp.zplane)); - params_write->persp.focal = persp->param1.description->persp.focal + - TO_INT(SCALE(pos, persp->param2->description->persp.focal - - persp->param1.description->persp.focal)); - } - else - { - params_write->persp.z = persp->param1.description->persp.zplane; - params_write->persp.focal = persp->param1.description->persp.focal; - } - } - params_write->colors = desc->map.colors; - params_write->colors_count = desc->map.colors_count; - } + if (pos != 0 && persp->param2) + { + params_write->persp.z = persp->param1.description->persp.zplane + + TO_INT(SCALE(pos, persp->param2->description->persp.zplane - + persp->param1.description->persp.zplane)); + params_write->persp.focal = persp->param1.description->persp.focal + + TO_INT(SCALE(pos, persp->param2->description->persp.focal - + persp->param1.description->persp.focal)); + } + else + { + params_write->persp.z = persp->param1.description->persp.zplane; + params_write->persp.focal = persp->param1.description->persp.focal; + } + } + params_write->colors = desc->map.colors; + params_write->colors_count = desc->map.colors_count; + } EINA_COW_CALC_MAP_END(params, params_write); } @@ -2357,70 +2401,72 @@ _edje_part_recalc_single(Edje *ed, switch (ep->part->type) { case EDJE_PART_TYPE_IMAGE: + { + Edje_Real_Part_Set *set; + Edje_Part_Description_Image *img_desc = (Edje_Part_Description_Image *)desc; + + _edje_real_part_image_set(ed, ep, &set, pos); + + /* border */ + params->type.common.spec.image.l = img_desc->image.border.l; + params->type.common.spec.image.r = img_desc->image.border.r; + + params->type.common.spec.image.t = img_desc->image.border.t; + params->type.common.spec.image.b = img_desc->image.border.b; + + params->type.common.spec.image.border_scale_by = img_desc->image.border.scale_by; + + if (set && set->set) { - Edje_Real_Part_Set *set; - Edje_Part_Description_Image *img_desc = (Edje_Part_Description_Image*) desc; - - _edje_real_part_image_set(ed, ep, &set, pos); - - /* border */ - params->type.common.spec.image.l = img_desc->image.border.l; - params->type.common.spec.image.r = img_desc->image.border.r; - - params->type.common.spec.image.t = img_desc->image.border.t; - params->type.common.spec.image.b = img_desc->image.border.b; - - params->type.common.spec.image.border_scale_by = img_desc->image.border.scale_by; - - if (set && set->set) - { #define SET_BORDER_DEFINED(Result, Value) Result = Value ? Value : Result; - SET_BORDER_DEFINED(params->type.common.spec.image.l, set->entry->border.l); - SET_BORDER_DEFINED(params->type.common.spec.image.r, set->entry->border.r); - SET_BORDER_DEFINED(params->type.common.spec.image.t, set->entry->border.t); - SET_BORDER_DEFINED(params->type.common.spec.image.b, set->entry->border.b); + SET_BORDER_DEFINED(params->type.common.spec.image.l, set->entry->border.l); + SET_BORDER_DEFINED(params->type.common.spec.image.r, set->entry->border.r); + SET_BORDER_DEFINED(params->type.common.spec.image.t, set->entry->border.t); + SET_BORDER_DEFINED(params->type.common.spec.image.b, set->entry->border.b); - SET_BORDER_DEFINED(params->type.common.spec.image.border_scale_by, set->entry->border.scale_by); - } - - break; + SET_BORDER_DEFINED(params->type.common.spec.image.border_scale_by, set->entry->border.scale_by); } + + break; + } + case EDJE_PART_TYPE_TEXT: case EDJE_PART_TYPE_TEXTBLOCK: + { + Edje_Part_Description_Text *text_desc = (Edje_Part_Description_Text *)desc; + + /* text.align */ + params->type.text.align.x = text_desc->text.align.x; + params->type.text.align.y = text_desc->text.align.y; + params->type.text.ellipsis = text_desc->text.ellipsis; + + /* text colors */ + if (cc) { - Edje_Part_Description_Text *text_desc = (Edje_Part_Description_Text*) desc; - - /* text.align */ - params->type.text.align.x = text_desc->text.align.x; - params->type.text.align.y = text_desc->text.align.y; - params->type.text.ellipsis = text_desc->text.ellipsis; - - /* text colors */ - if (cc) - { - params->type.text.color2.r = (((int)cc->r2 + 1) * text_desc->common.color2.r) >> 8; - params->type.text.color2.g = (((int)cc->g2 + 1) * text_desc->common.color2.g) >> 8; - params->type.text.color2.b = (((int)cc->b2 + 1) * text_desc->common.color2.b) >> 8; - params->type.text.color2.a = (((int)cc->a2 + 1) * text_desc->common.color2.a) >> 8; - params->type.text.color3.r = (((int)cc->r3 + 1) * text_desc->text.color3.r) >> 8; - params->type.text.color3.g = (((int)cc->g3 + 1) * text_desc->text.color3.g) >> 8; - params->type.text.color3.b = (((int)cc->b3 + 1) * text_desc->text.color3.b) >> 8; - params->type.text.color3.a = (((int)cc->a3 + 1) * text_desc->text.color3.a) >> 8; - } - else - { - params->type.text.color2.r = text_desc->common.color2.r; - params->type.text.color2.g = text_desc->common.color2.g; - params->type.text.color2.b = text_desc->common.color2.b; - params->type.text.color2.a = text_desc->common.color2.a; - params->type.text.color3.r = text_desc->text.color3.r; - params->type.text.color3.g = text_desc->text.color3.g; - params->type.text.color3.b = text_desc->text.color3.b; - params->type.text.color3.a = text_desc->text.color3.a; - } - - break; + params->type.text.color2.r = (((int)cc->r2 + 1) * text_desc->common.color2.r) >> 8; + params->type.text.color2.g = (((int)cc->g2 + 1) * text_desc->common.color2.g) >> 8; + params->type.text.color2.b = (((int)cc->b2 + 1) * text_desc->common.color2.b) >> 8; + params->type.text.color2.a = (((int)cc->a2 + 1) * text_desc->common.color2.a) >> 8; + params->type.text.color3.r = (((int)cc->r3 + 1) * text_desc->text.color3.r) >> 8; + params->type.text.color3.g = (((int)cc->g3 + 1) * text_desc->text.color3.g) >> 8; + params->type.text.color3.b = (((int)cc->b3 + 1) * text_desc->text.color3.b) >> 8; + params->type.text.color3.a = (((int)cc->a3 + 1) * text_desc->text.color3.a) >> 8; } + else + { + params->type.text.color2.r = text_desc->common.color2.r; + params->type.text.color2.g = text_desc->common.color2.g; + params->type.text.color2.b = text_desc->common.color2.b; + params->type.text.color2.a = text_desc->common.color2.a; + params->type.text.color3.r = text_desc->text.color3.r; + params->type.text.color3.g = text_desc->text.color3.g; + params->type.text.color3.b = text_desc->text.color3.b; + params->type.text.color3.a = text_desc->text.color3.a; + } + + break; + } + case EDJE_PART_TYPE_SPACER: case EDJE_PART_TYPE_RECTANGLE: case EDJE_PART_TYPE_BOX: @@ -2428,19 +2474,21 @@ _edje_part_recalc_single(Edje *ed, case EDJE_PART_TYPE_SWALLOW: case EDJE_PART_TYPE_GROUP: case EDJE_PART_TYPE_PROXY: - break; + break; + case EDJE_PART_TYPE_GRADIENT: - /* FIXME: THIS ONE SHOULD NEVER BE TRIGGERED. */ - break; + /* FIXME: THIS ONE SHOULD NEVER BE TRIGGERED. */ + break; + default: - break; + break; } /* if we have text that wants to make the min size the text size... */ if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) - _edje_part_recalc_single_textblock(sc, ed, ep, (Edje_Part_Description_Text*) chosen_desc, params, &minw, &minh, &maxw, &maxh); + _edje_part_recalc_single_textblock(sc, ed, ep, (Edje_Part_Description_Text *)chosen_desc, params, &minw, &minh, &maxw, &maxh); else if (ep->part->type == EDJE_PART_TYPE_TEXT) - _edje_part_recalc_single_text(sc, ed, ep, (Edje_Part_Description_Text*) desc, (Edje_Part_Description_Text*) chosen_desc, params, &minw, &minh, &maxw, &maxh); + _edje_part_recalc_single_text(sc, ed, ep, (Edje_Part_Description_Text *)desc, (Edje_Part_Description_Text *)chosen_desc, params, &minw, &minh, &maxw, &maxh); if ((ep->part->type == EDJE_PART_TYPE_TABLE) && (((((Edje_Part_Description_Table *)chosen_desc)->table.min.h) || @@ -2448,10 +2496,10 @@ _edje_part_recalc_single(Edje *ed, { Evas_Coord lminw = 0, lminh = 0; - eo_do(ep->object, - evas_obj_smart_need_recalculate_set(1), - evas_obj_smart_calculate(), - evas_obj_size_hint_min_get(&lminw, &lminh)); + eo_do(ep->object, + evas_obj_smart_need_recalculate_set(1), + evas_obj_smart_calculate(), + evas_obj_size_hint_min_get(&lminw, &lminh)); if (((Edje_Part_Description_Table *)chosen_desc)->table.min.h) { if (lminw > minw) minw = lminw; @@ -2467,10 +2515,10 @@ _edje_part_recalc_single(Edje *ed, { Evas_Coord lminw = 0, lminh = 0; - eo_do(ep->object, - evas_obj_smart_need_recalculate_set(1), - evas_obj_smart_calculate(), - evas_obj_size_hint_min_get(&lminw, &lminh)); + eo_do(ep->object, + evas_obj_smart_need_recalculate_set(1), + evas_obj_smart_calculate(), + evas_obj_size_hint_min_get(&lminw, &lminh)); if (((Edje_Part_Description_Box *)chosen_desc)->box.min.h) { if (lminw > minw) minw = lminw; @@ -2584,29 +2632,29 @@ _edje_part_recalc_single(Edje *ed, if (ep->part->physics_body || ep->body) { EINA_COW_CALC_PHYSICS_BEGIN(params, params_write) - { - params_write->mass = desc->physics.mass; - params_write->restitution = desc->physics.restitution; - params_write->friction = desc->physics.friction; - params_write->damping.linear = desc->physics.damping.linear; - params_write->damping.angular = desc->physics.damping.angular; - params_write->sleep.linear = desc->physics.sleep.linear; - params_write->sleep.angular = desc->physics.sleep.angular; - params_write->material = desc->physics.material; - params_write->density = desc->physics.density; - params_write->hardness = desc->physics.hardness; - params_write->ignore_part_pos = desc->physics.ignore_part_pos; - params_write->light_on = desc->physics.light_on; - params_write->mov_freedom.lin.x = desc->physics.mov_freedom.lin.x; - params_write->mov_freedom.lin.y = desc->physics.mov_freedom.lin.y; - params_write->mov_freedom.lin.z = desc->physics.mov_freedom.lin.z; - params_write->mov_freedom.ang.x = desc->physics.mov_freedom.ang.x; - params_write->mov_freedom.ang.y = desc->physics.mov_freedom.ang.y; - params_write->mov_freedom.ang.z = desc->physics.mov_freedom.ang.z; - params_write->backcull = desc->physics.backcull; - params_write->z = desc->physics.z; - params_write->depth = desc->physics.depth; - } + { + params_write->mass = desc->physics.mass; + params_write->restitution = desc->physics.restitution; + params_write->friction = desc->physics.friction; + params_write->damping.linear = desc->physics.damping.linear; + params_write->damping.angular = desc->physics.damping.angular; + params_write->sleep.linear = desc->physics.sleep.linear; + params_write->sleep.angular = desc->physics.sleep.angular; + params_write->material = desc->physics.material; + params_write->density = desc->physics.density; + params_write->hardness = desc->physics.hardness; + params_write->ignore_part_pos = desc->physics.ignore_part_pos; + params_write->light_on = desc->physics.light_on; + params_write->mov_freedom.lin.x = desc->physics.mov_freedom.lin.x; + params_write->mov_freedom.lin.y = desc->physics.mov_freedom.lin.y; + params_write->mov_freedom.lin.z = desc->physics.mov_freedom.lin.z; + params_write->mov_freedom.ang.x = desc->physics.mov_freedom.ang.x; + params_write->mov_freedom.ang.y = desc->physics.mov_freedom.ang.y; + params_write->mov_freedom.ang.z = desc->physics.mov_freedom.ang.z; + params_write->backcull = desc->physics.backcull; + params_write->z = desc->physics.z; + params_write->depth = desc->physics.depth; + } EINA_COW_CALC_PHYSICS_END(params, params_write); } #endif @@ -2620,14 +2668,14 @@ _edje_table_recalc_apply(Edje *ed EINA_UNUSED, Edje_Part_Description_Table *chosen_desc) { eo_do(ep->object, - evas_obj_table_homogeneous_set(chosen_desc->table.homogeneous), - evas_obj_table_align_set(TO_DOUBLE(chosen_desc->table.align.x), TO_DOUBLE(chosen_desc->table.align.y)), - evas_obj_table_padding_set(chosen_desc->table.padding.x, chosen_desc->table.padding.y)); + evas_obj_table_homogeneous_set(chosen_desc->table.homogeneous), + evas_obj_table_align_set(TO_DOUBLE(chosen_desc->table.align.x), TO_DOUBLE(chosen_desc->table.align.y)), + evas_obj_table_padding_set(chosen_desc->table.padding.x, chosen_desc->table.padding.y)); if (evas_object_smart_need_recalculate_get(ep->object)) { eo_do(ep->object, - evas_obj_smart_need_recalculate_set(0), - evas_obj_smart_calculate()); + evas_obj_smart_need_recalculate_set(0), + evas_obj_smart_calculate()); } } @@ -2638,7 +2686,7 @@ _edje_proxy_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj int part_id = -1; if (ep->param2 && (pos >= FROM_DOUBLE(0.5))) - part_id = ((Edje_Part_Description_Proxy*) ep->param2->description)->proxy.id; + part_id = ((Edje_Part_Description_Proxy *)ep->param2->description)->proxy.id; else part_id = chosen_desc->proxy.id; @@ -2665,11 +2713,13 @@ _edje_proxy_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj case EDJE_PART_TYPE_BOX: case EDJE_PART_TYPE_TABLE: case EDJE_PART_TYPE_PROXY: - evas_object_image_source_set(ep->object, pp->object); - break; + evas_object_image_source_set(ep->object, pp->object); + break; + case EDJE_PART_TYPE_GRADIENT: - /* FIXME: THIS ONE SHOULD NEVER BE TRIGGERED. */ - break; + /* FIXME: THIS ONE SHOULD NEVER BE TRIGGERED. */ + break; + case EDJE_PART_TYPE_GROUP: case EDJE_PART_TYPE_SWALLOW: case EDJE_PART_TYPE_EXTERNAL: @@ -2678,10 +2728,11 @@ _edje_proxy_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj { evas_object_image_source_set(ep->object, pp->typedata.swallow->swallowed_object); } - break; + break; + case EDJE_PART_TYPE_SPACER: - /* FIXME: detect that at compile time and prevent it */ - break; + /* FIXME: detect that at compile time and prevent it */ + break; } } @@ -2738,13 +2789,13 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj evas_object_image_border_scale_set(ep->object, TO_DOUBLE(sc2)); } else - evas_object_image_border_scale_set(ep->object, TO_DOUBLE(sc)); + evas_object_image_border_scale_set(ep->object, TO_DOUBLE(sc)); } else { if (p3->type.common.spec.image.border_scale_by > FROM_DOUBLE(0.0)) - evas_object_image_border_scale_set - (ep->object, TO_DOUBLE(p3->type.common.spec.image.border_scale_by)); + evas_object_image_border_scale_set + (ep->object, TO_DOUBLE(p3->type.common.spec.image.border_scale_by)); else evas_object_image_border_scale_set(ep->object, 1.0); } @@ -2772,7 +2823,7 @@ _edje_real_part_state_get(Edje *ed, Edje_Real_Part *ep, int flags, int id, int * #ifdef EDJE_CALC_CACHE if (state) *state = result->state; #else - (void) state; + (void)state; #endif } } @@ -2785,12 +2836,12 @@ _edje_physics_world_geometry_check(EPhysics_World *world) { Evas_Coord w, h, d; ephysics_world_render_geometry_get(world, NULL, NULL, NULL, &w, &h, &d); - return (w && h && d); + return w && h && d; } static void _edje_physics_body_props_update(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *pf, - Eina_Bool pos_update) + Eina_Bool pos_update) { ephysics_body_linear_movement_enable_set(ep->body, pf->physics->mov_freedom.lin.x, @@ -2809,9 +2860,9 @@ _edje_physics_body_props_update(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params * if (pos_update) { ephysics_body_move(ep->body, - ed->x + pf->final.x, + ed->x + pf->final.x, ed->y + pf->final.y, - pf->physics->z); + pf->physics->z); ep->x = pf->final.x; ep->y = pf->final.y; ep->w = pf->final.w; @@ -2877,53 +2928,66 @@ _edje_physics_body_add(Edje *ed, Edje_Real_Part *rp, EPhysics_World *world) switch (rp->part->physics_body) { case EDJE_PART_PHYSICS_BODY_RIGID_BOX: - rp->body = ephysics_body_box_add(world); - break; + rp->body = ephysics_body_box_add(world); + break; + case EDJE_PART_PHYSICS_BODY_RIGID_SPHERE: - rp->body = ephysics_body_sphere_add(world); - break; + rp->body = ephysics_body_sphere_add(world); + break; + case EDJE_PART_PHYSICS_BODY_RIGID_CYLINDER: - rp->body = ephysics_body_cylinder_add(world); - break; + rp->body = ephysics_body_cylinder_add(world); + break; + case EDJE_PART_PHYSICS_BODY_SOFT_BOX: - rp->body = ephysics_body_soft_box_add(world); - break; + rp->body = ephysics_body_soft_box_add(world); + break; + case EDJE_PART_PHYSICS_BODY_SOFT_SPHERE: - rp->body = ephysics_body_soft_sphere_add(world, 0); - break; + rp->body = ephysics_body_soft_sphere_add(world, 0); + break; + case EDJE_PART_PHYSICS_BODY_SOFT_CYLINDER: - rp->body = ephysics_body_soft_cylinder_add(world); - break; + rp->body = ephysics_body_soft_cylinder_add(world); + break; + case EDJE_PART_PHYSICS_BODY_CLOTH: - rp->body = ephysics_body_cloth_add(world, 0, 0); - break; + rp->body = ephysics_body_cloth_add(world, 0, 0); + break; + case EDJE_PART_PHYSICS_BODY_BOUNDARY_TOP: - rp->body = ephysics_body_top_boundary_add(world); - resize = EINA_FALSE; - break; + rp->body = ephysics_body_top_boundary_add(world); + resize = EINA_FALSE; + break; + case EDJE_PART_PHYSICS_BODY_BOUNDARY_BOTTOM: - rp->body = ephysics_body_bottom_boundary_add(world); - resize = EINA_FALSE; - break; + rp->body = ephysics_body_bottom_boundary_add(world); + resize = EINA_FALSE; + break; + case EDJE_PART_PHYSICS_BODY_BOUNDARY_RIGHT: - rp->body = ephysics_body_right_boundary_add(world); - resize = EINA_FALSE; - break; + rp->body = ephysics_body_right_boundary_add(world); + resize = EINA_FALSE; + break; + case EDJE_PART_PHYSICS_BODY_BOUNDARY_LEFT: - rp->body = ephysics_body_left_boundary_add(world); - resize = EINA_FALSE; - break; + rp->body = ephysics_body_left_boundary_add(world); + resize = EINA_FALSE; + break; + case EDJE_PART_PHYSICS_BODY_BOUNDARY_FRONT: - rp->body = ephysics_body_front_boundary_add(world); - resize = EINA_FALSE; - break; + rp->body = ephysics_body_front_boundary_add(world); + resize = EINA_FALSE; + break; + case EDJE_PART_PHYSICS_BODY_BOUNDARY_BACK: - rp->body = ephysics_body_back_boundary_add(world); - resize = EINA_FALSE; - break; + rp->body = ephysics_body_back_boundary_add(world); + resize = EINA_FALSE; + break; + default: - ERR("Invalid body: %i", rp->part->physics_body); - return; + ERR("Invalid body: %i", rp->part->physics_body); + return; } EINA_LIST_FOREACH(rp->part->default_desc->physics.faces, l, pface) @@ -2949,18 +3013,19 @@ _edje_physics_body_add(Edje *ed, Edje_Real_Part *rp, EPhysics_World *world) _edje_physics_body_update_cb, rp); ephysics_body_data_set(rp->body, ed); } + #endif -#define FINTP(_x1, _x2, _p) \ - (((_x1) == (_x2)) \ - ? FROM_INT((_x1)) \ - : ADD(FROM_INT(_x1), \ - SCALE((_p), (_x2) - (_x1)))) +#define FINTP(_x1, _x2, _p) \ + (((_x1) == (_x2)) \ + ? FROM_INT((_x1)) \ + : ADD(FROM_INT(_x1), \ + SCALE((_p), (_x2) - (_x1)))) -#define FFP(_x1, _x2, _p) \ - (((_x1) == (_x2)) \ - ? (_x1) \ - : ADD(_x1, MUL(_p, SUB(_x2, _x1)))); +#define FFP(_x1, _x2, _p) \ + (((_x1) == (_x2)) \ + ? (_x1) \ + : ADD(_x1, MUL(_p, SUB(_x2, _x1)))); #define INTP(_x1, _x2, _p) TO_INT(FINTP(_x1, _x2, _p)) @@ -2970,9 +3035,9 @@ _map_colors_free(Edje_Calc_Params *pf) Edje_Map_Color **colors = pf->map->colors; int i; - for (i = 0; i < (int) pf->map->colors_count; i++) + for (i = 0; i < (int)pf->map->colors_count; i++) free(colors[i]); - free (colors); + free(colors); } static Eina_Bool @@ -2987,7 +3052,7 @@ _map_colors_interp(Edje_Calc_Params *p1, Edje_Calc_Params *p2, { pmap->colors_count = (p1->map->colors_count > p2->map->colors_count ? p1->map->colors_count : p2->map->colors_count); - pmap->colors = (Edje_Map_Color **) malloc(sizeof(Edje_Map_Color *) * (int) pmap->colors_count); + pmap->colors = (Edje_Map_Color **)malloc(sizeof(Edje_Map_Color *) * (int)pmap->colors_count); for (i = 0; i < (int)p1->map->colors_count; i++) { @@ -3049,7 +3114,7 @@ _map_colors_interp(Edje_Calc_Params *p1, Edje_Calc_Params *p2, } static void -_edje_map_prop_set(Evas_Map *map, const Edje_Calc_Params *pf, +_edje_map_prop_set(Evas_Map *map, const Edje_Calc_Params *pf, Edje_Part_Description_Common *chosen_desc, Edje_Real_Part *ep, Evas_Object *mo) { @@ -3065,15 +3130,15 @@ _edje_map_prop_set(Evas_Map *map, const Edje_Calc_Params *pf, ((ep->part->type == EDJE_PART_TYPE_SWALLOW) && (eo_isa(mo, EVAS_IMAGE_CLASS) && (!evas_object_image_source_get(mo)))) - ) + ) { int iw = 1, ih = 1; evas_object_image_size_get(mo, &iw, &ih); evas_map_point_image_uv_set(map, 0, 0.0, 0.0); - evas_map_point_image_uv_set(map, 1, iw , 0.0); - evas_map_point_image_uv_set(map, 2, iw , ih ); - evas_map_point_image_uv_set(map, 3, 0.0, ih ); + evas_map_point_image_uv_set(map, 1, iw, 0.0); + evas_map_point_image_uv_set(map, 2, iw, ih); + evas_map_point_image_uv_set(map, 3, 0.0, ih); } //map color @@ -3224,7 +3289,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta if (ep->part->type == EDJE_PART_TYPE_GROUP && ((ep->type == EDJE_RP_TYPE_SWALLOW) && - (ep->typedata.swallow)) && + (ep->typedata.swallow)) && ep->typedata.swallow->swallowed_object) { edje_object_scale_set(ep->typedata.swallow->swallowed_object, TO_DOUBLE(ed->scale)); @@ -3247,7 +3312,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta } if (ep->part->type == EDJE_PART_TYPE_GROUP && ((ep->type == EDJE_RP_TYPE_SWALLOW) && - (ep->typedata.swallow)) && + (ep->typedata.swallow)) && ep->typedata.swallow->swallowed_object) { Edje_Size *min = NULL, *max = NULL; @@ -3269,16 +3334,16 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta return; #endif - if (ep->param1.description) + if (ep->param1.description) { - if (ep->param1.description->rel1.id_x >= 0) - rp1[Rel1X] = ed->table_parts[ep->param1.description->rel1.id_x]; - if (ep->param1.description->rel2.id_x >= 0) - rp1[Rel2X] = ed->table_parts[ep->param1.description->rel2.id_x]; - if (ep->param1.description->rel1.id_y >= 0) - rp1[Rel1Y] = ed->table_parts[ep->param1.description->rel1.id_y]; - if (ep->param1.description->rel2.id_y >= 0) - rp1[Rel2Y] = ed->table_parts[ep->param1.description->rel2.id_y]; + if (ep->param1.description->rel1.id_x >= 0) + rp1[Rel1X] = ed->table_parts[ep->param1.description->rel1.id_x]; + if (ep->param1.description->rel2.id_x >= 0) + rp1[Rel2X] = ed->table_parts[ep->param1.description->rel2.id_x]; + if (ep->param1.description->rel1.id_y >= 0) + rp1[Rel1Y] = ed->table_parts[ep->param1.description->rel1.id_y]; + if (ep->param1.description->rel2.id_y >= 0) + rp1[Rel2Y] = ed->table_parts[ep->param1.description->rel2.id_y]; } if (ep->param2) { @@ -3295,7 +3360,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta if (flags & FLAG_X) { ep->calculating |= flags & FLAG_X; - if (rp1[Rel1X]) + if (rp1[Rel1X]) { _edje_part_recalc(ed, rp1[Rel1X], FLAG_X, NULL); #ifdef EDJE_CALC_CACHE @@ -3408,9 +3473,9 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta int part_id = -1; if (ep->param2 && (pos >= FROM_DOUBLE(0.5))) - part_id = ((Edje_Part_Description_Proxy*) ep->param2->description)->proxy.id; + part_id = ((Edje_Part_Description_Proxy *)ep->param2->description)->proxy.id; else - part_id = ((Edje_Part_Description_Proxy*) chosen_desc)->proxy.id; + part_id = ((Edje_Part_Description_Proxy *)chosen_desc)->proxy.id; #ifdef EDJE_CALC_CACHE Edje_Real_Part *pp; @@ -3472,17 +3537,17 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) && ed->text_part_change)) #endif - { - _edje_part_recalc_single(ed, ep, ep->param1.description, - chosen_desc, center[0], light[0], - persp[0], rp1[Rel1X], rp1[Rel1Y], - rp1[Rel2X], rp1[Rel2Y], confine_to, - threshold, p1, mmw, mmh, - pos); + { + _edje_part_recalc_single(ed, ep, ep->param1.description, + chosen_desc, center[0], light[0], + persp[0], rp1[Rel1X], rp1[Rel1Y], + rp1[Rel2X], rp1[Rel2Y], confine_to, + threshold, p1, mmw, mmh, + pos); #ifdef EDJE_CALC_CACHE - if (flags == FLAG_XY) ep->param1.state = ed->state; + if (flags == FLAG_XY) ep->param1.state = ed->state; #endif - } + } } if (ep->param2) { @@ -3508,7 +3573,6 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta #ifdef HAVE_EPHYSICS p1->physics = physics; #endif - } p3 = &lp3; @@ -3541,21 +3605,22 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) && ed->text_part_change)) #endif - { - _edje_part_recalc_single(ed, ep, ep->param2->description, - chosen_desc, center[1], light[1], - persp[1], rp2[Rel1X], rp2[Rel1Y], - rp2[Rel2X], rp2[Rel2Y], confine_to, - threshold, p2, mmw, mmh, - pos); + { + _edje_part_recalc_single(ed, ep, ep->param2->description, + chosen_desc, center[1], light[1], + persp[1], rp2[Rel1X], rp2[Rel1Y], + rp2[Rel2X], rp2[Rel2Y], confine_to, + threshold, p2, mmw, mmh, + pos); #ifdef EDJE_CALC_CACHE - if (flags == FLAG_XY) ep->param2->state = ed->state; + if (flags == FLAG_XY) ep->param2->state = ed->state; #endif - } + } pos2 = pos; if (pos2 < ZERO) pos2 = ZERO; - else if (pos2 > FROM_INT(1)) pos2 = FROM_INT(1); + else if (pos2 > FROM_INT(1)) + pos2 = FROM_INT(1); beginning_pos = (pos < FROM_DOUBLE(0.5)); part_type = ep->part->type; @@ -3606,58 +3671,58 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta if (ep->part->physics_body || ep->body) { EINA_COW_CALC_PHYSICS_BEGIN(p3, p3_write) - { - p3_write->mass = TO_DOUBLE(FINTP(p1->physics->mass, p2->physics->mass, - pos)); - p3_write->restitution = TO_DOUBLE(FINTP(p1->physics->restitution, - p2->physics->restitution, - pos)); - p3_write->friction = TO_DOUBLE(FINTP(p1->physics->friction, - p2->physics->friction, pos)); - p3_write->density = TO_DOUBLE(FINTP(p1->physics->density, - p2->physics->density, pos)); - p3_write->hardness = TO_DOUBLE(FINTP(p1->physics->hardness, - p2->physics->hardness, pos)); + { + p3_write->mass = TO_DOUBLE(FINTP(p1->physics->mass, p2->physics->mass, + pos)); + p3_write->restitution = TO_DOUBLE(FINTP(p1->physics->restitution, + p2->physics->restitution, + pos)); + p3_write->friction = TO_DOUBLE(FINTP(p1->physics->friction, + p2->physics->friction, pos)); + p3_write->density = TO_DOUBLE(FINTP(p1->physics->density, + p2->physics->density, pos)); + p3_write->hardness = TO_DOUBLE(FINTP(p1->physics->hardness, + p2->physics->hardness, pos)); - p3_write->damping.linear = TO_DOUBLE(FINTP(p1->physics->damping.linear, - p2->physics->damping.linear, pos)); - p3_write->damping.angular = TO_DOUBLE(FINTP(p1->physics->damping.angular, - p2->physics->damping.angular, pos)); + p3_write->damping.linear = TO_DOUBLE(FINTP(p1->physics->damping.linear, + p2->physics->damping.linear, pos)); + p3_write->damping.angular = TO_DOUBLE(FINTP(p1->physics->damping.angular, + p2->physics->damping.angular, pos)); - p3_write->sleep.linear = TO_DOUBLE(FINTP(p1->physics->sleep.linear, - p2->physics->sleep.linear, pos)); - p3_write->sleep.angular = TO_DOUBLE(FINTP(p1->physics->sleep.angular, - p2->physics->sleep.angular, pos)); + p3_write->sleep.linear = TO_DOUBLE(FINTP(p1->physics->sleep.linear, + p2->physics->sleep.linear, pos)); + p3_write->sleep.angular = TO_DOUBLE(FINTP(p1->physics->sleep.angular, + p2->physics->sleep.angular, pos)); - p3_write->z = INTP(p1->physics->z, p2->physics->z, pos); - p3_write->depth = INTP(p1->physics->depth, p2->physics->depth, pos); + p3_write->z = INTP(p1->physics->z, p2->physics->z, pos); + p3_write->depth = INTP(p1->physics->depth, p2->physics->depth, pos); - if ((p1->physics->ignore_part_pos) && (p2->physics->ignore_part_pos)) - p3_write->ignore_part_pos = 1; - else - p3_write->ignore_part_pos = 0; + if ((p1->physics->ignore_part_pos) && (p2->physics->ignore_part_pos)) + p3_write->ignore_part_pos = 1; + else + p3_write->ignore_part_pos = 0; - if ((p1->physics->material) && (p2->physics->material)) - p3_write->material = p1->physics->material; - else - p3_write->material = EPHYSICS_BODY_MATERIAL_CUSTOM; + if ((p1->physics->material) && (p2->physics->material)) + p3_write->material = p1->physics->material; + else + p3_write->material = EPHYSICS_BODY_MATERIAL_CUSTOM; - p3_write->light_on = p1->physics->light_on || p2->physics->light_on; - p3_write->backcull = p1->physics->backcull || p2->physics->backcull; + p3_write->light_on = p1->physics->light_on || p2->physics->light_on; + p3_write->backcull = p1->physics->backcull || p2->physics->backcull; - p3_write->mov_freedom.lin.x = p1->physics->mov_freedom.lin.x || - p2->physics->mov_freedom.lin.x; - p3_write->mov_freedom.lin.y = p1->physics->mov_freedom.lin.y || - p2->physics->mov_freedom.lin.y; - p3_write->mov_freedom.lin.z = p1->physics->mov_freedom.lin.z || - p2->physics->mov_freedom.lin.z; - p3_write->mov_freedom.ang.x = p1->physics->mov_freedom.ang.x || - p2->physics->mov_freedom.ang.x; - p3_write->mov_freedom.ang.y = p1->physics->mov_freedom.ang.y || - p2->physics->mov_freedom.ang.y; - p3_write->mov_freedom.ang.z = p1->physics->mov_freedom.ang.z || - p2->physics->mov_freedom.ang.z; - } + p3_write->mov_freedom.lin.x = p1->physics->mov_freedom.lin.x || + p2->physics->mov_freedom.lin.x; + p3_write->mov_freedom.lin.y = p1->physics->mov_freedom.lin.y || + p2->physics->mov_freedom.lin.y; + p3_write->mov_freedom.lin.z = p1->physics->mov_freedom.lin.z || + p2->physics->mov_freedom.lin.z; + p3_write->mov_freedom.ang.x = p1->physics->mov_freedom.ang.x || + p2->physics->mov_freedom.ang.x; + p3_write->mov_freedom.ang.y = p1->physics->mov_freedom.ang.y || + p2->physics->mov_freedom.ang.y; + p3_write->mov_freedom.ang.z = p1->physics->mov_freedom.ang.z || + p2->physics->mov_freedom.ang.z; + } EINA_COW_CALC_PHYSICS_END(p3, p3_write); } #endif @@ -3665,35 +3730,38 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta switch (part_type) { case EDJE_PART_TYPE_IMAGE: - p3->type.common.spec.image.l = INTP(p1->type.common.spec.image.l, p2->type.common.spec.image.l, pos); - p3->type.common.spec.image.r = INTP(p1->type.common.spec.image.r, p2->type.common.spec.image.r, pos); - p3->type.common.spec.image.t = INTP(p1->type.common.spec.image.t, p2->type.common.spec.image.t, pos); - p3->type.common.spec.image.b = INTP(p1->type.common.spec.image.b, p2->type.common.spec.image.b, pos); - p3->type.common.spec.image.border_scale_by = FFP(p1->type.common.spec.image.border_scale_by, p2->type.common.spec.image.border_scale_by, pos); + p3->type.common.spec.image.l = INTP(p1->type.common.spec.image.l, p2->type.common.spec.image.l, pos); + p3->type.common.spec.image.r = INTP(p1->type.common.spec.image.r, p2->type.common.spec.image.r, pos); + p3->type.common.spec.image.t = INTP(p1->type.common.spec.image.t, p2->type.common.spec.image.t, pos); + p3->type.common.spec.image.b = INTP(p1->type.common.spec.image.b, p2->type.common.spec.image.b, pos); + p3->type.common.spec.image.border_scale_by = FFP(p1->type.common.spec.image.border_scale_by, p2->type.common.spec.image.border_scale_by, pos); + case EDJE_PART_TYPE_PROXY: - p3->type.common.fill.x = INTP(p1->type.common.fill.x, p2->type.common.fill.x, pos); - p3->type.common.fill.y = INTP(p1->type.common.fill.y, p2->type.common.fill.y, pos); - p3->type.common.fill.w = INTP(p1->type.common.fill.w, p2->type.common.fill.w, pos); - p3->type.common.fill.h = INTP(p1->type.common.fill.h, p2->type.common.fill.h, pos); - break; + p3->type.common.fill.x = INTP(p1->type.common.fill.x, p2->type.common.fill.x, pos); + p3->type.common.fill.y = INTP(p1->type.common.fill.y, p2->type.common.fill.y, pos); + p3->type.common.fill.w = INTP(p1->type.common.fill.w, p2->type.common.fill.w, pos); + p3->type.common.fill.h = INTP(p1->type.common.fill.h, p2->type.common.fill.h, pos); + break; + case EDJE_PART_TYPE_TEXT: - p3->type.text.size = INTP(p1->type.text.size, p2->type.text.size, pos); - /* no break as we share code with the TEXTBLOCK type here. Intended fall-through */ + p3->type.text.size = INTP(p1->type.text.size, p2->type.text.size, pos); + + /* no break as we share code with the TEXTBLOCK type here. Intended fall-through */ case EDJE_PART_TYPE_TEXTBLOCK: - p3->type.text.color2.r = INTP(p1->type.text.color2.r, p2->type.text.color2.r, pos2); - p3->type.text.color2.g = INTP(p1->type.text.color2.g, p2->type.text.color2.g, pos2); - p3->type.text.color2.b = INTP(p1->type.text.color2.b, p2->type.text.color2.b, pos2); - p3->type.text.color2.a = INTP(p1->type.text.color2.a, p2->type.text.color2.a, pos2); + p3->type.text.color2.r = INTP(p1->type.text.color2.r, p2->type.text.color2.r, pos2); + p3->type.text.color2.g = INTP(p1->type.text.color2.g, p2->type.text.color2.g, pos2); + p3->type.text.color2.b = INTP(p1->type.text.color2.b, p2->type.text.color2.b, pos2); + p3->type.text.color2.a = INTP(p1->type.text.color2.a, p2->type.text.color2.a, pos2); - p3->type.text.color3.r = INTP(p1->type.text.color3.r, p2->type.text.color3.r, pos2); - p3->type.text.color3.g = INTP(p1->type.text.color3.g, p2->type.text.color3.g, pos2); - p3->type.text.color3.b = INTP(p1->type.text.color3.b, p2->type.text.color3.b, pos2); - p3->type.text.color3.a = INTP(p1->type.text.color3.a, p2->type.text.color3.a, pos2); + p3->type.text.color3.r = INTP(p1->type.text.color3.r, p2->type.text.color3.r, pos2); + p3->type.text.color3.g = INTP(p1->type.text.color3.g, p2->type.text.color3.g, pos2); + p3->type.text.color3.b = INTP(p1->type.text.color3.b, p2->type.text.color3.b, pos2); + p3->type.text.color3.a = INTP(p1->type.text.color3.a, p2->type.text.color3.a, pos2); - p3->type.text.align.x = FFP(p1->type.text.align.x, p2->type.text.align.x, pos); - p3->type.text.align.y = FFP(p1->type.text.align.y, p2->type.text.align.y, pos); - p3->type.text.ellipsis = TO_DOUBLE(FINTP(p1->type.text.ellipsis, p2->type.text.ellipsis, pos2)); - break; + p3->type.text.align.x = FFP(p1->type.text.align.x, p2->type.text.align.x, pos); + p3->type.text.align.y = FFP(p1->type.text.align.y, p2->type.text.align.y, pos); + p3->type.text.ellipsis = TO_DOUBLE(FINTP(p1->type.text.ellipsis, p2->type.text.ellipsis, pos2)); + break; } /* mapped is a special case like visible */ @@ -3709,64 +3777,64 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta if (p3->mapped) { EINA_COW_CALC_MAP_BEGIN(p3, p3_write) - { - p3_write->center.x = INTP(p1->map->center.x, p2->map->center.x, pos); - p3_write->center.y = INTP(p1->map->center.y, p2->map->center.y, pos); - p3_write->center.z = INTP(p1->map->center.z, p2->map->center.z, pos); - p3_write->rotation.x = FFP(p1->map->rotation.x, p2->map->rotation.x, pos); - p3_write->rotation.y = FFP(p1->map->rotation.y, p2->map->rotation.y, pos); - p3_write->rotation.z = FFP(p1->map->rotation.z, p2->map->rotation.z, pos); - p3_write->zoom.x = FFP(p1->map->zoom.x, p2->map->zoom.x, pos); - p3_write->zoom.y = FFP(p1->map->zoom.y, p2->map->zoom.y, pos); + { + p3_write->center.x = INTP(p1->map->center.x, p2->map->center.x, pos); + p3_write->center.y = INTP(p1->map->center.y, p2->map->center.y, pos); + p3_write->center.z = INTP(p1->map->center.z, p2->map->center.z, pos); + p3_write->rotation.x = FFP(p1->map->rotation.x, p2->map->rotation.x, pos); + p3_write->rotation.y = FFP(p1->map->rotation.y, p2->map->rotation.y, pos); + p3_write->rotation.z = FFP(p1->map->rotation.z, p2->map->rotation.z, pos); + p3_write->zoom.x = FFP(p1->map->zoom.x, p2->map->zoom.x, pos); + p3_write->zoom.y = FFP(p1->map->zoom.y, p2->map->zoom.y, pos); -#define MIX(P1, P2, P3, pos, info) \ - P3->info = P1->map->info + TO_INT(SCALE(pos, P2->map->info - P1->map->info)); - map_colors_free = _map_colors_interp(p1, p2, p3_write, pos); +#define MIX(P1, P2, P3, pos, info) \ + P3->info = P1->map->info + TO_INT(SCALE(pos, P2->map->info - P1->map->info)); + map_colors_free = _map_colors_interp(p1, p2, p3_write, pos); - if (p1->lighted && p2->lighted) - { - MIX(p1, p2, p3_write, pos, light.x); - MIX(p1, p2, p3_write, pos, light.y); - MIX(p1, p2, p3_write, pos, light.z); - MIX(p1, p2, p3_write, pos, light.r); - MIX(p1, p2, p3_write, pos, light.g); - MIX(p1, p2, p3_write, pos, light.b); - MIX(p1, p2, p3_write, pos, light.ar); - MIX(p1, p2, p3_write, pos, light.ag); - MIX(p1, p2, p3_write, pos, light.ab); - } - else if (p1->lighted) - { - memcpy(&p3_write->light, &p1->map->light, sizeof (p1->map->light)); - } - else if (p2->lighted) - { - memcpy(&p3_write->light, &p2->map->light, sizeof (p2->map->light)); - } + if (p1->lighted && p2->lighted) + { + MIX(p1, p2, p3_write, pos, light.x); + MIX(p1, p2, p3_write, pos, light.y); + MIX(p1, p2, p3_write, pos, light.z); + MIX(p1, p2, p3_write, pos, light.r); + MIX(p1, p2, p3_write, pos, light.g); + MIX(p1, p2, p3_write, pos, light.b); + MIX(p1, p2, p3_write, pos, light.ar); + MIX(p1, p2, p3_write, pos, light.ag); + MIX(p1, p2, p3_write, pos, light.ab); + } + else if (p1->lighted) + { + memcpy(&p3_write->light, &p1->map->light, sizeof (p1->map->light)); + } + else if (p2->lighted) + { + memcpy(&p3_write->light, &p2->map->light, sizeof (p2->map->light)); + } - if (p1->persp_on && p2->persp_on) - { - MIX(p1, p2, p3_write, pos, persp.x); - MIX(p1, p2, p3_write, pos, persp.y); - MIX(p1, p2, p3_write, pos, persp.z); - MIX(p1, p2, p3_write, pos, persp.focal); - } - else if (p1->persp_on) - { - memcpy(&p3_write->persp, &p1->map->persp, sizeof (p1->map->persp)); - } - else if (p2->persp_on) - { - memcpy(&p3_write->persp, &p2->map->persp, sizeof (p2->map->persp)); - } - } + if (p1->persp_on && p2->persp_on) + { + MIX(p1, p2, p3_write, pos, persp.x); + MIX(p1, p2, p3_write, pos, persp.y); + MIX(p1, p2, p3_write, pos, persp.z); + MIX(p1, p2, p3_write, pos, persp.focal); + } + else if (p1->persp_on) + { + memcpy(&p3_write->persp, &p1->map->persp, sizeof (p1->map->persp)); + } + else if (p2->persp_on) + { + memcpy(&p3_write->persp, &p2->map->persp, sizeof (p2->map->persp)); + } + } EINA_COW_CALC_MAP_END(p3, p3_write); } #ifndef EDJE_CALC_CACHE - eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **) &lp2.map); + eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **)&lp2.map); #ifdef HAVE_EPHYSICS - eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **) &lp2.physics); + eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&lp2.physics); #endif #endif pf = p3; @@ -3781,12 +3849,12 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta if (ed->persp) { EINA_COW_CALC_MAP_BEGIN(pf, pf_write) - { - pf_write->persp.x = ed->persp->px; - pf_write->persp.y = ed->persp->py; - pf_write->persp.z = ed->persp->z0; - pf_write->persp.focal = ed->persp->foc; - } + { + pf_write->persp.x = ed->persp->px; + pf_write->persp.y = ed->persp->py; + pf_write->persp.z = ed->persp->z0; + pf_write->persp.focal = ed->persp->foc; + } EINA_COW_CALC_MAP_END(pf, pf_write); } else @@ -3798,22 +3866,22 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta if (!ps) ps = edje_evas_global_perspective_get(evas_object_evas_get(ed->obj)); EINA_COW_CALC_MAP_BEGIN(pf, pf_write) - { - if (ps) - { - pf_write->persp.x = ps->px; - pf_write->persp.y = ps->py; - pf_write->persp.z = ps->z0; - pf_write->persp.focal = ps->foc; - } - else - { - pf_write->persp.x = ed->x + (ed->w / 2); - pf_write->persp.y = ed->y + (ed->h / 2); - pf_write->persp.z = 0; - pf_write->persp.focal = 1000; - } - } + { + if (ps) + { + pf_write->persp.x = ps->px; + pf_write->persp.y = ps->py; + pf_write->persp.z = ps->z0; + pf_write->persp.focal = ps->foc; + } + else + { + pf_write->persp.x = ed->x + (ed->w / 2); + pf_write->persp.y = ed->y + (ed->h / 2); + pf_write->persp.z = 0; + pf_write->persp.focal = 1000; + } + } EINA_COW_CALC_MAP_END(pf, pf_write); } } @@ -3836,9 +3904,9 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta #ifdef HAVE_EPHYSICS state->physics = physics; #endif - eina_cow_memcpy(_edje_calc_params_map_cow, (const Eina_Cow_Data **) &state->map, pf->map); + eina_cow_memcpy(_edje_calc_params_map_cow, (const Eina_Cow_Data **)&state->map, pf->map); #ifdef HAVE_EPHYSICS - eina_cow_memcpy(_edje_calc_params_physics_cow, (const Eina_Cow_Data **) &state->physics, pf->physics); + eina_cow_memcpy(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&state->physics, pf->physics); #endif } @@ -3865,140 +3933,152 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta switch (ep->part->type) { case EDJE_PART_TYPE_IMAGE: - { - Edje_Part_Description_Image *img_desc = (Edje_Part_Description_Image*) chosen_desc; + { + Edje_Part_Description_Image *img_desc = (Edje_Part_Description_Image *)chosen_desc; + + evas_object_image_scale_hint_set(ep->object, + img_desc->image.scale_hint); + /* No break here as we share the rest of the code for all types. Intended fall-through*/ + } - evas_object_image_scale_hint_set(ep->object, - img_desc->image.scale_hint); - /* No break here as we share the rest of the code for all types. Intended fall-through*/ - } case EDJE_PART_TYPE_PROXY: case EDJE_PART_TYPE_RECTANGLE: case EDJE_PART_TYPE_TEXTBLOCK: case EDJE_PART_TYPE_BOX: case EDJE_PART_TYPE_TABLE: - evas_object_color_set(ep->object, - (pf->color.r * pf->color.a) / 255, - (pf->color.g * pf->color.a) / 255, - (pf->color.b * pf->color.a) / 255, - pf->color.a); + evas_object_color_set(ep->object, + (pf->color.r * pf->color.a) / 255, + (pf->color.g * pf->color.a) / 255, + (pf->color.b * pf->color.a) / 255, + pf->color.a); #ifdef HAVE_EPHYSICS /* body attributes should be updated for invisible objects */ - if (!ep->part->physics_body) - { - if (!pf->visible) - { - evas_object_hide(ep->object); - break; - } - evas_object_show(ep->object); - } - else if (!pf->visible) - { - Evas_Object *face_obj; - Eina_List *l; + if (!ep->part->physics_body) + { + if (!pf->visible) + { + evas_object_hide(ep->object); + break; + } + evas_object_show(ep->object); + } + else if (!pf->visible) + { + Evas_Object *face_obj; + Eina_List *l; - EINA_LIST_FOREACH(ep->body_faces, l, face_obj) - evas_object_hide(face_obj); - evas_object_hide(ep->object); - } + EINA_LIST_FOREACH(ep->body_faces, l, face_obj) + evas_object_hide(face_obj); + evas_object_hide(ep->object); + } #else - if (!pf->visible) - { - evas_object_hide(ep->object); - break; - } - evas_object_show(ep->object); + if (!pf->visible) + { + evas_object_hide(ep->object); + break; + } + evas_object_show(ep->object); + #endif - /* move and resize are needed for all previous object => no break here. */ + /* move and resize are needed for all previous object => no break here. */ case EDJE_PART_TYPE_SWALLOW: case EDJE_PART_TYPE_GROUP: case EDJE_PART_TYPE_EXTERNAL: - /* visibility and color have no meaning on SWALLOW and GROUP part. */ + /* visibility and color have no meaning on SWALLOW and GROUP part. */ #ifdef HAVE_EPHYSICS - eo_do(ep->object, - efl_gfx_size_set(pf->final.w, pf->final.h)); - if ((ep->part->physics_body) && (!ep->body)) - { - if (_edje_physics_world_geometry_check(ed->world)) - { - _edje_physics_body_add(ed, ep, ed->world); - _edje_physics_body_props_update(ed, ep, pf, EINA_TRUE); - } - } - else if (ep->body) - { - if (((ep->prev_description) && - (chosen_desc != ep->prev_description)) || - (pf != p1)) - _edje_physics_body_props_update(ed, ep, pf, !pf->physics->ignore_part_pos); - } - else - eo_do(ep->object, - efl_gfx_position_set(ed->x + pf->final.x, ed->y + pf->final.y)); + eo_do(ep->object, + efl_gfx_size_set(pf->final.w, pf->final.h)); + if ((ep->part->physics_body) && (!ep->body)) + { + if (_edje_physics_world_geometry_check(ed->world)) + { + _edje_physics_body_add(ed, ep, ed->world); + _edje_physics_body_props_update(ed, ep, pf, EINA_TRUE); + } + } + else if (ep->body) + { + if (((ep->prev_description) && + (chosen_desc != ep->prev_description)) || + (pf != p1)) + _edje_physics_body_props_update(ed, ep, pf, !pf->physics->ignore_part_pos); + } + else + eo_do(ep->object, + efl_gfx_position_set(ed->x + pf->final.x, ed->y + pf->final.y)); #else - eo_do(ep->object, - efl_gfx_position_set(ed->x + pf->final.x, ed->y + pf->final.y), - efl_gfx_size_set(pf->final.w, pf->final.h)); + eo_do(ep->object, + efl_gfx_position_set(ed->x + pf->final.x, ed->y + pf->final.y), + efl_gfx_size_set(pf->final.w, pf->final.h)); #endif - if (ep->nested_smart) - { /* Move, Resize all nested parts */ - /* Not really needed but will improve the bounding box evaluation done by Evas */ - eo_do(ep->nested_smart, - efl_gfx_position_set(ed->x + pf->final.x, ed->y + pf->final.y), - efl_gfx_size_set(pf->final.w, pf->final.h)); - } - if (ep->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) - _edje_entry_real_part_configure(ed, ep); - break; + if (ep->nested_smart) /* Move, Resize all nested parts */ + { /* Not really needed but will improve the bounding box evaluation done by Evas */ + eo_do(ep->nested_smart, + efl_gfx_position_set(ed->x + pf->final.x, ed->y + pf->final.y), + efl_gfx_size_set(pf->final.w, pf->final.h)); + } + if (ep->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) + _edje_entry_real_part_configure(ed, ep); + break; + case EDJE_PART_TYPE_TEXT: - /* This is correctly handle in _edje_text_recalc_apply at the moment. */ - break; + /* This is correctly handle in _edje_text_recalc_apply at the moment. */ + break; + case EDJE_PART_TYPE_GRADIENT: - /* FIXME: definitivly remove this code when we switch to new format. */ - abort(); - break; + /* FIXME: definitivly remove this code when we switch to new format. */ + abort(); + break; + case EDJE_PART_TYPE_SPACER: - /* We really should do nothing on SPACER part */ - break; + /* We really should do nothing on SPACER part */ + break; } /* Some object need special recalc. */ switch (ep->part->type) { case EDJE_PART_TYPE_TEXT: - _edje_text_recalc_apply(ed, ep, pf, (Edje_Part_Description_Text*) chosen_desc, EINA_FALSE); - break; + _edje_text_recalc_apply(ed, ep, pf, (Edje_Part_Description_Text *)chosen_desc, EINA_FALSE); + break; + case EDJE_PART_TYPE_PROXY: - _edje_proxy_recalc_apply(ed, ep, pf, (Edje_Part_Description_Proxy*) chosen_desc, pos); - break; + _edje_proxy_recalc_apply(ed, ep, pf, (Edje_Part_Description_Proxy *)chosen_desc, pos); + break; + case EDJE_PART_TYPE_IMAGE: - _edje_image_recalc_apply(ed, ep, pf, (Edje_Part_Description_Image*) chosen_desc, pos); - break; + _edje_image_recalc_apply(ed, ep, pf, (Edje_Part_Description_Image *)chosen_desc, pos); + break; + case EDJE_PART_TYPE_BOX: - _edje_box_recalc_apply(ed, ep, pf, (Edje_Part_Description_Box*) chosen_desc); - break; + _edje_box_recalc_apply(ed, ep, pf, (Edje_Part_Description_Box *)chosen_desc); + break; + case EDJE_PART_TYPE_TABLE: - _edje_table_recalc_apply(ed, ep, pf, (Edje_Part_Description_Table*) chosen_desc); - break; + _edje_table_recalc_apply(ed, ep, pf, (Edje_Part_Description_Table *)chosen_desc); + break; + case EDJE_PART_TYPE_TEXTBLOCK: - _edje_textblock_recalc_apply(ed, ep, pf, (Edje_Part_Description_Text*) chosen_desc); - break; + _edje_textblock_recalc_apply(ed, ep, pf, (Edje_Part_Description_Text *)chosen_desc); + break; + case EDJE_PART_TYPE_EXTERNAL: case EDJE_PART_TYPE_RECTANGLE: case EDJE_PART_TYPE_SWALLOW: case EDJE_PART_TYPE_GROUP: - /* Nothing special to do for this type of object. */ - break; + /* Nothing special to do for this type of object. */ + break; + case EDJE_PART_TYPE_GRADIENT: - /* FIXME: definitivly remove this code when we switch to new format. */ - abort(); - break; + /* FIXME: definitivly remove this code when we switch to new format. */ + abort(); + break; + case EDJE_PART_TYPE_SPACER: - /* We really should do nothing on SPACER part */ - break; + /* We really should do nothing on SPACER part */ + break; } if (((ep->type == EDJE_RP_TYPE_SWALLOW) && @@ -4044,8 +4124,8 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta } else { - if (ep->nested_smart) - { /* Cancel map of smart obj holding nested parts */ + if (ep->nested_smart) /* Cancel map of smart obj holding nested parts */ + { eo_do(ep->nested_smart, evas_obj_map_enable_set(EINA_FALSE), evas_obj_map_set(NULL)); @@ -4056,12 +4136,12 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta if (!ep->body) { #endif - if (mo) - eo_do(mo, - evas_obj_map_enable_set(0), - evas_obj_map_set(NULL)); + if (mo) + eo_do(mo, + evas_obj_map_enable_set(0), + evas_obj_map_set(NULL)); #ifdef HAVE_EPHYSICS - } + } #endif } } @@ -4079,7 +4159,8 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta ep->w = pf->final.w; ep->h = pf->final.h; #ifdef HAVE_EPHYSICS - } +} + #endif ep->calculated |= flags; @@ -4087,10 +4168,10 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta if (pf == &lp3) { - eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **) &lp3.map); + eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **)&lp3.map); lp3.map = NULL; #ifdef HAVE_EPHYSICS - eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **) &lp3.physics); + eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&lp3.physics); lp3.physics = NULL; #endif } @@ -4102,9 +4183,9 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta ep->invalidate = EINA_FALSE; } #else - eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **) &lp1.map); + eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **)&lp1.map); #ifdef HAVE_EPHYSICS - eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **) &lp1.physics); + eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&lp1.physics); #endif #endif } diff --git a/src/lib/edje/edje_callbacks.c b/src/lib/edje/edje_callbacks.c index a30ff7738a..f24b7c42d1 100644 --- a/src/lib/edje/edje_callbacks.c +++ b/src/lib/edje/edje_callbacks.c @@ -35,7 +35,6 @@ _edje_focus_in_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc E return EO_CALLBACK_CONTINUE; } - static Eina_Bool _edje_focus_out_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { @@ -52,7 +51,6 @@ _edje_focus_out_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc return EO_CALLBACK_CONTINUE; } - static Eina_Bool _edje_mouse_in_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info) { @@ -65,13 +63,12 @@ _edje_mouse_in_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc E rp = evas_object_data_get(obj, "real_part"); if ((!rp) || ((ev->event_flags) && - (rp->part->ignore_flags & ev->event_flags))) return EO_CALLBACK_CONTINUE; + (rp->part->ignore_flags & ev->event_flags))) return EO_CALLBACK_CONTINUE; _edje_emit(ed, "mouse,in", rp->part->name); return EO_CALLBACK_CONTINUE; } - static Eina_Bool _edje_mouse_out_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info) { @@ -84,13 +81,12 @@ _edje_mouse_out_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc rp = evas_object_data_get(obj, "real_part"); if ((!rp) || ((ev->event_flags) && - (rp->part->ignore_flags & ev->event_flags))) return EO_CALLBACK_CONTINUE; + (rp->part->ignore_flags & ev->event_flags))) return EO_CALLBACK_CONTINUE; _edje_emit(ed, "mouse,out", rp->part->name); return EO_CALLBACK_CONTINUE; } - static Eina_Bool _edje_mouse_down_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info) { @@ -112,13 +108,13 @@ _edje_mouse_down_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc if ((!ev->event_flags) || (!ignored)) { - if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK) - snprintf(buf, sizeof(buf), "mouse,down,%i,triple", ev->button); - else if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) - snprintf(buf, sizeof(buf), "mouse,down,%i,double", ev->button); - else - snprintf(buf, sizeof(buf), "mouse,down,%i", ev->button); - _edje_emit(ed, buf, rp->part->name); + if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK) + snprintf(buf, sizeof(buf), "mouse,down,%i,triple", ev->button); + else if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) + snprintf(buf, sizeof(buf), "mouse,down,%i,double", ev->button); + else + snprintf(buf, sizeof(buf), "mouse,down,%i", ev->button); + _edje_emit(ed, buf, rp->part->name); } if (rp->part->dragable.event_id >= 0) @@ -133,25 +129,25 @@ _edje_mouse_down_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc if (rp->drag) { - if (rp->drag->down.count == 0) - { - if (rp->part->dragable.x) - rp->drag->down.x = ev->canvas.x; - if (rp->part->dragable.y) - rp->drag->down.y = ev->canvas.y; + if (rp->drag->down.count == 0) + { + if (rp->part->dragable.x) + rp->drag->down.x = ev->canvas.x; + if (rp->part->dragable.y) + rp->drag->down.y = ev->canvas.y; rp->drag->threshold_x = EINA_FALSE; rp->drag->threshold_y = EINA_FALSE; rp->drag->threshold_started_x = EINA_TRUE; rp->drag->threshold_started_y = EINA_TRUE; - } - rp->drag->down.count++; + } + rp->drag->down.count++; } if (rp->clicked_button == 0) { - rp->clicked_button = ev->button; + rp->clicked_button = ev->button; if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)) - rp->still_in = EINA_TRUE; + rp->still_in = EINA_TRUE; } // _edje_recalc_do(ed); _edje_util_thaw(ed); @@ -160,7 +156,6 @@ _edje_mouse_down_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc return EO_CALLBACK_CONTINUE; } - static Eina_Bool _edje_mouse_up_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info) { @@ -182,47 +177,47 @@ _edje_mouse_up_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc E if ((!ev->event_flags) || (!ignored)) { - snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button); - _edje_emit(ed, buf, rp->part->name); + snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button); + _edje_emit(ed, buf, rp->part->name); } if (rp->part->dragable.event_id >= 0) { - rp = ed->table_parts[rp->part->dragable.event_id % ed->table_parts_size]; - if (!ignored) - { - snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button); - _edje_emit(ed, buf, rp->part->name); - } + rp = ed->table_parts[rp->part->dragable.event_id % ed->table_parts_size]; + if (!ignored) + { + snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button); + _edje_emit(ed, buf, rp->part->name); + } } if (rp->drag) { - if (rp->drag->down.count > 0) - { - rp->drag->down.count--; - if (rp->drag->down.count == 0) - { + if (rp->drag->down.count > 0) + { + rp->drag->down.count--; + if (rp->drag->down.count == 0) + { rp->drag->threshold_started_x = EINA_FALSE; rp->drag->threshold_started_y = EINA_FALSE; - rp->drag->need_reset = 1; + rp->drag->need_reset = 1; ed->recalc_call = EINA_TRUE; - ed->dirty = EINA_TRUE; + ed->dirty = EINA_TRUE; #ifdef EDJE_CALC_CACHE - rp->invalidate = EINA_TRUE; + rp->invalidate = EINA_TRUE; #endif - if (!ignored && rp->drag->started) - _edje_emit(ed, "drag,stop", rp->part->name); + if (!ignored && rp->drag->started) + _edje_emit(ed, "drag,stop", rp->part->name); rp->drag->started = EINA_FALSE; _edje_recalc_do(ed); - } - } + } + } } if ((rp->still_in) && (rp->clicked_button == ev->button) && (!ignored)) { - snprintf(buf, sizeof(buf), "mouse,clicked,%i", ev->button); - _edje_emit(ed, buf, rp->part->name); + snprintf(buf, sizeof(buf), "mouse,clicked,%i", ev->button); + _edje_emit(ed, buf, rp->part->name); } rp->clicked_button = 0; rp->still_in = EINA_FALSE; @@ -234,7 +229,6 @@ _edje_mouse_up_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc E return EO_CALLBACK_CONTINUE; } - static Eina_Bool _edje_mouse_move_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info) { @@ -260,58 +254,57 @@ _edje_mouse_move_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc if (rp->still_in) { - if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) rp->still_in = EINA_FALSE; else { - Evas_Coord x, y, w, h; - - evas_object_geometry_get(obj, &x, &y, &w, &h); - if ((ev->cur.canvas.x < x) || (ev->cur.canvas.y < y) || - (ev->cur.canvas.x >= (x + w)) || (ev->cur.canvas.y >= (y + h))) - rp->still_in = EINA_FALSE; + Evas_Coord x, y, w, h; + + evas_object_geometry_get(obj, &x, &y, &w, &h); + if ((ev->cur.canvas.x < x) || (ev->cur.canvas.y < y) || + (ev->cur.canvas.x >= (x + w)) || (ev->cur.canvas.y >= (y + h))) + rp->still_in = EINA_FALSE; } } else { if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)) { - Evas_Coord x, y, w, h; + Evas_Coord x, y, w, h; - evas_object_geometry_get(obj, &x, &y, &w, &h); - if ((ev->cur.canvas.x >= x) && (ev->cur.canvas.y >= y) && - (ev->cur.canvas.x < (x + w)) && (ev->cur.canvas.y < (y + h))) - rp->still_in = EINA_TRUE; + evas_object_geometry_get(obj, &x, &y, &w, &h); + if ((ev->cur.canvas.x >= x) && (ev->cur.canvas.y >= y) && + (ev->cur.canvas.x < (x + w)) && (ev->cur.canvas.y < (y + h))) + rp->still_in = EINA_TRUE; } } _edje_util_freeze(ed); if (rp->drag) { - if (rp->drag->down.count > 0) - { - if (rp->part->dragable.x) - rp->drag->tmp.x = ev->cur.canvas.x - rp->drag->down.x; - if (rp->part->dragable.y) - rp->drag->tmp.y = ev->cur.canvas.y - rp->drag->down.y; + if (rp->drag->down.count > 0) + { + if (rp->part->dragable.x) + rp->drag->tmp.x = ev->cur.canvas.x - rp->drag->down.x; + if (rp->part->dragable.y) + rp->drag->tmp.y = ev->cur.canvas.y - rp->drag->down.y; ed->recalc_call = EINA_TRUE; - ed->dirty = EINA_TRUE; + ed->dirty = EINA_TRUE; #ifdef EDJE_CALC_CACHE - rp->invalidate = EINA_TRUE; + rp->invalidate = EINA_TRUE; #endif - } - _edje_recalc_do(ed); + } + _edje_recalc_do(ed); - if (rp->drag->down.count > 0) - { - FLOAT_T dx, dy; + if (rp->drag->down.count > 0) + { + FLOAT_T dx, dy; - _edje_part_dragable_calc(ed, rp, &dx, &dy); - if ((dx != rp->drag->val.x) || (dy != rp->drag->val.y)) - { - rp->drag->val.x = dx; - rp->drag->val.y = dy; - if (!ignored) + _edje_part_dragable_calc(ed, rp, &dx, &dy); + if ((dx != rp->drag->val.x) || (dy != rp->drag->val.y)) + { + rp->drag->val.x = dx; + rp->drag->val.y = dy; + if (!ignored) { if (!rp->drag->started) _edje_emit(ed, "drag,start", rp->part->name); @@ -319,13 +312,13 @@ _edje_mouse_move_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc rp->drag->started = EINA_TRUE; } ed->recalc_call = EINA_TRUE; - ed->dirty = EINA_TRUE; + ed->dirty = EINA_TRUE; #ifdef EDJE_CALC_CACHE - rp->invalidate = EINA_TRUE; + rp->invalidate = EINA_TRUE; #endif - _edje_recalc_do(ed); - } - } + _edje_recalc_do(ed); + } + } } _edje_unref(ed); _edje_util_thaw(ed); @@ -333,7 +326,6 @@ _edje_mouse_move_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc return EO_CALLBACK_CONTINUE; } - static Eina_Bool _edje_mouse_wheel_signal_cb(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info) { @@ -345,9 +337,9 @@ _edje_mouse_wheel_signal_cb(void *data, Eo *obj, const Eo_Event_Description *des ev = event_info; ed = data; rp = evas_object_data_get(obj, "real_part"); - if ((!rp) || - ((ev->event_flags) && - (!(rp->part->ignore_flags & ev->event_flags)))) return EO_CALLBACK_CONTINUE; + if ((!rp) || + ((ev->event_flags) && + (!(rp->part->ignore_flags & ev->event_flags)))) return EO_CALLBACK_CONTINUE; snprintf(buf, sizeof(buf), "mouse,wheel,%i,%i", ev->direction, (ev->z < 0) ? (-1) : (1)); _edje_emit(ed, buf, rp->part->name); @@ -355,7 +347,6 @@ _edje_mouse_wheel_signal_cb(void *data, Eo *obj, const Eo_Event_Description *des return EO_CALLBACK_CONTINUE; } - Eina_Bool _edje_timer_cb(void *data EINA_UNUSED) { @@ -367,64 +358,64 @@ _edje_timer_cb(void *data EINA_UNUSED) t = ecore_loop_time_get(); EINA_LIST_FOREACH(_edje_animators, l, ed) { - _edje_ref(ed); - animl = eina_list_append(animl, ed); + _edje_ref(ed); + animl = eina_list_append(animl, ed); } while (animl) { - Eina_List *newl = NULL; + Eina_List *newl = NULL; - ed = eina_list_data_get(animl); - _edje_block(ed); - _edje_util_freeze(ed); - animl = eina_list_remove(animl, eina_list_data_get(animl)); - if ((!ed->paused) && (!ed->delete_me)) - { - const void *tmp; + ed = eina_list_data_get(animl); + _edje_block(ed); + _edje_util_freeze(ed); + animl = eina_list_remove(animl, eina_list_data_get(animl)); + if ((!ed->paused) && (!ed->delete_me)) + { + const void *tmp; - ed->walking_actions = EINA_TRUE; - EINA_LIST_FOREACH(ed->actions, l, tmp) - newl = eina_list_append(newl, tmp); - while (newl) - { - Edje_Running_Program *runp; + ed->walking_actions = EINA_TRUE; + EINA_LIST_FOREACH(ed->actions, l, tmp) + newl = eina_list_append(newl, tmp); + while (newl) + { + Edje_Running_Program *runp; - runp = eina_list_data_get(newl); - newl = eina_list_remove(newl, eina_list_data_get(newl)); - if (!runp->delete_me) - _edje_program_run_iterate(runp, t); - if (_edje_block_break(ed)) - { - eina_list_free(newl); - newl = NULL; - goto break_prog; - } - } - EINA_LIST_FOREACH(ed->actions, l, tmp) - newl = eina_list_append(newl, tmp); - while (newl) - { - Edje_Running_Program *runp; + runp = eina_list_data_get(newl); + newl = eina_list_remove(newl, eina_list_data_get(newl)); + if (!runp->delete_me) + _edje_program_run_iterate(runp, t); + if (_edje_block_break(ed)) + { + eina_list_free(newl); + newl = NULL; + goto break_prog; + } + } + EINA_LIST_FOREACH(ed->actions, l, tmp) + newl = eina_list_append(newl, tmp); + while (newl) + { + Edje_Running_Program *runp; - runp = eina_list_data_get(newl); - newl = eina_list_remove(newl, eina_list_data_get(newl)); - if (runp->delete_me) - { - _edje_anim_count--; - runp->edje->actions = - eina_list_remove(runp->edje->actions, runp); - if (!runp->edje->actions) - _edje_animators = - eina_list_remove(_edje_animators, runp->edje); - free(runp); - } - } - ed->walking_actions = EINA_FALSE; - } - break_prog: - _edje_unblock(ed); - _edje_util_thaw(ed); - _edje_unref(ed); + runp = eina_list_data_get(newl); + newl = eina_list_remove(newl, eina_list_data_get(newl)); + if (runp->delete_me) + { + _edje_anim_count--; + runp->edje->actions = + eina_list_remove(runp->edje->actions, runp); + if (!runp->edje->actions) + _edje_animators = + eina_list_remove(_edje_animators, runp->edje); + free(runp); + } + } + ed->walking_actions = EINA_FALSE; + } +break_prog: + _edje_unblock(ed); + _edje_util_thaw(ed); + _edje_unref(ed); } if (_edje_anim_count > 0) return ECORE_CALLBACK_RENEW; _edje_timer = NULL; @@ -483,3 +474,4 @@ _edje_callbacks_focus_del(Evas_Object *obj, Edje *ed) eo_do(obj, eo_event_callback_array_del(edje_focus_callbacks(), ed)); evas_object_data_del(obj, "real_part"); } + diff --git a/src/lib/edje/edje_container.c b/src/lib/edje/edje_container.c index 8a9ff712b3..6bf428f921 100644 --- a/src/lib/edje/edje_container.c +++ b/src/lib/edje/edje_container.c @@ -14,7 +14,8 @@ _edje_container_relayout(Smart_Data *sd) if (!sd->need_layout) return; if (sd->w < sd->min_w) sw = sd->min_w; - else if (sd->w > sd->max_w) sw = sd->max_w; + else if (sd->w > sd->max_w) + sw = sd->max_w; else sw = sd->w; y = 0; @@ -24,10 +25,10 @@ _edje_container_relayout(Smart_Data *sd) EINA_LIST_FOREACH(sd->children, l, ei) { - if (sd->homogenous) h = sd->min_row_h; + if (sd->homogenous) h = sd->min_row_h; - ei->y = y; - ei->h = h; + ei->y = y; + ei->h = h; // ei->w = w; // ei->h = h; } @@ -57,16 +58,16 @@ _edje_container_recalc(Smart_Data *sd) for (i = 0; i < sd->cols; i++) { - sd->min_w += sd->colinfo[i].minw; - if (sd->colinfo[i].maxw >= 0) - { - if (sd->max_w >= 0) - sd->max_w += sd->colinfo[i].maxw; - else - sd->max_w = sd->colinfo[i].maxw; - } - else - any_max_w = 1; + sd->min_w += sd->colinfo[i].minw; + if (sd->colinfo[i].maxw >= 0) + { + if (sd->max_w >= 0) + sd->max_w += sd->colinfo[i].maxw; + else + sd->max_w = sd->colinfo[i].maxw; + } + else + any_max_w = 1; } if (any_max_w) sd->max_w = -1; @@ -77,37 +78,37 @@ _edje_container_recalc(Smart_Data *sd) EINA_LIST_FOREACH(sd->children, l, ei) { - if (ei->minh > sd->min_row_h) - sd->min_row_h = ei->minh; - if (sd->max_row_h >= 0) - { - if (ei->maxh >= 0) - { - if (sd->max_row_h > ei->maxh) - sd->max_row_h = ei->maxh; - } - else - any_max_h = 1; - } - sd->min_h += ei->minh; - if (ei->maxh >= 0) - { - if (sd->max_h >= 0) - sd->max_h += ei->maxh; - else - sd->max_h = ei->maxh; - } - else - any_max_h = 1; + if (ei->minh > sd->min_row_h) + sd->min_row_h = ei->minh; + if (sd->max_row_h >= 0) + { + if (ei->maxh >= 0) + { + if (sd->max_row_h > ei->maxh) + sd->max_row_h = ei->maxh; + } + else + any_max_h = 1; + } + sd->min_h += ei->minh; + if (ei->maxh >= 0) + { + if (sd->max_h >= 0) + sd->max_h += ei->maxh; + else + sd->max_h = ei->maxh; + } + else + any_max_h = 1; } if (any_max_h) { - sd->max_h = -1; - sd->max_row_h = -1; + sd->max_h = -1; + sd->max_row_h = -1; } if (sd->homogenous) { - sd->min_h = eina_list_count(sd->children) * sd->min_row_h; + sd->min_h = eina_list_count(sd->children) * sd->min_row_h; } sd->changed = 0; @@ -132,29 +133,29 @@ _edje_item_recalc(Edje_Item *ei) ei->maxh = -1; for (i = 0; i < ((Smart_Data *)(ei->sd))->cols; i++) { - if (ei->cells[i].minh > ei->minh) ei->minh = ei->cells[i].minh; - if (ei->cells[i].maxh >= 0) - { - if (ei->maxh >= 0) - { - if (ei->cells[i].maxh < ei->maxh) - ei->maxh = ei->cells[i].maxh; - } - else - ei->maxh = ei->cells[i].maxh; - } - if (((Smart_Data *)(ei->sd))->colinfo[i].minw < ei->cells[i].minw) - ((Smart_Data *)(ei->sd))->colinfo[i].minw = ei->cells[i].minw; - if (((Smart_Data *)(ei->sd))->colinfo[i].maxw >= 0) - { - if (ei->cells[i].maxw >= 0) - { - if (((Smart_Data *)(ei->sd))->colinfo[i].maxw > ei->cells[i].maxw) - ((Smart_Data *)(ei->sd))->colinfo[i].maxw = ei->cells[i].maxw; - } - } - else - ((Smart_Data *)(ei->sd))->colinfo[i].maxw = ei->cells[i].maxw; + if (ei->cells[i].minh > ei->minh) ei->minh = ei->cells[i].minh; + if (ei->cells[i].maxh >= 0) + { + if (ei->maxh >= 0) + { + if (ei->cells[i].maxh < ei->maxh) + ei->maxh = ei->cells[i].maxh; + } + else + ei->maxh = ei->cells[i].maxh; + } + if (((Smart_Data *)(ei->sd))->colinfo[i].minw < ei->cells[i].minw) + ((Smart_Data *)(ei->sd))->colinfo[i].minw = ei->cells[i].minw; + if (((Smart_Data *)(ei->sd))->colinfo[i].maxw >= 0) + { + if (ei->cells[i].maxw >= 0) + { + if (((Smart_Data *)(ei->sd))->colinfo[i].maxw > ei->cells[i].maxw) + ((Smart_Data *)(ei->sd))->colinfo[i].maxw = ei->cells[i].maxw; + } + } + else + ((Smart_Data *)(ei->sd))->colinfo[i].maxw = ei->cells[i].maxw; } ei->recalc = EINA_FALSE; @@ -162,19 +163,18 @@ _edje_item_recalc(Edje_Item *ei) _edje_container_recalc(ei->sd); } - /*****************************/ /** * @endcond */ /*============================================================================* - * Global * - *============================================================================*/ +* Global * +*============================================================================*/ /*============================================================================* - * API * - *============================================================================*/ +* API * +*============================================================================*/ /** * @addtogroup Edje_container_Group Container @@ -311,15 +311,13 @@ edje_item_overlay_object_set(Edje_Item *ei, Evas_Object *obj) { if (ei->overlay_object) { - /* FIXME: if it changed - remove...*/ + /* FIXME: if it changed - remove...*/ } ei->overlay_object = obj; if (ei->sd) evas_object_smart_member_add(((Smart_Data *)(ei->sd))->smart_obj, obj); } - - Evas_Object * edje_item_overlay_object_get(Edje_Item *ei) { @@ -332,7 +330,7 @@ edje_item_object_set(Edje_Item *ei, Evas_Object *obj) { if (ei->object) { - /* FIXME: if it changed - remove...*/ + /* FIXME: if it changed - remove...*/ } ei->object = obj; if (ei->sd) @@ -351,9 +349,9 @@ edje_item_object_column_set(Edje_Item *ei, int col, Evas_Object *obj) { if (ei->cells_num <= (col + 1)) { - /* FIXME: unsafe realloc */ - ei->cells = realloc(ei->cells, sizeof(Edje_Item_Cell) * col); - ei->cells_num = col + 1; + /* FIXME: unsafe realloc */ + ei->cells = realloc(ei->cells, sizeof(Edje_Item_Cell) * col); + ei->cells_num = col + 1; } ei->cells[col].obj = obj; } @@ -371,11 +369,11 @@ edje_item_geometry_get(Edje_Item *ei, Evas_Coord *x, Evas_Coord *y, Evas_Coord * { if (!ei->sd) { - if (x) *x = 0; - if (y) *y = 0; - if (w) *w = 0; - if (h) *h = 0; - return; + if (x) *x = 0; + if (y) *y = 0; + if (w) *w = 0; + if (h) *h = 0; + return; } if (x) *x = ((Smart_Data *)(ei->sd))->x; if (y) *y = ((Smart_Data *)(ei->sd))->y + ei->y; @@ -407,9 +405,9 @@ edje_item_column_size_set(Edje_Item *ei, int col, Evas_Coord minw, Evas_Coord ma { if (ei->cells_num <= (col + 1)) { - /* FIXME: unsafe realloc */ - ei->cells = realloc(ei->cells, sizeof(Edje_Item_Cell) * col); - ei->cells_num = col + 1; + /* FIXME: unsafe realloc */ + ei->cells = realloc(ei->cells, sizeof(Edje_Item_Cell) * col); + ei->cells_num = col + 1; } if ((ei->cells[col].minw == minw) && (ei->cells[col].minh == minh) && @@ -422,8 +420,8 @@ edje_item_column_size_set(Edje_Item *ei, int col, Evas_Coord minw, Evas_Coord ma ei->recalc = EINA_TRUE; if (ei->sd) { - ((Smart_Data *)(ei->sd))->changed = 1; - ((Smart_Data *)(ei->sd))->change_child = 1; + ((Smart_Data *)(ei->sd))->changed = 1; + ((Smart_Data *)(ei->sd))->change_child = 1; } _edje_item_recalc(ei); } @@ -433,10 +431,10 @@ edje_item_column_size_get(Edje_Item *ei, int col, Evas_Coord *minw, Evas_Coord * { if (ei->cells_num <= (col + 1)) { - if (minw) *minw = 0; - if (minh) *minh = 0; - if (maxw) *maxw = -1; - if (maxh) *maxh = -1; + if (minw) *minw = 0; + if (minh) *minh = 0; + if (maxw) *maxw = -1; + if (maxh) *maxh = -1; } if (minw) *minw = ei->cells[col].minw; if (minh) *minh = ei->cells[col].minh; @@ -629,13 +627,13 @@ edje_container_columns_set(Evas_Object *obj, int cols) sd->colinfo = realloc(sd->colinfo, cols * sizeof(Smart_Data_Colinfo)); if (cols > sd->cols) { - int i; + int i; - for (i = sd->cols; i < cols; i++) - { - sd->colinfo[i].minw = 0; - sd->colinfo[i].maxw = -1; - } + for (i = sd->cols; i < cols; i++) + { + sd->colinfo[i].minw = 0; + sd->colinfo[i].maxw = -1; + } } sd->cols = cols; sd->changed = 1; @@ -662,12 +660,12 @@ edje_container_min_size_get(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh if (!sd) return; if (sd->changed) { - int freeze; + int freeze; - freeze = sd->freeze; - sd->freeze = 0; - _edje_container_recalc(sd); - sd->freeze = freeze; + freeze = sd->freeze; + sd->freeze = 0; + _edje_container_recalc(sd); + sd->freeze = freeze; } if (minw) *minw = sd->min_w; if (minh) *minh = sd->min_h; @@ -682,12 +680,12 @@ edje_container_max_size_get(Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh if (!sd) return; if (sd->changed) { - int freeze; + int freeze; - freeze = sd->freeze; - sd->freeze = 0; - _edje_container_recalc(sd); - sd->freeze = freeze; + freeze = sd->freeze; + sd->freeze = 0; + _edje_container_recalc(sd); + sd->freeze = freeze; } if (maxw) *maxw = sd->max_w; if (maxh) *maxh = sd->max_h; @@ -811,17 +809,17 @@ edje_container_scroll_get(Evas_Object *obj, double *pos, double *shift) } static void _smart_init(void); -static void _smart_add(Evas_Object * obj); -static void _smart_del(Evas_Object * obj); -static void _smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y); -static void _smart_resize(Evas_Object * obj, Evas_Coord w, Evas_Coord h); -static void _smart_show(Evas_Object * obj); -static void _smart_hide(Evas_Object * obj); -static void _smart_color_set(Evas_Object * obj, int r, int g, int b, int a); -static void _smart_clip_set(Evas_Object * obj, Evas_Object * clip); -static void _smart_clip_unset(Evas_Object * obj); +static void _smart_add(Evas_Object *obj); +static void _smart_del(Evas_Object *obj); +static void _smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y); +static void _smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h); +static void _smart_show(Evas_Object *obj); +static void _smart_hide(Evas_Object *obj); +static void _smart_color_set(Evas_Object *obj, int r, int g, int b, int a); +static void _smart_clip_set(Evas_Object *obj, Evas_Object *clip); +static void _smart_clip_unset(Evas_Object *obj); -static Evas_Smart *smart = NULL; +static Evas_Smart *smart = NULL; Evas_Object * edje_container_object_add(Evas *evas) @@ -837,25 +835,25 @@ static void _smart_init(void) { if (smart) return; - { - static const Evas_Smart_Class sc = - { - E_OBJ_NAME, - _smart_add, - _smart_del, - _smart_move, - _smart_resize, - _smart_show, - _smart_hide, - _smart_color_set, - _smart_clip_set, - _smart_clip_unset, - NULL, - NULL, - NULL - }; - smart = evas_smart_class_new(&sc); - } + { + static const Evas_Smart_Class sc = + { + E_OBJ_NAME, + _smart_add, + _smart_del, + _smart_move, + _smart_resize, + _smart_show, + _smart_hide, + _smart_color_set, + _smart_clip_set, + _smart_clip_unset, + NULL, + NULL, + NULL + }; + smart = evas_smart_class_new(&sc); + } } static void diff --git a/src/lib/edje/edje_convert.c b/src/lib/edje/edje_convert.c index 4a04ff4d1a..da2a74563a 100644 --- a/src/lib/edje/edje_convert.c +++ b/src/lib/edje/edje_convert.c @@ -34,7 +34,7 @@ _edje_collection_string_free(void *data) { Edje_File *edf; - edf = (Edje_File*) _edje_file_get(); + edf = (Edje_File *)_edje_file_get(); if (!edf->warning) CRI("This program as probably called edje_shutdown() with " @@ -78,8 +78,8 @@ _edje_file_convert_external(Edje_File *edf, Old_Edje_File *oedf) EINA_LIST_FREE(oedf->external_dir->entries, ede) { - edf->external_dir->entries[i++].entry = ede->entry; - free(ede); + edf->external_dir->entries[i++].entry = ede->entry; + free(ede); } free(oedf->external_dir); @@ -113,10 +113,10 @@ _edje_file_convert_images(Edje_File *edf, Old_Edje_File *oedf) EINA_LIST_FREE(oedf->image_dir->entries, de) { - memcpy(edf->image_dir->entries + de->id, - de, - sizeof (Edje_Image_Directory_Entry)); - free(de); + memcpy(edf->image_dir->entries + de->id, + de, + sizeof (Edje_Image_Directory_Entry)); + free(de); } max = -1; @@ -129,17 +129,17 @@ _edje_file_convert_images(Edje_File *edf, Old_Edje_File *oedf) if (!edf->image_dir->sets && edf->image_dir->sets_count) { - free(edf->image_dir->entries); - edf->image_dir->entries = NULL; - return EINA_FALSE; + free(edf->image_dir->entries); + edf->image_dir->entries = NULL; + return EINA_FALSE; } EINA_LIST_FREE(oedf->image_dir->sets, ds) { - memcpy(edf->image_dir->sets + ds->id, - ds, - sizeof (Edje_Image_Directory_Set)); - free(ds); + memcpy(edf->image_dir->sets + ds->id, + ds, + sizeof (Edje_Image_Directory_Set)); + free(ds); } return EINA_TRUE; @@ -161,15 +161,15 @@ _edje_file_convert(Eet_File *file, Old_Edje_File *oedf) if (edf->free_strings) { - edf->fonts = eina_hash_string_small_new(_edje_font_string_free); - edf->collection = eina_hash_string_small_new(_edje_collection_string_free); - edf->data = eina_hash_string_small_new((Eina_Free_Cb) eina_stringshare_del); + edf->fonts = eina_hash_string_small_new(_edje_font_string_free); + edf->collection = eina_hash_string_small_new(_edje_collection_string_free); + edf->data = eina_hash_string_small_new((Eina_Free_Cb)eina_stringshare_del); } else { - edf->fonts = eina_hash_string_small_new(free); - edf->collection = eina_hash_string_small_new(free); - edf->data = eina_hash_string_small_new(NULL); + edf->fonts = eina_hash_string_small_new(free); + edf->collection = eina_hash_string_small_new(free); + edf->data = eina_hash_string_small_new(NULL); } if (!edf->fonts || !edf->collection || !edf->data) @@ -177,8 +177,8 @@ _edje_file_convert(Eet_File *file, Old_Edje_File *oedf) EINA_LIST_FREE(oedf->data, ed) { - eina_hash_direct_add(edf->data, ed->key, ed->value); - free(ed); + eina_hash_direct_add(edf->data, ed->key, ed->value); + free(ed); } EINA_LIST_FOREACH(oedf->collection_dir->entries, l, ce) @@ -188,19 +188,19 @@ _edje_file_convert(Eet_File *file, Old_Edje_File *oedf) if (oedf->font_dir) EINA_LIST_FOREACH(oedf->font_dir->entries, l, fnt) { - char *tmp; - int length; + char *tmp; + int length; - length = strlen(fnt->entry) + 7; - tmp = alloca(length); + length = strlen(fnt->entry) + 7; + tmp = alloca(length); - snprintf(tmp, length, "fonts/%s", fnt->entry); - fnt->path = eina_stringshare_add(tmp); - if (edf->free_strings) - eina_stringshare_del(fnt->entry); - fnt->entry = fnt->path + 6; + snprintf(tmp, length, "fonts/%s", fnt->entry); + fnt->path = eina_stringshare_add(tmp); + if (edf->free_strings) + eina_stringshare_del(fnt->entry); + fnt->entry = fnt->path + 6; - eina_hash_direct_add(edf->fonts, fnt->entry, fnt); + eina_hash_direct_add(edf->fonts, fnt->entry, fnt); } if (!_edje_file_convert_images(edf, oedf)) @@ -226,7 +226,7 @@ _edje_file_convert(Eet_File *file, Old_Edje_File *oedf) return edf; - on_error: +on_error: eina_hash_free(edf->fonts); eina_hash_free(edf->collection); eina_hash_free(edf->data); @@ -238,12 +238,12 @@ _edje_file_convert(Eet_File *file, Old_Edje_File *oedf) static void _edje_collection_program_add(Edje_Program ***array, - unsigned int *count, - Edje_Program *add) + unsigned int *count, + Edje_Program *add) { Edje_Program **tmp; - tmp = realloc(*array, sizeof (Edje_Program*) * (*count + 1)); + tmp = realloc(*array, sizeof (Edje_Program *) * (*count + 1)); if (!tmp) return; tmp[(*count)++] = add; @@ -266,37 +266,37 @@ _edje_collection_convert(Edje_File *file, Old_Edje_Part_Collection *oedc) /* Count each type part and their respective state */ EINA_LIST_FOREACH(oedc->parts, l, part) { - int *count; - int dummy = 0; + int *count; + int dummy = 0; + switch (part->type) + { +#define CSP(Tp, Ce) \ +case EDJE_PART_TYPE_##Tp: \ + count = &Ce->count.Tp; \ + break; - switch (part->type) - { -#define CSP(Tp, Ce) \ - case EDJE_PART_TYPE_##Tp : \ - count = &Ce->count.Tp; \ - break; + CSP(RECTANGLE, ce); + CSP(TEXT, ce); + CSP(IMAGE, ce); + CSP(SWALLOW, ce); + CSP(TEXTBLOCK, ce); + CSP(GROUP, ce); + CSP(BOX, ce); + CSP(TABLE, ce); + CSP(EXTERNAL, ce); - CSP(RECTANGLE, ce); - CSP(TEXT, ce); - CSP(IMAGE, ce); - CSP(SWALLOW, ce); - CSP(TEXTBLOCK, ce); - CSP(GROUP, ce); - CSP(BOX, ce); - CSP(TABLE, ce); - CSP(EXTERNAL, ce); - default: - count = &dummy; - break; - } + default: + count = &dummy; + break; + } - *count += eina_list_count(part->other_desc) + 1; + *count += eina_list_count(part->other_desc) + 1; } ce->count.part = eina_list_count(oedc->parts); -#define CONVERT_EMN(Tp, Sz, Ce) \ - Ce->mp.Tp = eina_mempool_add("one_big", #Tp, NULL, sizeof (Sz), Ce->count.Tp); +#define CONVERT_EMN(Tp, Sz, Ce) \ + Ce->mp.Tp = eina_mempool_add("one_big", #Tp, NULL, sizeof (Sz), Ce->count.Tp); CONVERT_EMN(RECTANGLE, Edje_Part_Description_Common, ce); CONVERT_EMN(TEXT, Edje_Part_Description_Text, ce); @@ -316,36 +316,36 @@ _edje_collection_convert(Edje_File *file, Old_Edje_Part_Collection *oedc) EINA_LIST_FREE(oedc->programs, pg) { - if (!pg->signal && !pg->source) - _edje_collection_program_add(&edc->programs.nocmp, - &edc->programs.nocmp_count, - pg); - else if (pg->signal && !strpbrk(pg->signal, "*?[\\") - && pg->source && !strpbrk(pg->source, "*?[\\")) - _edje_collection_program_add(&edc->programs.strcmp, - &edc->programs.strcmp_count, - pg); - else if (pg->signal && edje_program_is_strncmp(pg->signal) - && pg->source && edje_program_is_strncmp(pg->source)) - _edje_collection_program_add(&edc->programs.strncmp, - &edc->programs.strncmp_count, - pg); - else if (pg->signal && edje_program_is_strrncmp(pg->signal) - && pg->source && edje_program_is_strrncmp(pg->source)) - _edje_collection_program_add(&edc->programs.strrncmp, - &edc->programs.strrncmp_count, - pg); - else - _edje_collection_program_add(&edc->programs.fnmatch, - &edc->programs.fnmatch_count, - pg); + if (!pg->signal && !pg->source) + _edje_collection_program_add(&edc->programs.nocmp, + &edc->programs.nocmp_count, + pg); + else if (pg->signal && !strpbrk(pg->signal, "*?[\\") + && pg->source && !strpbrk(pg->source, "*?[\\")) + _edje_collection_program_add(&edc->programs.strcmp, + &edc->programs.strcmp_count, + pg); + else if (pg->signal && edje_program_is_strncmp(pg->signal) + && pg->source && edje_program_is_strncmp(pg->source)) + _edje_collection_program_add(&edc->programs.strncmp, + &edc->programs.strncmp_count, + pg); + else if (pg->signal && edje_program_is_strrncmp(pg->signal) + && pg->source && edje_program_is_strrncmp(pg->source)) + _edje_collection_program_add(&edc->programs.strrncmp, + &edc->programs.strrncmp_count, + pg); + else + _edje_collection_program_add(&edc->programs.fnmatch, + &edc->programs.fnmatch_count, + pg); } edc->data = eina_hash_string_small_new(NULL); EINA_LIST_FREE(oedc->data, di) { - eina_hash_direct_add(edc->data, di->key, di->value); - free(di); + eina_hash_direct_add(edc->data, di->key, di->value); + free(di); } edc->parts_count = eina_list_count(oedc->parts); @@ -354,56 +354,56 @@ _edje_collection_convert(Edje_File *file, Old_Edje_Part_Collection *oedc) EINA_LIST_FREE(oedc->parts, part) { - Old_Edje_Part_Description *oepd; - Edje_Pack_Element *elm; - Edje_Part *replacement; - unsigned int i; + Old_Edje_Part_Description *oepd; + Edje_Pack_Element *elm; + Edje_Part *replacement; + unsigned int i; - replacement = eina_mempool_malloc(ce->mp.part, sizeof (Edje_Part)); + replacement = eina_mempool_malloc(ce->mp.part, sizeof (Edje_Part)); - replacement->name = part->name; - replacement->default_desc = _edje_description_convert(part->type, ce, part->default_desc); + replacement->name = part->name; + replacement->default_desc = _edje_description_convert(part->type, ce, part->default_desc); - replacement->other_count = eina_list_count(part->other_desc); - replacement->other_desc = calloc(replacement->other_count, sizeof (Edje_Part_Description_Common*)); + replacement->other_count = eina_list_count(part->other_desc); + replacement->other_desc = calloc(replacement->other_count, sizeof (Edje_Part_Description_Common *)); - i = 0; - EINA_LIST_FREE(part->other_desc, oepd) - replacement->other_desc[i++] = _edje_description_convert(part->type, ce, oepd); + i = 0; + EINA_LIST_FREE(part->other_desc, oepd) + replacement->other_desc[i++] = _edje_description_convert(part->type, ce, oepd); - replacement->source = part->source; - replacement->source2 = part->source2; - replacement->source3 = part->source3; - replacement->source4 = part->source4; - replacement->source5 = part->source5; - replacement->source6 = part->source6; - replacement->id = part->id; - replacement->clip_to_id = part->clip_to_id; - replacement->dragable = part->dragable; - replacement->items_count = eina_list_count(part->items); - replacement->items = calloc(replacement->items_count, sizeof (Edje_Pack_Element*)); + replacement->source = part->source; + replacement->source2 = part->source2; + replacement->source3 = part->source3; + replacement->source4 = part->source4; + replacement->source5 = part->source5; + replacement->source6 = part->source6; + replacement->id = part->id; + replacement->clip_to_id = part->clip_to_id; + replacement->dragable = part->dragable; + replacement->items_count = eina_list_count(part->items); + replacement->items = calloc(replacement->items_count, sizeof (Edje_Pack_Element *)); - i = 0; - EINA_LIST_FREE(part->items, elm) - replacement->items[i++] = elm; + i = 0; + EINA_LIST_FREE(part->items, elm) + replacement->items[i++] = elm; - replacement->type = part->type; - replacement->effect = part->effect; - replacement->mouse_events = part->mouse_events; - replacement->repeat_events = part->repeat_events; - replacement->ignore_flags = part->ignore_flags; - replacement->scale = part->scale; - replacement->precise_is_inside = part->precise_is_inside; - replacement->use_alternate_font_metrics = part->use_alternate_font_metrics; - replacement->pointer_mode = part->pointer_mode; - replacement->entry_mode = part->entry_mode; - replacement->select_mode = part->select_mode; - replacement->multiline = part->multiline; - replacement->api = part->api; + replacement->type = part->type; + replacement->effect = part->effect; + replacement->mouse_events = part->mouse_events; + replacement->repeat_events = part->repeat_events; + replacement->ignore_flags = part->ignore_flags; + replacement->scale = part->scale; + replacement->precise_is_inside = part->precise_is_inside; + replacement->use_alternate_font_metrics = part->use_alternate_font_metrics; + replacement->pointer_mode = part->pointer_mode; + replacement->entry_mode = part->entry_mode; + replacement->select_mode = part->select_mode; + replacement->multiline = part->multiline; + replacement->api = part->api; - edc->parts[k++] = replacement; + edc->parts[k++] = replacement; - free(part); + free(part); } edc->id = oedc->id; @@ -420,75 +420,77 @@ _edje_collection_convert(Edje_File *file, Old_Edje_Part_Collection *oedc) return edc; } -Edje_Part_Description_Common* +Edje_Part_Description_Common * _edje_description_convert(int type, - Edje_Part_Collection_Directory_Entry *ce, - Old_Edje_Part_Description *oed) + Edje_Part_Collection_Directory_Entry *ce, + Old_Edje_Part_Description *oed) { Edje_Part_Description_Common *result = NULL; switch (type) { case EDJE_PART_TYPE_RECTANGLE: - result = eina_mempool_malloc(ce->mp.RECTANGLE, - sizeof (Edje_Part_Description_Common)); - break; + result = eina_mempool_malloc(ce->mp.RECTANGLE, + sizeof (Edje_Part_Description_Common)); + break; + case EDJE_PART_TYPE_SWALLOW: - result = eina_mempool_malloc(ce->mp.SWALLOW, - sizeof (Edje_Part_Description_Common)); - break; + result = eina_mempool_malloc(ce->mp.SWALLOW, + sizeof (Edje_Part_Description_Common)); + break; + case EDJE_PART_TYPE_GROUP: - result = eina_mempool_malloc(ce->mp.GROUP, - sizeof (Edje_Part_Description_Common)); - break; + result = eina_mempool_malloc(ce->mp.GROUP, + sizeof (Edje_Part_Description_Common)); + break; case EDJE_PART_TYPE_IMAGE: - { - Edje_Part_Description_Image *img; - Edje_Part_Image_Id *id; - unsigned int i = 0; + { + Edje_Part_Description_Image *img; + Edje_Part_Image_Id *id; + unsigned int i = 0; - img = eina_mempool_malloc(ce->mp.IMAGE, sizeof (Edje_Part_Description_Image)); + img = eina_mempool_malloc(ce->mp.IMAGE, sizeof (Edje_Part_Description_Image)); - img->image.tweens_count = eina_list_count(oed->image.tween_list); - img->image.tweens = calloc(img->image.tweens_count, - sizeof (Edje_Part_Image_Id*)); - if (img->image.tweens_count > 0 && !img->image.tweens) - { - eina_mempool_free(ce->mp.IMAGE, img); - return NULL; - } + img->image.tweens_count = eina_list_count(oed->image.tween_list); + img->image.tweens = calloc(img->image.tweens_count, + sizeof (Edje_Part_Image_Id *)); + if (img->image.tweens_count > 0 && !img->image.tweens) + { + eina_mempool_free(ce->mp.IMAGE, img); + return NULL; + } - EINA_LIST_FREE(oed->image.tween_list, id) - img->image.tweens[i++] = id; + EINA_LIST_FREE(oed->image.tween_list, id) + img->image.tweens[i++] = id; - img->image.id = oed->image.id; - img->image.scale_hint = oed->image.scale_hint; - img->image.set = oed->image.set; + img->image.id = oed->image.id; + img->image.scale_hint = oed->image.scale_hint; + img->image.set = oed->image.set; - img->image.border = oed->image.border; - img->image.fill = oed->image.fill; + img->image.border = oed->image.border; + img->image.fill = oed->image.fill; - result = &img->common; - break; - } + result = &img->common; + break; + } -#define CONVERT_ALLOC_POOL(Short, Type, Name) \ - case EDJE_PART_TYPE_##Short: \ - { \ - Edje_Part_Description_##Type *Name; \ - \ - Name = eina_mempool_malloc(ce->mp.Short, sizeof (Edje_Part_Description_##Type)); \ - Name->Name = oed->Name; \ - result = &Name->common; \ - break; \ - } +#define CONVERT_ALLOC_POOL(Short, Type, Name) \ +case EDJE_PART_TYPE_##Short: \ +{ \ + Edje_Part_Description_##Type * Name; \ + \ + Name = eina_mempool_malloc(ce->mp.Short, sizeof (Edje_Part_Description_##Type)); \ + Name->Name = oed->Name; \ + result = &Name->common; \ + break; \ +} - CONVERT_ALLOC_POOL(TEXT, Text, text); - CONVERT_ALLOC_POOL(TEXTBLOCK, Text, text); - CONVERT_ALLOC_POOL(BOX, Box, box); - CONVERT_ALLOC_POOL(TABLE, Table, table); - CONVERT_ALLOC_POOL(EXTERNAL, External, external_params); + CONVERT_ALLOC_POOL(TEXT, Text, text); + CONVERT_ALLOC_POOL(TEXTBLOCK, Text, text); + CONVERT_ALLOC_POOL(BOX, Box, box); + CONVERT_ALLOC_POOL(TABLE, Table, table); + CONVERT_ALLOC_POOL(EXTERNAL, External, external_params); } *result = oed->common; @@ -496,3 +498,4 @@ _edje_description_convert(int type, free(oed); return result; } + diff --git a/src/lib/edje/edje_data.c b/src/lib/edje/edje_data.c index 0aa16d14b3..d0eae225e7 100644 --- a/src/lib/edje/edje_data.c +++ b/src/lib/edje/edje_data.c @@ -1,7 +1,7 @@ #include "edje_private.h" -EAPI Eet_Data_Descriptor *_edje_edd_edje_file = NULL; -EAPI Eet_Data_Descriptor *_edje_edd_edje_part_collection = NULL; +EAPI Eet_Data_Descriptor * _edje_edd_edje_file = NULL; +EAPI Eet_Data_Descriptor * _edje_edd_edje_part_collection = NULL; Eet_Data_Descriptor *_edje_edd_edje_string = NULL; Eet_Data_Descriptor *_edje_edd_edje_style = NULL; @@ -75,23 +75,23 @@ Eet_Data_Descriptor *_edje_edd_edje_physics_face = NULL; Eet_Data_Descriptor *_edje_edd_edje_map_colors = NULL; Eet_Data_Descriptor *_edje_edd_edje_map_colors_pointer = NULL; -#define EMP(Type, Minus) \ - EAPI Eina_Mempool *_emp_##Type = NULL; \ - \ - static void * \ - mem_alloc_##Minus(size_t size) \ - { \ - void *data; \ - \ - data = eina_mempool_malloc(_emp_##Type, size); \ - memset(data, 0, size); \ - return data; \ - } \ - \ - static void \ - mem_free_##Minus(void *data) \ - { \ - eina_mempool_free(_emp_##Type, data); \ +#define EMP(Type, Minus) \ + EAPI Eina_Mempool *_emp_##Type = NULL; \ + \ + static void * \ + mem_alloc_##Minus(size_t size) \ + { \ + void *data; \ + \ + data = eina_mempool_malloc(_emp_##Type, size); \ + memset(data, 0, size); \ + return data; \ + } \ + \ + static void \ + mem_free_##Minus(void *data) \ + { \ + eina_mempool_free(_emp_##Type, data); \ } EMP(RECTANGLE, rectangle); @@ -114,47 +114,48 @@ EAPI Eina_Mempool *_emp_part = NULL; static void * mem_alloc_part(size_t size) { - Edje_Part *ep; + Edje_Part *ep; - ep = eina_mempool_malloc(_emp_part, size); - memset(ep, 0, size); - // This value need to be defined for older file that didn't provide it - // as it should -1 by default instead of 0. - ep->dragable.threshold_id = -1; - return ep; + ep = eina_mempool_malloc(_emp_part, size); + memset(ep, 0, size); + // This value need to be defined for older file that didn't provide it + // as it should -1 by default instead of 0. + ep->dragable.threshold_id = -1; + return ep; } static void mem_free_part(void *data) { - eina_mempool_free(_emp_part, data); + eina_mempool_free(_emp_part, data); } -#define FREED(eed) \ - if (eed) \ - { \ - eet_data_descriptor_free((eed)); \ - (eed) = NULL; \ - } +#define FREED(eed) \ + if (eed) \ + { \ + eet_data_descriptor_free((eed)); \ + (eed) = NULL; \ + } -struct { +struct +{ Edje_Part_Type type; - const char *name; + const char *name; } variant_convertion[] = { - { EDJE_PART_TYPE_RECTANGLE, "rectangle" }, - { EDJE_PART_TYPE_SWALLOW, "swallow" }, - { EDJE_PART_TYPE_GROUP, "group" }, - { EDJE_PART_TYPE_IMAGE, "image" }, - { EDJE_PART_TYPE_TEXT, "text" }, - { EDJE_PART_TYPE_TEXTBLOCK, "textblock" }, - { EDJE_PART_TYPE_BOX, "box" }, - { EDJE_PART_TYPE_TABLE, "table" }, - { EDJE_PART_TYPE_EXTERNAL, "external" }, - { EDJE_PART_TYPE_PROXY, "proxy" }, - { EDJE_PART_TYPE_SPACER, "spacer" }, - { EDJE_PART_TYPE_MESH_NODE, "mesh_node" }, - { EDJE_PART_TYPE_LIGHT, "light" }, - { EDJE_PART_TYPE_CAMERA, "camera" } + { EDJE_PART_TYPE_RECTANGLE, "rectangle" }, + { EDJE_PART_TYPE_SWALLOW, "swallow" }, + { EDJE_PART_TYPE_GROUP, "group" }, + { EDJE_PART_TYPE_IMAGE, "image" }, + { EDJE_PART_TYPE_TEXT, "text" }, + { EDJE_PART_TYPE_TEXTBLOCK, "textblock" }, + { EDJE_PART_TYPE_BOX, "box" }, + { EDJE_PART_TYPE_TABLE, "table" }, + { EDJE_PART_TYPE_EXTERNAL, "external" }, + { EDJE_PART_TYPE_PROXY, "proxy" }, + { EDJE_PART_TYPE_SPACER, "spacer" }, + { EDJE_PART_TYPE_MESH_NODE, "mesh_node" }, + { EDJE_PART_TYPE_LIGHT, "light" }, + { EDJE_PART_TYPE_CAMERA, "camera" } }; static const char * @@ -183,17 +184,17 @@ _edje_description_variant_type_set(const char *type, void *data, Eina_Bool unkno for (i = 0; i < (sizeof (variant_convertion) / sizeof (variant_convertion[0])); ++i) if (!strcmp(variant_convertion[i].name, type)) { - *dt = variant_convertion[i].type; - return EINA_TRUE; + *dt = variant_convertion[i].type; + return EINA_TRUE; } return EINA_FALSE; } static Eina_Hash * -_edje_eina_hash_add_alloc(Eina_Hash *hash, - const char *key, - void *data) +_edje_eina_hash_add_alloc(Eina_Hash *hash, + const char *key, + void *data) { if (!hash) hash = eina_hash_string_small_new(free); @@ -285,19 +286,19 @@ _edje_edd_shutdown(void) FREED(_edje_edd_edje_part_collection); } -#define EDJE_DEFINE_POINTER_TYPE(Type, Name) \ - { \ - typedef struct _Edje_##Type##_Pointer Edje_##Type##_Pointer; \ - struct _Edje_##Type##_Pointer \ - { \ - Edje_##Type *pointer; \ - }; \ - \ - EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_##Type##_Pointer); \ - _edje_edd_edje_##Name##_pointer = \ - eet_data_descriptor_file_new(&eddc); \ +#define EDJE_DEFINE_POINTER_TYPE(Type, Name) \ + { \ + typedef struct _Edje_##Type##_Pointer Edje_##Type## _Pointer; \ + struct _Edje_##Type##_Pointer \ + { \ + Edje_##Type * pointer; \ + }; \ + \ + EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_##Type##_Pointer); \ + _edje_edd_edje_##Name##_pointer = \ + eet_data_descriptor_file_new(&eddc); \ EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_##Name##_pointer, Edje_##Type##_Pointer, "pointer", pointer, _edje_edd_edje_##Name); \ - } + } // FIXME: remove EAPI when edje_convert goes EAPI void @@ -357,7 +358,7 @@ _edje_edd_init(void) _edje_edd_edje_image_directory_set = eet_data_descriptor_file_new(&eddc); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set, Edje_Image_Directory_Set, "name", name, EET_T_STRING); - EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set, Edje_Image_Directory_Set, "id", id, EET_T_INT); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set, Edje_Image_Directory_Set, "id", id, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_image_directory_set, Edje_Image_Directory_Set, "entries", entries, _edje_edd_edje_image_directory_set_entry); EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory); @@ -451,7 +452,6 @@ _edje_edd_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_3d_vec, Edje_3D_Vec, "y", y, EDJE_T_FLOAT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_3d_vec, Edje_3D_Vec, "z", z, EDJE_T_FLOAT); - /* collection directory */ EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Collection_Directory_Entry); _edje_edd_edje_part_collection_directory_entry = @@ -507,7 +507,7 @@ _edje_edd_init(void) /* the main file directory */ EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_File); - eddc.func.hash_add = (void * (*)(void *, const char *, void *)) _edje_eina_hash_add_alloc; + eddc.func.hash_add = (void * (*)(void *, const char *, void *))_edje_eina_hash_add_alloc; _edje_edd_edje_file = eet_data_descriptor_file_new(&eddc); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Edje_File, "compiler", compiler, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Edje_File, "version", version, EET_T_INT); @@ -559,8 +559,8 @@ _edje_edd_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "sample_name", sample_name, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "tone_name", tone_name, EET_T_STRING); - EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program ,"duration", duration, EET_T_DOUBLE); - EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program ,"speed", speed, EET_T_DOUBLE); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "duration", duration, EET_T_DOUBLE); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "speed", speed, EET_T_DOUBLE); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "vibration_name", vibration_name, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "vibration_repeat", vibration_repeat, EET_T_INT); @@ -625,198 +625,198 @@ _edje_edd_init(void) EDJE_DEFINE_POINTER_TYPE(Map_Color, map_colors); -#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_FIELDS(Edd, Type) \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.name", state.name, EET_T_STRING); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.value", state.value, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "visible", visible, EET_T_CHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "limit", limit, EET_T_CHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "align.x", align.x, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "align.y", align.y, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_SUB_NESTED(Edd, Type, "align_3d", align_3d, _edje_edd_edje_part_description_3d_vec); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "fixed.w", fixed.w, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "fixed.h", fixed.h, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "minmul.have", minmul.have, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "minmul.w", minmul.w, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "minmul.h", minmul.h, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "min.w", min.w, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "min.h", min.h, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "min.limit", min.limit, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "max.w", max.w, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "max.h", max.h, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "max.limit", max.limit, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "step.x", step.x, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "step.y", step.y, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.min", aspect.min, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.max", aspect.max, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.prefer", aspect.prefer, EET_T_CHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.relative_x", rel1.relative_x, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.relative_y", rel1.relative_y, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.offset_x", rel1.offset_x, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.offset_y", rel1.offset_y, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.id_x", rel1.id_x, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.id_y", rel1.id_y, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.relative_x", rel2.relative_x, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.relative_y", rel2.relative_y, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.offset_x", rel2.offset_x, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.offset_y", rel2.offset_y, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_x", rel2.id_x, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_y", rel2.id_y, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color_class", color_class, EET_T_STRING); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.r", color.r, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.g", color.g, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.b", color.b, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.a", color.a, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.r", color2.r, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.g", color2.g, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.b", color2.b, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.a", color2.a, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.id_persp", map.id_persp, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.id_light", map.id_light, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.id_center", map.rot.id_center, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.x", map.rot.x, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.y", map.rot.y, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.z", map.rot.z, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.on", map.on, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.smooth", map.smooth, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.alpha", map.alpha, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.persp_on", map.persp_on, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.backcull", map.backcull, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(Edd, Type, "map.color", map.colors, _edje_edd_edje_map_colors_pointer); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.zoom.x", map.zoom.x, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.zoom.y", map.zoom.y, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.zplane", persp.zplane, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.focal", persp.focal, EET_T_INT); +#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_FIELDS(Edd, Type) \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.name", state.name, EET_T_STRING); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.value", state.value, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "visible", visible, EET_T_CHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "limit", limit, EET_T_CHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "align.x", align.x, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "align.y", align.y, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_SUB_NESTED(Edd, Type, "align_3d", align_3d, _edje_edd_edje_part_description_3d_vec); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "fixed.w", fixed.w, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "fixed.h", fixed.h, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "minmul.have", minmul.have, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "minmul.w", minmul.w, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "minmul.h", minmul.h, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "min.w", min.w, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "min.h", min.h, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "min.limit", min.limit, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "max.w", max.w, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "max.h", max.h, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "max.limit", max.limit, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "step.x", step.x, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "step.y", step.y, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.min", aspect.min, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.max", aspect.max, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.prefer", aspect.prefer, EET_T_CHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.relative_x", rel1.relative_x, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.relative_y", rel1.relative_y, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.offset_x", rel1.offset_x, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.offset_y", rel1.offset_y, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.id_x", rel1.id_x, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.id_y", rel1.id_y, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.relative_x", rel2.relative_x, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.relative_y", rel2.relative_y, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.offset_x", rel2.offset_x, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.offset_y", rel2.offset_y, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_x", rel2.id_x, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_y", rel2.id_y, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color_class", color_class, EET_T_STRING); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.r", color.r, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.g", color.g, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.b", color.b, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.a", color.a, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.r", color2.r, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.g", color2.g, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.b", color2.b, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.a", color2.a, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.id_persp", map.id_persp, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.id_light", map.id_light, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.id_center", map.rot.id_center, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.x", map.rot.x, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.y", map.rot.y, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.z", map.rot.z, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.on", map.on, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.smooth", map.smooth, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.alpha", map.alpha, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.persp_on", map.persp_on, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.backcull", map.backcull, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(Edd, Type, "map.color", map.colors, _edje_edd_edje_map_colors_pointer); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.zoom.x", map.zoom.x, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.zoom.y", map.zoom.y, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.zplane", persp.zplane, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.focal", persp.focal, EET_T_INT); #ifdef HAVE_EPHYSICS -#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON(Edd, Type) \ - { \ - EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_FIELDS(Edd, Type) \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mass", physics.mass, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.restitution", physics.restitution, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.friction", physics.friction, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.damping.linear", physics.damping.linear, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.damping.angular", physics.damping.angular, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.sleep.linear", physics.sleep.linear, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.sleep.angular", physics.sleep.angular, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.material", physics.material, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.density", physics.density, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.hardness", physics.hardness, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.z", physics.z, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.depth", physics.depth, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.ignore_part_pos", physics.ignore_part_pos, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.light_on", physics.light_on, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.backcull", physics.backcull, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.lin.x", physics.mov_freedom.lin.x, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.lin.y", physics.mov_freedom.lin.y, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.lin.z", physics.mov_freedom.lin.z, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.ang.x", physics.mov_freedom.ang.x, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.ang.y", physics.mov_freedom.ang.y, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.ang.z", physics.mov_freedom.ang.z, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_LIST(Edd, Type, "physics.faces", physics.faces, _edje_edd_edje_physics_face); \ - } +#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON(Edd, Type) \ + { \ + EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_FIELDS(Edd, Type) \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mass", physics.mass, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.restitution", physics.restitution, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.friction", physics.friction, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.damping.linear", physics.damping.linear, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.damping.angular", physics.damping.angular, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.sleep.linear", physics.sleep.linear, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.sleep.angular", physics.sleep.angular, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.material", physics.material, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.density", physics.density, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.hardness", physics.hardness, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.z", physics.z, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.depth", physics.depth, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.ignore_part_pos", physics.ignore_part_pos, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.light_on", physics.light_on, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.backcull", physics.backcull, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.lin.x", physics.mov_freedom.lin.x, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.lin.y", physics.mov_freedom.lin.y, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.lin.z", physics.mov_freedom.lin.z, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.ang.x", physics.mov_freedom.ang.x, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.ang.y", physics.mov_freedom.ang.y, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.ang.z", physics.mov_freedom.ang.z, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_LIST(Edd, Type, "physics.faces", physics.faces, _edje_edd_edje_physics_face); \ + } #else -#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON(Edd, Type) \ - { \ - EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_FIELDS(Edd, Type) \ - } +#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON(Edd, Type) \ + { \ + EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_FIELDS(Edd, Type) \ + } #endif -#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB_FIELDS(Edd, Type, Dec) \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.name", Dec.state.name, EET_T_STRING); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.value", Dec.state.value, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "visible", Dec.visible, EET_T_CHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "align.x", Dec.align.x, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "align.y", Dec.align.y, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_SUB_NESTED(Edd, Type, "align_3d", Dec.align_3d, _edje_edd_edje_part_description_3d_vec); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "fixed.w", Dec.fixed.w, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "fixed.h", Dec.fixed.h, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "min.w", Dec.min.w, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "min.h", Dec.min.h, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "max.w", Dec.max.w, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "max.h", Dec.max.h, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "step.x", Dec.step.x, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "step.y", Dec.step.y, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.min", Dec.aspect.min, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.max", Dec.aspect.max, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.prefer", Dec.aspect.prefer, EET_T_CHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.relative_x", Dec.rel1.relative_x, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.relative_y", Dec.rel1.relative_y, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.offset_x", Dec.rel1.offset_x, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.offset_y", Dec.rel1.offset_y, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.id_x", Dec.rel1.id_x, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.id_y", Dec.rel1.id_y, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.relative_x", Dec.rel2.relative_x, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.relative_y", Dec.rel2.relative_y, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.offset_x", Dec.rel2.offset_x, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.offset_y", Dec.rel2.offset_y, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_x", Dec.rel2.id_x, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_y", Dec.rel2.id_y, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color_class", Dec.color_class, EET_T_STRING); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.r", Dec.color.r, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.g", Dec.color.g, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.b", Dec.color.b, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.a", Dec.color.a, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.r", Dec.color2.r, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.g", Dec.color2.g, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.b", Dec.color2.b, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.a", Dec.color2.a, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.id_persp", Dec.map.id_persp, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.id_light", Dec.map.id_light, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.id_center", Dec.map.rot.id_center, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.x", Dec.map.rot.x, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.y", Dec.map.rot.y, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.z", Dec.map.rot.z, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.on", Dec.map.on, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.smooth", Dec.map.smooth, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.alpha", Dec.map.alpha, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.persp_on", Dec.map.persp_on, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.backcull", Dec.map.backcull, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(Edd, Type, "map.color", Dec.map.colors, _edje_edd_edje_map_colors_pointer); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.zoom.x", Dec.map.zoom.x, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.zoom.y", Dec.map.zoom.y, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.zplane", Dec.persp.zplane, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.focal", Dec.persp.focal, EET_T_INT); \ +#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB_FIELDS(Edd, Type, Dec) \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.name", Dec.state.name, EET_T_STRING); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.value", Dec.state.value, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "visible", Dec.visible, EET_T_CHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "align.x", Dec.align.x, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "align.y", Dec.align.y, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_SUB_NESTED(Edd, Type, "align_3d", Dec.align_3d, _edje_edd_edje_part_description_3d_vec); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "fixed.w", Dec.fixed.w, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "fixed.h", Dec.fixed.h, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "min.w", Dec.min.w, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "min.h", Dec.min.h, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "max.w", Dec.max.w, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "max.h", Dec.max.h, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "step.x", Dec.step.x, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "step.y", Dec.step.y, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.min", Dec.aspect.min, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.max", Dec.aspect.max, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "aspect.prefer", Dec.aspect.prefer, EET_T_CHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.relative_x", Dec.rel1.relative_x, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.relative_y", Dec.rel1.relative_y, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.offset_x", Dec.rel1.offset_x, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.offset_y", Dec.rel1.offset_y, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.id_x", Dec.rel1.id_x, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel1.id_y", Dec.rel1.id_y, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.relative_x", Dec.rel2.relative_x, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.relative_y", Dec.rel2.relative_y, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.offset_x", Dec.rel2.offset_x, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.offset_y", Dec.rel2.offset_y, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_x", Dec.rel2.id_x, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "rel2.id_y", Dec.rel2.id_y, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color_class", Dec.color_class, EET_T_STRING); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.r", Dec.color.r, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.g", Dec.color.g, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.b", Dec.color.b, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color.a", Dec.color.a, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.r", Dec.color2.r, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.g", Dec.color2.g, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.b", Dec.color2.b, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "color2.a", Dec.color2.a, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.id_persp", Dec.map.id_persp, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.id_light", Dec.map.id_light, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.id_center", Dec.map.rot.id_center, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.x", Dec.map.rot.x, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.y", Dec.map.rot.y, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.rot.z", Dec.map.rot.z, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.on", Dec.map.on, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.smooth", Dec.map.smooth, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.alpha", Dec.map.alpha, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.persp_on", Dec.map.persp_on, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.backcull", Dec.map.backcull, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(Edd, Type, "map.color", Dec.map.colors, _edje_edd_edje_map_colors_pointer); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.zoom.x", Dec.map.zoom.x, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "map.zoom.y", Dec.map.zoom.y, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.zplane", Dec.persp.zplane, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "persp.focal", Dec.persp.focal, EET_T_INT); \ #ifdef HAVE_EPHYSICS -#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(Edd, Type, Dec) \ - { \ - EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB_FIELDS(Edd, Type, Dec) \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mass", Dec.physics.mass, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.restitution", Dec.physics.restitution, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.friction", Dec.physics.friction, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.damping.linear", Dec.physics.damping.linear, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.damping.angular", Dec.physics.damping.angular, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.sleep.linear", Dec.physics.sleep.linear, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.sleep.angular", Dec.physics.sleep.angular, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.material", Dec.physics.material, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.density", Dec.physics.density, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.hardness", Dec.physics.hardness, EET_T_DOUBLE); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.z", Dec.physics.z, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.depth", Dec.physics.depth, EET_T_INT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.ignore_part_pos", Dec.physics.ignore_part_pos, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.light_on", Dec.physics.light_on, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.backcull", Dec.physics.backcull, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.lin.x", Dec.physics.mov_freedom.lin.x, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.lin.y", Dec.physics.mov_freedom.lin.y, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.lin.z", Dec.physics.mov_freedom.lin.z, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.ang.x", Dec.physics.mov_freedom.ang.x, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.ang.y", Dec.physics.mov_freedom.ang.y, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.ang.z", Dec.physics.mov_freedom.ang.z, EET_T_UCHAR); \ - EET_DATA_DESCRIPTOR_ADD_LIST(Edd, Type, "physics.faces", Dec.physics.faces, _edje_edd_edje_physics_face); \ - } +#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(Edd, Type, Dec) \ + { \ + EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB_FIELDS(Edd, Type, Dec) \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mass", Dec.physics.mass, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.restitution", Dec.physics.restitution, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.friction", Dec.physics.friction, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.damping.linear", Dec.physics.damping.linear, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.damping.angular", Dec.physics.damping.angular, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.sleep.linear", Dec.physics.sleep.linear, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.sleep.angular", Dec.physics.sleep.angular, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.material", Dec.physics.material, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.density", Dec.physics.density, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.hardness", Dec.physics.hardness, EET_T_DOUBLE); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.z", Dec.physics.z, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.depth", Dec.physics.depth, EET_T_INT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.ignore_part_pos", Dec.physics.ignore_part_pos, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.light_on", Dec.physics.light_on, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.backcull", Dec.physics.backcull, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.lin.x", Dec.physics.mov_freedom.lin.x, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.lin.y", Dec.physics.mov_freedom.lin.y, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.lin.z", Dec.physics.mov_freedom.lin.z, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.ang.x", Dec.physics.mov_freedom.ang.x, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.ang.y", Dec.physics.mov_freedom.ang.y, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.ang.z", Dec.physics.mov_freedom.ang.z, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_LIST(Edd, Type, "physics.faces", Dec.physics.faces, _edje_edd_edje_physics_face); \ + } #else -#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(Edd, Type, Dec) \ - { \ - EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB_FIELDS(Edd, Type, Dec) \ - } +#define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(Edd, Type, Dec) \ + { \ + EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB_FIELDS(Edd, Type, Dec) \ + } #endif -#define EET_DATA_DESCRIPTOR_ADD_SUB_NESTED_LOOK(Edd, Type, Dec) \ - { \ - EET_DATA_DESCRIPTOR_ADD_BASIC_ARRAY(Edd, Type, "Dec##.orientation.look1", Dec.orientation.data, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC_ARRAY(Edd, Type, "Dec##.orientation.look2", Dec.orientation.data, EDJE_T_FLOAT); \ - EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "Dec##.orientation.look_to", Dec.orientation.look_to, EET_T_INT); \ - } +#define EET_DATA_DESCRIPTOR_ADD_SUB_NESTED_LOOK(Edd, Type, Dec) \ + { \ + EET_DATA_DESCRIPTOR_ADD_BASIC_ARRAY(Edd, Type, "Dec##.orientation.look1", Dec.orientation.data, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC_ARRAY(Edd, Type, "Dec##.orientation.look2", Dec.orientation.data, EDJE_T_FLOAT); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "Dec##.orientation.look_to", Dec.orientation.look_to, EET_T_INT); \ + } EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Common); eddc.func.mem_free = mem_free_rectangle; @@ -1097,53 +1097,52 @@ _edje_edd_init(void) eddc.func.type_set = _edje_description_variant_type_set; _edje_edd_edje_part_description_variant = eet_data_descriptor_file_new(&eddc); - EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "spacer", _edje_edd_edje_part_description_spacer); + EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "spacer", _edje_edd_edje_part_description_spacer); EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "rectangle", _edje_edd_edje_part_description_rectangle); - EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "swallow", _edje_edd_edje_part_description_swallow); - EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "group", _edje_edd_edje_part_description_group); - EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "image", _edje_edd_edje_part_description_image); - EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "proxy", _edje_edd_edje_part_description_proxy); - EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "text", _edje_edd_edje_part_description_text); + EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "swallow", _edje_edd_edje_part_description_swallow); + EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "group", _edje_edd_edje_part_description_group); + EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "image", _edje_edd_edje_part_description_image); + EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "proxy", _edje_edd_edje_part_description_proxy); + EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "text", _edje_edd_edje_part_description_text); EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "textblock", _edje_edd_edje_part_description_textblock); - EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "box", _edje_edd_edje_part_description_box); - EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "table", _edje_edd_edje_part_description_table); - EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "external", _edje_edd_edje_part_description_external); - EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "mesh_node", _edje_edd_edje_part_description_mesh_node); - EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "light", _edje_edd_edje_part_description_light); - EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "camera", _edje_edd_edje_part_description_camera); + EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "box", _edje_edd_edje_part_description_box); + EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "table", _edje_edd_edje_part_description_table); + EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "external", _edje_edd_edje_part_description_external); + EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "mesh_node", _edje_edd_edje_part_description_mesh_node); + EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "light", _edje_edd_edje_part_description_light); + EET_DATA_DESCRIPTOR_ADD_MAPPING(_edje_edd_edje_part_description_variant, "camera", _edje_edd_edje_part_description_camera); - -#define EDJE_ADD_ARRAY_MAPPING(Variant, Type, Minus) \ - { \ - Edje_Part_Description_List tmp; \ - \ - eet_data_descriptor_element_add(Variant, Type, \ - EET_T_UNKNOW, EET_G_VAR_ARRAY, \ - 0, (char*)(&tmp.desc_count) - (char*)(&tmp), \ - NULL, \ - _edje_edd_edje_part_description_##Minus##_pointer); \ - } +#define EDJE_ADD_ARRAY_MAPPING(Variant, Type, Minus) \ + { \ + Edje_Part_Description_List tmp; \ + \ + eet_data_descriptor_element_add(Variant, Type, \ + EET_T_UNKNOW, EET_G_VAR_ARRAY, \ + 0, (char *)(&tmp.desc_count) - (char *)(&tmp), \ + NULL, \ + _edje_edd_edje_part_description_##Minus##_pointer); \ + } _edje_edd_edje_part_description_variant_list = eet_data_descriptor_file_new(&eddc); EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "rectangle", rectangle); - EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "spacer", spacer); - EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "swallow", swallow); - EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "group", group); - EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "image", image); - EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "proxy", proxy); - EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "text", text); + EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "spacer", spacer); + EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "swallow", swallow); + EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "group", group); + EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "image", image); + EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "proxy", proxy); + EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "text", text); EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "textblock", textblock); - EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "box", box); - EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "table", table); - EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "external", external); + EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "box", box); + EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "table", table); + EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "external", external); EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "mesh_node", mesh_node); - EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "light", light); - EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "camera", camera); + EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "light", light); + EDJE_ADD_ARRAY_MAPPING(_edje_edd_edje_part_description_variant_list, "camera", camera); EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Pack_Element); _edje_edd_edje_pack_element = - eet_data_descriptor_file_new(&eddc); + eet_data_descriptor_file_new(&eddc); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "type", type, EET_T_UCHAR); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "name", name, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_pack_element, Edje_Pack_Element, "source", source, EET_T_STRING); @@ -1229,7 +1228,7 @@ _edje_edd_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_limit, Edje_Part_Limit, "part", part, EET_T_INT); EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Collection); - _edje_edd_edje_part_collection = + _edje_edd_edje_part_collection = eet_data_descriptor_file_new(&eddc); EDJE_DEFINE_POINTER_TYPE(Program, program); @@ -1275,21 +1274,22 @@ _edje_edd_init(void) EAPI void _edje_data_font_list_desc_make(Eet_Data_Descriptor **_font_list_edd, - Eet_Data_Descriptor **_font_edd) + Eet_Data_Descriptor **_font_edd) { /* User have to free: _font_list_edd, _font_edd */ - Eet_Data_Descriptor_Class eddc; + Eet_Data_Descriptor_Class eddc; - eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), - "font", sizeof (Edje_Font)); - *_font_edd = eet_data_descriptor_stream_new(&eddc); - EET_DATA_DESCRIPTOR_ADD_BASIC(*_font_edd, Edje_Font, - "file", file, EET_T_INLINED_STRING); - EET_DATA_DESCRIPTOR_ADD_BASIC(*_font_edd, Edje_Font, - "name", name, EET_T_INLINED_STRING); + eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), + "font", sizeof (Edje_Font)); + *_font_edd = eet_data_descriptor_stream_new(&eddc); + EET_DATA_DESCRIPTOR_ADD_BASIC(*_font_edd, Edje_Font, + "file", file, EET_T_INLINED_STRING); + EET_DATA_DESCRIPTOR_ADD_BASIC(*_font_edd, Edje_Font, + "name", name, EET_T_INLINED_STRING); - eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), - "font_list", sizeof (Edje_Font_List)); - *_font_list_edd = eet_data_descriptor_stream_new(&eddc); - EET_DATA_DESCRIPTOR_ADD_LIST(*_font_list_edd, Edje_Font_List, - "list", list, *_font_edd); + eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), + "font_list", sizeof (Edje_Font_List)); + *_font_list_edd = eet_data_descriptor_stream_new(&eddc); + EET_DATA_DESCRIPTOR_ADD_LIST(*_font_list_edd, Edje_Font_List, + "list", list, *_font_edd); } + diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 891584ed78..73d7777a66 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -31,45 +31,45 @@ EAPI Eina_Error EDJE_EDIT_ERROR_GROUP_REFERENCED = 0; EAPI Eina_Error EDJE_EDIT_ERROR_GROUP_DOES_NOT_EXIST = 0; /* Get eed(Edje_Edit*) from obj(Evas_Object*) */ -#define GET_EED_OR_RETURN(RET) \ - Edje_Edit *eed; \ - if (!eo_isa(obj, MY_CLASS)) \ - return RET; \ - eed = eo_data_scope_get(obj, MY_CLASS); \ - if (!eed) return RET; +#define GET_EED_OR_RETURN(RET) \ + Edje_Edit *eed; \ + if (!eo_isa(obj, MY_CLASS)) \ + return RET; \ + eed = eo_data_scope_get(obj, MY_CLASS); \ + if (!eed) return RET; /* Get ed(Edje*) from obj(Evas_Object*) */ -#define GET_ED_OR_RETURN(RET) \ - Edje *ed; \ - if (!eo_isa(obj, EDJE_OBJECT_CLASS)) \ - return RET; \ - ed = eo_data_scope_get(obj, EDJE_OBJECT_CLASS); +#define GET_ED_OR_RETURN(RET) \ + Edje *ed; \ + if (!eo_isa(obj, EDJE_OBJECT_CLASS)) \ + return RET; \ + ed = eo_data_scope_get(obj, EDJE_OBJECT_CLASS); /* Get rp(Edje_Real_Part*) from obj(Evas_Object*) and part(char*) */ -#define GET_RP_OR_RETURN(RET) \ - GET_ED_OR_RETURN(RET) \ - Edje_Real_Part *rp; \ - rp = _edje_real_part_get(ed, part); \ - if (!rp) return RET; +#define GET_RP_OR_RETURN(RET) \ + GET_ED_OR_RETURN(RET) \ + Edje_Real_Part *rp; \ + rp = _edje_real_part_get(ed, part); \ + if (!rp) return RET; /* Get pd(Edje_Part_Description*) from obj(Evas_Object*), part(char*) and state (char*) */ -#define GET_PD_OR_RETURN(RET) \ - GET_EED_OR_RETURN(RET) \ - GET_ED_OR_RETURN(RET) \ - Edje_Real_Part *rp; \ - Edje_Part_Description_Common *pd; \ - rp = _edje_real_part_get(ed, part); \ - if (!rp) return RET; \ - pd = _edje_part_description_find_byname(eed, part, state, value); \ - if (!pd) return RET; +#define GET_PD_OR_RETURN(RET) \ + GET_EED_OR_RETURN(RET) \ + GET_ED_OR_RETURN(RET) \ + Edje_Real_Part *rp; \ + Edje_Part_Description_Common *pd; \ + rp = _edje_real_part_get(ed, part); \ + if (!rp) return RET; \ + pd = _edje_part_description_find_byname(eed, part, state, value); \ + if (!pd) return RET; /* Get epr(Edje_Program*) from obj(Evas_Object*) and prog(char*)*/ -#define GET_EPR_OR_RETURN(RET) \ - Edje_Program *epr; \ - if (!eo_isa(obj, MY_CLASS)) \ - return RET; \ - epr = _edje_program_get_byname(obj, prog); \ - if (!epr) return RET; +#define GET_EPR_OR_RETURN(RET) \ + Edje_Program *epr; \ + if (!eo_isa(obj, MY_CLASS)) \ + return RET; \ + epr = _edje_program_get_byname(obj, prog); \ + if (!epr) return RET; static void * _alloc(size_t size) @@ -92,31 +92,31 @@ _alloc(size_t size) typedef struct _Edje_Edit Edje_Edit; struct _Edje_Edit { - Edje *base; + Edje *base; - void *bytecode; - int bytecode_size; + void *bytecode; + int bytecode_size; - char *embryo_source; - char *embryo_processed; + char *embryo_source; + char *embryo_processed; Eina_Hash *program_scripts; Eina_List *errors; - Eina_Bool bytecode_dirty:1; - Eina_Bool embryo_source_dirty:1; - Eina_Bool all_dirty:1; - Eina_Bool script_need_recompile:1; + Eina_Bool bytecode_dirty : 1; + Eina_Bool embryo_source_dirty : 1; + Eina_Bool all_dirty : 1; + Eina_Bool script_need_recompile : 1; }; typedef struct _Program_Script Program_Script; struct _Program_Script { - int id; - char *code; - char *processed; - Eina_Bool dirty:1; - Eina_Bool delete_me:1; + int id; + char *code; + char *processed; + Eina_Bool dirty : 1; + Eina_Bool delete_me : 1; }; static Eina_Bool _edje_edit_edje_file_save(Eet_File *eetf, Edje_File *ef); @@ -284,7 +284,7 @@ _edje_image_id_find(Edje_Edit *eed, const char *image_name) for (i = 0; i < eed->base->file->image_dir->entries_count; ++i) if (eed->base->file->image_dir->entries[i].entry - && !strcmp(image_name, eed->base->file->image_dir->entries[i].entry)) + && !strcmp(image_name, eed->base->file->image_dir->entries[i].entry)) return i; return -1; @@ -300,7 +300,7 @@ _edje_image_name_find(Edje_Edit *eed, int image_id) if (image_id < 0) image_id = -image_id - 1; //printf("SEARCH IMAGE ID %d\n", image_id); - if ((unsigned int) image_id >= eed->base->file->image_dir->entries_count) + if ((unsigned int)image_id >= eed->base->file->image_dir->entries_count) return NULL; return eed->base->file->image_dir->entries[image_id].entry; } @@ -312,44 +312,44 @@ _edje_real_part_free(Edje *ed, Edje_Real_Part *rp) if (rp->object) { - _edje_callbacks_del(rp->object, ed); - evas_object_del(rp->object); + _edje_callbacks_del(rp->object, ed); + evas_object_del(rp->object); } if ((rp->type == EDJE_RP_TYPE_SWALLOW) && (rp->typedata.swallow) - && (rp->typedata.swallow->swallowed_object)) + && (rp->typedata.swallow->swallowed_object)) { - evas_object_smart_member_del(rp->typedata.swallow->swallowed_object); - evas_object_event_callback_del(rp->typedata.swallow->swallowed_object, - EVAS_CALLBACK_FREE, _edje_object_part_swallow_free_cb); - evas_object_clip_unset(rp->typedata.swallow->swallowed_object); - evas_object_data_del(rp->typedata.swallow->swallowed_object, - "\377 edje.swallowing_part"); - if (rp->part->mouse_events) - _edje_callbacks_del(rp->typedata.swallow->swallowed_object, ed); + evas_object_smart_member_del(rp->typedata.swallow->swallowed_object); + evas_object_event_callback_del(rp->typedata.swallow->swallowed_object, + EVAS_CALLBACK_FREE, _edje_object_part_swallow_free_cb); + evas_object_clip_unset(rp->typedata.swallow->swallowed_object); + evas_object_data_del(rp->typedata.swallow->swallowed_object, + "\377 edje.swallowing_part"); + if (rp->part->mouse_events) + _edje_callbacks_del(rp->typedata.swallow->swallowed_object, ed); - if (rp->part->type == EDJE_PART_TYPE_GROUP || - rp->part->type == EDJE_PART_TYPE_EXTERNAL) - evas_object_del(rp->typedata.swallow->swallowed_object); + if (rp->part->type == EDJE_PART_TYPE_GROUP || + rp->part->type == EDJE_PART_TYPE_EXTERNAL) + evas_object_del(rp->typedata.swallow->swallowed_object); - rp->typedata.swallow->swallowed_object = NULL; + rp->typedata.swallow->swallowed_object = NULL; } if ((rp->type == EDJE_RP_TYPE_TEXT) && (rp->typedata.text) && - (rp->typedata.text->text)) eina_stringshare_del(rp->typedata.text->text); + (rp->typedata.text->text)) eina_stringshare_del(rp->typedata.text->text); if ((rp->type == EDJE_RP_TYPE_TEXT) && (rp->typedata.text) && - (rp->typedata.text->font)) eina_stringshare_del(rp->typedata.text->font); + (rp->typedata.text->font)) eina_stringshare_del(rp->typedata.text->font); if ((rp->type == EDJE_RP_TYPE_TEXT) && (rp->typedata.text) && - (rp->typedata.text->cache.in_str)) eina_stringshare_del(rp->typedata.text->cache.in_str); + (rp->typedata.text->cache.in_str)) eina_stringshare_del(rp->typedata.text->cache.in_str); if ((rp->type == EDJE_RP_TYPE_TEXT) && (rp->typedata.text) && - (rp->typedata.text->cache.out_str)) eina_stringshare_del(rp->typedata.text->cache.out_str); + (rp->typedata.text->cache.out_str)) eina_stringshare_del(rp->typedata.text->cache.out_str); if (rp->custom) { - _edje_collection_free_part_description_clean(rp->part->type, rp->custom->description, 0); - if (rp->custom) free(rp->custom->set); - eina_mempool_free(_edje_real_part_state_mp, rp->custom); - rp->custom = NULL; + _edje_collection_free_part_description_clean(rp->part->type, rp->custom->description, 0); + if (rp->custom) free(rp->custom->set); + eina_mempool_free(_edje_real_part_state_mp, rp->custom); + rp->custom = NULL; } free(rp->drag); @@ -411,7 +411,7 @@ _edje_edit_file_import(Edje *ed, const char *path, const char *entry, int compre return EINA_TRUE; - on_error: +on_error: if (eetf) eet_close(eetf); eina_file_map_free(f, fdata); eina_file_close(f); @@ -419,7 +419,6 @@ _edje_edit_file_import(Edje *ed, const char *path, const char *entry, int compre return EINA_FALSE; } - static Eina_Bool _edje_import_image_file(Edje *ed, const char *path, int id) { @@ -427,8 +426,8 @@ _edje_import_image_file(Edje *ed, const char *path, int id) Evas_Object *im; Eet_File *eetf; void *im_data; - int im_w, im_h; - int im_alpha; + int im_w, im_h; + int im_alpha; int bytes; /* Try to load the file */ @@ -439,11 +438,11 @@ _edje_import_image_file(Edje *ed, const char *path, int id) if (evas_object_image_load_error_get(im) != EVAS_LOAD_ERROR_NONE) { ERR("Edje_Edit: unable to load image \"%s\"." - "Missing PNG or JPEG loader modules for Evas or " - "file does not exist, or is not readable.", path); + "Missing PNG or JPEG loader modules for Evas or " + "file does not exist, or is not readable.", path); evas_object_del(im); - im = NULL; - return EINA_FALSE; + im = NULL; + return EINA_FALSE; } /* Write the loaded image to the edje file */ @@ -453,33 +452,33 @@ _edje_import_image_file(Edje *ed, const char *path, int id) im_data = evas_object_image_data_get(im, 0); if ((!im_data) || !(im_w > 0) || !(im_h > 0)) { - evas_object_del(im); - return EINA_FALSE; + evas_object_del(im); + return EINA_FALSE; } /* open the eet file */ eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE); if (!eetf) { - ERR("Unable to open \"%s\" for writing output", ed->path); - evas_object_del(im); - return EINA_FALSE; + ERR("Unable to open \"%s\" for writing output", ed->path); + evas_object_del(im); + return EINA_FALSE; } snprintf(entry, sizeof(entry), "edje/images/%i", id); /* write the image data */ bytes = eet_data_image_write(eetf, entry, - im_data, im_w, im_h, - im_alpha, - 0, 100, 1); + im_data, im_w, im_h, + im_alpha, + 0, 100, 1); if (bytes <= 0) { - ERR("Unable to write image part \"%s\" part entry to %s", - entry, ed->path); - eet_close(eetf); - evas_object_del(im); - return EINA_FALSE; + ERR("Unable to write image part \"%s\" part entry to %s", + entry, ed->path); + eet_close(eetf); + evas_object_del(im); + return EINA_FALSE; } evas_object_del(im); @@ -487,9 +486,9 @@ _edje_import_image_file(Edje *ed, const char *path, int id) /* write the edje_file */ if (!_edje_edit_edje_file_save(eetf, ed->file)) { - eet_delete(eetf, entry); - eet_close(eetf); - return EINA_FALSE; + eet_delete(eetf, entry); + eet_close(eetf); + return EINA_FALSE; } eet_close(eetf); @@ -503,10 +502,10 @@ _edje_part_id_find(Edje *ed, const char *part) for (id = 0; id < ed->table_parts_size; id++) { - Edje_Real_Part *rp = ed->table_parts[id]; + Edje_Real_Part *rp = ed->table_parts[id]; - if (!strcmp(rp->part->name, part)) - return id; + if (!strcmp(rp->part->name, part)) + return id; } return -1; } @@ -537,12 +536,12 @@ _edje_part_description_id_set(int type, Edje_Part_Description_Common *c, int old if (type == EDJE_PART_TYPE_TEXT || type == EDJE_PART_TYPE_TEXTBLOCK) { - Edje_Part_Description_Text *t; + Edje_Part_Description_Text *t; - t = (Edje_Part_Description_Text *) c; + t = (Edje_Part_Description_Text *)c; - if (t->text.id_source == old_id) t->text.id_source = new_id; - if (t->text.id_text_source == old_id) t->text.id_text_source = new_id; + if (t->text.id_source == old_id) t->text.id_source = new_id; + if (t->text.id_text_source == old_id) t->text.id_text_source = new_id; } } @@ -557,13 +556,13 @@ _edje_part_program_id_set(Edje_Program *epr, int old_id, int new_id) EINA_LIST_FOREACH_SAFE(epr->targets, ll, l_next, pt) { - if (pt->id == old_id) - { - if (new_id == -1) - epr->targets = eina_list_remove_list(epr->targets, ll); - else - pt->id = new_id; - } + if (pt->id == old_id) + { + if (new_id == -1) + epr->targets = eina_list_remove_list(epr->targets, ll); + else + pt->id = new_id; + } } } @@ -595,27 +594,27 @@ _edje_part_id_set(Edje *ed, Edje_Real_Part *rp, int new_id) /* Fix all the dependecies in all parts... */ for (j = 0; j < ed->collection->parts_count; ++j) { - Edje_Part *p; - unsigned int k; + Edje_Part *p; + unsigned int k; - p = ed->collection->parts[j]; + p = ed->collection->parts[j]; - //printf(" search id: %d in %s\n", old_id, p->name); - if (p->clip_to_id == old_id) p->clip_to_id = new_id; - if (p->dragable.confine_id == old_id) p->dragable.confine_id = new_id; + //printf(" search id: %d in %s\n", old_id, p->name); + if (p->clip_to_id == old_id) p->clip_to_id = new_id; + if (p->dragable.confine_id == old_id) p->dragable.confine_id = new_id; - /* ...in default description */ - _edje_part_description_id_set(p->type, p->default_desc, old_id, new_id); + /* ...in default description */ + _edje_part_description_id_set(p->type, p->default_desc, old_id, new_id); - /* ...and in all other descriptions */ - for (k = 0; k < p->other.desc_count; ++k) - _edje_part_description_id_set(p->type, p->other.desc[k], old_id, new_id); + /* ...and in all other descriptions */ + for (k = 0; k < p->other.desc_count; ++k) + _edje_part_description_id_set(p->type, p->other.desc[k], old_id, new_id); } /*...and also in programs targets */ -#define EDJE_EDIT_PROGRAM_ID_SET(Array, Ed, It, Old, New) \ - for (It = 0; It < Ed->collection->programs.Array##_count; ++It) \ - _edje_part_program_id_set(Ed->collection->programs.Array[It], Old, New); +#define EDJE_EDIT_PROGRAM_ID_SET(Array, Ed, It, Old, New) \ + for (It = 0; It < Ed->collection->programs.Array##_count; ++It) \ + _edje_part_program_id_set(Ed->collection->programs.Array[It], Old, New); EDJE_EDIT_PROGRAM_ID_SET(fnmatch, ed, j, old_id, new_id); EDJE_EDIT_PROGRAM_ID_SET(strcmp, ed, j, old_id, new_id); @@ -632,24 +631,30 @@ static void _edje_part_description_id_switch(int type, Edje_Part_Description_Common *c, int id1, int id2) { if (c->rel1.id_x == id1) c->rel1.id_x = id2; - else if (c->rel1.id_x == id2) c->rel1.id_x = id1; + else if (c->rel1.id_x == id2) + c->rel1.id_x = id1; if (c->rel1.id_y == id1) c->rel1.id_y = id2; - else if (c->rel1.id_y == id2) c->rel1.id_y = id1; + else if (c->rel1.id_y == id2) + c->rel1.id_y = id1; if (c->rel2.id_x == id1) c->rel2.id_x = id2; - else if (c->rel2.id_x == id2) c->rel2.id_x = id1; + else if (c->rel2.id_x == id2) + c->rel2.id_x = id1; if (c->rel2.id_y == id1) c->rel2.id_y = id2; - else if (c->rel2.id_y == id2) c->rel2.id_y = id1; + else if (c->rel2.id_y == id2) + c->rel2.id_y = id1; if (type == EDJE_PART_TYPE_TEXT || type == EDJE_PART_TYPE_TEXTBLOCK) { - Edje_Part_Description_Text *t; - t = (Edje_Part_Description_Text *) c; + Edje_Part_Description_Text *t; + t = (Edje_Part_Description_Text *)c; - if (t->text.id_source == id1) t->text.id_source = id2; - else if (t->text.id_source == id2) t->text.id_source = id1; - if (t->text.id_text_source == id1) t->text.id_text_source = id2; - else if (t->text.id_text_source == id2) t->text.id_text_source = id1; + if (t->text.id_source == id1) t->text.id_source = id2; + else if (t->text.id_source == id2) + t->text.id_source = id1; + if (t->text.id_text_source == id1) t->text.id_text_source = id2; + else if (t->text.id_text_source == id2) + t->text.id_text_source = id1; } } @@ -664,8 +669,9 @@ _edje_part_program_id_switch(Edje_Program *epr, int id1, int id2) EINA_LIST_FOREACH(epr->targets, ll, pt) { - if (pt->id == id1) pt->id = id2; - else if (pt->id == id2) pt->id = id1; + if (pt->id == id1) pt->id = id2; + else if (pt->id == id2) + pt->id = id1; } } @@ -700,29 +706,31 @@ _edje_parts_id_switch(Edje *ed, Edje_Real_Part *rp1, Edje_Real_Part *rp2) // Fix all the dependecies in all parts... for (i = 0; i < ed->collection->parts_count; ++i) { - unsigned int j; - Edje_Part *p; + unsigned int j; + Edje_Part *p; - p = ed->collection->parts[i]; + p = ed->collection->parts[i]; - //printf(" search id: %d in %s\n", old_id, p->name); - if (p->clip_to_id == id1) p->clip_to_id = id2; - else if (p->clip_to_id == id2) p->clip_to_id = id1; - if (p->dragable.confine_id == id1) p->dragable.confine_id = id2; - else if (p->dragable.confine_id == id2) p->dragable.confine_id = id1; + //printf(" search id: %d in %s\n", old_id, p->name); + if (p->clip_to_id == id1) p->clip_to_id = id2; + else if (p->clip_to_id == id2) + p->clip_to_id = id1; + if (p->dragable.confine_id == id1) p->dragable.confine_id = id2; + else if (p->dragable.confine_id == id2) + p->dragable.confine_id = id1; - // ...in default description - _edje_part_description_id_switch(p->type, p->default_desc, id1, id2); + // ...in default description + _edje_part_description_id_switch(p->type, p->default_desc, id1, id2); - // ...and in all other descriptions - for (j = 0; j < p->other.desc_count; ++j) - _edje_part_description_id_switch(p->type, p->other.desc[j], id1, id2); + // ...and in all other descriptions + for (j = 0; j < p->other.desc_count; ++j) + _edje_part_description_id_switch(p->type, p->other.desc[j], id1, id2); } //...and also in programs targets -#define EDJE_EDIT_PROGRAM_SWITCH(Array, Ed, It, Id1, Id2) \ - for (It = 0; It < Ed->collection->programs.Array##_count; ++It) \ - _edje_part_program_id_switch(Ed->collection->programs.Array[i], Id1, Id2); +#define EDJE_EDIT_PROGRAM_SWITCH(Array, Ed, It, Id1, Id2) \ + for (It = 0; It < Ed->collection->programs.Array##_count; ++It) \ + _edje_part_program_id_switch(Ed->collection->programs.Array[i], Id1, Id2); EDJE_EDIT_PROGRAM_SWITCH(fnmatch, ed, i, id1, id2); EDJE_EDIT_PROGRAM_SWITCH(strcmp, ed, i, id1, id2); @@ -751,16 +759,16 @@ _edje_fix_parts_id(Edje *ed) correct_id = 0; for (i = 0; i < ed->collection->parts_count; ++i) { - Edje_Part *p; + Edje_Part *p; - p = ed->collection->parts[i]; + p = ed->collection->parts[i]; - //printf(" [%d]Checking part: %s id: %d\n", correct_id, p->name, p->id); - if (p->id != correct_id) - if (ed->table_parts[p->id]) - _edje_part_id_set(ed, ed->table_parts[p->id], correct_id); + //printf(" [%d]Checking part: %s id: %d\n", correct_id, p->name, p->id); + if (p->id != correct_id) + if (ed->table_parts[p->id]) + _edje_part_id_set(ed, ed->table_parts[p->id], correct_id); - correct_id++; + correct_id++; } /* If we have removed some parts realloc table_parts */ @@ -810,11 +818,11 @@ _edje_edit_style_get(Edje *ed, const char *name) Edje_Style *s; if (!ed || !ed->file || !ed->file->styles || !name) - return NULL; + return NULL; EINA_LIST_FOREACH(ed->file->styles, l, s) - if (s->name && !strcmp(s->name, name)) - return s; + if (s->name && !strcmp(s->name, name)) + return s; return NULL; } @@ -827,13 +835,13 @@ _edje_edit_style_tag_get(Edje *ed, const char *style, const char *name) Edje_Style_Tag *t; if (!ed || !ed->file || !ed->file->styles || !name) - return NULL; + return NULL; s = _edje_edit_style_get(ed, style); EINA_LIST_FOREACH(s->tags, l, t) - if (t->key && !strcmp(t->key, name)) - return t; + if (t->key && !strcmp(t->key, name)) + return t; return NULL; } @@ -848,7 +856,7 @@ _edje_edit_external_get(Edje *ed, const char *name) for (i = 0; i < ed->file->external_dir->entries_count; ++i) if (ed->file->external_dir->entries[i].entry - && !strcmp(ed->file->external_dir->entries[i].entry, name)) + && !strcmp(ed->file->external_dir->entries[i].entry, name)) return ed->file->external_dir->entries + i; return NULL; @@ -878,21 +886,21 @@ _edje_edit_group_references_update(Evas_Object *obj, const char *old_group_name, EINA_ITERATOR_FOREACH(i, pce) { - edje_object_file_set(part_obj, ed->file->path, pce->entry); + edje_object_file_set(part_obj, ed->file->path, pce->entry); - pl = edje_edit_parts_list_get(part_obj); + pl = edje_edit_parts_list_get(part_obj); - EINA_LIST_FOREACH(pl, pll, part_name) - { - source = edje_edit_part_source_get(part_obj, part_name); - type = edje_edit_part_type_get(part_obj, part_name); + EINA_LIST_FOREACH(pl, pll, part_name) + { + source = edje_edit_part_source_get(part_obj, part_name); + type = edje_edit_part_type_get(part_obj, part_name); - if (type == EDJE_PART_TYPE_GROUP && source == old) - edje_edit_part_source_set(part_obj, part_name, new_group_name); + if (type == EDJE_PART_TYPE_GROUP && source == old) + edje_edit_part_source_set(part_obj, part_name, new_group_name); - if (source) - eina_stringshare_del(source); - } + if (source) + eina_stringshare_del(source); + } } eina_iterator_free(i); @@ -921,8 +929,8 @@ edje_edit_string_list_free(Eina_List *lst) while (lst) { if (eina_list_data_get(lst)) eina_stringshare_del(eina_list_data_get(lst)); - //printf("FREE: %s\n", eina_list_data_get(lst)); - lst = eina_list_remove(lst, eina_list_data_get(lst)); + //printf("FREE: %s\n", eina_list_data_get(lst)); + lst = eina_list_remove(lst, eina_list_data_get(lst)); } } @@ -932,7 +940,7 @@ edje_edit_string_free(const char *str) if (str) eina_stringshare_del(str); } -EAPI const char* +EAPI const char * edje_edit_compiler_get(Evas_Object *obj) { GET_ED_OR_RETURN(0); @@ -956,7 +964,7 @@ edje_edit_sound_samples_list_get(Evas_Object *obj) for (i = 0; i < ed->file->sound_dir->samples_count; ++i) sounds_samples = eina_list_append(sounds_samples, - eina_stringshare_add(ed->file->sound_dir->samples[i].name)); + eina_stringshare_add(ed->file->sound_dir->samples[i].name)); return sounds_samples; } @@ -974,7 +982,7 @@ edje_edit_sound_tones_list_get(Evas_Object *obj) for (i = 0; i < ed->file->sound_dir->tones_count; ++i) sounds_tones = eina_list_append(sounds_tones, - eina_stringshare_add(ed->file->sound_dir->tones[i].name)); + eina_stringshare_add(ed->file->sound_dir->tones[i].name)); return sounds_tones; } @@ -982,7 +990,7 @@ edje_edit_sound_tones_list_get(Evas_Object *obj) static Eina_Bool _edje_edit_collection_save(Eet_File *eetf, Edje_Part_Collection *epc); static Eina_Bool -_delete_play_actions(Evas_Object *obj, const char* name, int action_type, Eet_File *eetf) +_delete_play_actions(Evas_Object *obj, const char *name, int action_type, Eet_File *eetf) { GET_ED_OR_RETURN(EINA_FALSE); Eina_Iterator *it = eina_hash_iterator_data_new(ed->file->collection); @@ -1023,7 +1031,7 @@ _delete_play_actions(Evas_Object *obj, const char* name, int action_type, Eet_Fi program = eed->collection->patterns.table_programs[i]; if (program->action != action_type) - continue; + continue; if ((action_type == EDJE_ACTION_TYPE_SOUND_SAMPLE) && !strcmp(program->sample_name, name)) @@ -1064,20 +1072,20 @@ _initialize_sound_dir(Edje *ed) ed->file->sound_dir->tones_count = 0; } -#define GET_TONE_BY_NAME(_tone_p, _name) \ - { \ - unsigned int i = 0; \ - for (i = 0; i < ed->file->sound_dir->tones_count; ++i) \ - { \ - _tone_p = ed->file->sound_dir->tones + i; \ - if (!strcmp(_name, _tone_p->name)) \ - break; \ - } \ - if (i == ed->file->sound_dir->tones_count) _tone_p = NULL; \ - } +#define GET_TONE_BY_NAME(_tone_p, _name) \ + { \ + unsigned int i = 0; \ + for (i = 0; i < ed->file->sound_dir->tones_count; ++i) \ + { \ + _tone_p = ed->file->sound_dir->tones + i; \ + if (!strcmp(_name, _tone_p->name)) \ + break; \ + } \ + if (i == ed->file->sound_dir->tones_count) _tone_p = NULL; \ + } EAPI Eina_Bool -edje_edit_sound_sample_add(Evas_Object *obj, const char* name, const char* snd_src) +edje_edit_sound_sample_add(Evas_Object *obj, const char *name, const char *snd_src) { if (!name) return EINA_FALSE; if (!snd_src) return EINA_FALSE; @@ -1105,7 +1113,7 @@ edje_edit_sound_sample_add(Evas_Object *obj, const char* name, const char* snd_s if (ed->file->sound_dir->samples) { sound_sample = ed->file->sound_dir->samples + - ed->file->sound_dir->samples_count - 1; + ed->file->sound_dir->samples_count - 1; id = sound_sample->id + 1; snprintf(sample, sizeof(sample), "edje/sounds/%i", id); } @@ -1124,9 +1132,9 @@ edje_edit_sound_sample_add(Evas_Object *obj, const char* name, const char* snd_s ed->file->sound_dir->samples_count); sound_sample = ed->file->sound_dir->samples + - ed->file->sound_dir->samples_count - 1; - sound_sample->name = (char*)eina_stringshare_add(name); - sound_sample->snd_src = (char*)eina_stringshare_add(snd_src); + ed->file->sound_dir->samples_count - 1; + sound_sample->name = (char *)eina_stringshare_add(name); + sound_sample->snd_src = (char *)eina_stringshare_add(snd_src); sound_sample->compression = EDJE_SOUND_SOURCE_TYPE_INLINE_RAW; sound_sample->id = id; sound_sample->mode = 0; @@ -1136,7 +1144,7 @@ edje_edit_sound_sample_add(Evas_Object *obj, const char* name, const char* snd_s } EAPI Eina_Bool -edje_edit_sound_sample_del(Evas_Object *obj, const char* name) +edje_edit_sound_sample_del(Evas_Object *obj, const char *name) { Edje_Sound_Sample *sound_sample = NULL; unsigned int i = 0; @@ -1157,7 +1165,7 @@ edje_edit_sound_sample_del(Evas_Object *obj, const char* name) { sound_sample = ed->file->sound_dir->samples + i; if (!strcmp(name, sound_sample->name)) - break; + break; } if (i == ed->file->sound_dir->samples_count) { @@ -1190,7 +1198,7 @@ edje_edit_sound_sample_del(Evas_Object *obj, const char* name) --ed->file->sound_dir->samples_count; sound_sample_last = ed->file->sound_dir->samples + - ed->file->sound_dir->samples_count - 1; + ed->file->sound_dir->samples_count - 1; while (sound_sample <= sound_sample_last) { @@ -1223,7 +1231,7 @@ edje_edit_sound_sample_del(Evas_Object *obj, const char* name) } EAPI Eina_Bool -edje_edit_sound_tone_add(Evas_Object *obj, const char* name, int frequency) +edje_edit_sound_tone_add(Evas_Object *obj, const char *name, int frequency) { if (!name) return EINA_FALSE; if ((frequency < 20) || (frequency > 20000)) @@ -1258,17 +1266,16 @@ edje_edit_sound_tone_add(Evas_Object *obj, const char* name, int frequency) else return EINA_FALSE; sound_tone = ed->file->sound_dir->tones + - ed->file->sound_dir->tones_count - 1; - sound_tone->name = (char*)eina_stringshare_add(name); + ed->file->sound_dir->tones_count - 1; + sound_tone->name = (char *)eina_stringshare_add(name); sound_tone->value = frequency; sound_tone->id = id; return EINA_TRUE; } - EAPI Eina_Bool -edje_edit_sound_tone_del(Evas_Object *obj, const char* name) +edje_edit_sound_tone_del(Evas_Object *obj, const char *name) { GET_ED_OR_RETURN(EINA_FALSE); @@ -1285,10 +1292,10 @@ edje_edit_sound_tone_del(Evas_Object *obj, const char* name) Edje_Sound_Tone *sound_tone; GET_TONE_BY_NAME(sound_tone, name); if (!sound_tone) - { - WRN("Unable to delete tone \"%s\". It does not exist.", name); - return EINA_FALSE; - } + { + WRN("Unable to delete tone \"%s\". It does not exist.", name); + return EINA_FALSE; + } { Eet_File *eetf; @@ -1304,7 +1311,7 @@ edje_edit_sound_tone_del(Evas_Object *obj, const char* name) --ed->file->sound_dir->tones_count; Edje_Sound_Tone *sound_tone_last = ed->file->sound_dir->tones + - ed->file->sound_dir->tones_count - 1; + ed->file->sound_dir->tones_count - 1; while (sound_tone <= sound_tone_last) { @@ -1365,50 +1372,50 @@ edje_edit_sound_tone_frequency_get(Evas_Object *obj, const char *name) EAPI double edje_edit_sound_compression_rate_get(Evas_Object *obj, const char *sound) { - Edje_Sound_Sample *ss = NULL; - unsigned int i; + Edje_Sound_Sample *ss = NULL; + unsigned int i; - GET_ED_OR_RETURN(-1); + GET_ED_OR_RETURN(-1); - if ((!ed->file) || (!ed->file->sound_dir)) - return -1; + if ((!ed->file) || (!ed->file->sound_dir)) + return -1; - for (i = 0; i < ed->file->sound_dir->samples_count; i++) - { - ss = ed->file->sound_dir->samples + i; - if ((ss->name) && (!strcmp(sound, ss->name))) - break; - } + for (i = 0; i < ed->file->sound_dir->samples_count; i++) + { + ss = ed->file->sound_dir->samples + i; + if ((ss->name) && (!strcmp(sound, ss->name))) + break; + } - if (i == ed->file->sound_dir->samples_count) - return -1; + if (i == ed->file->sound_dir->samples_count) + return -1; - return ss->quality; + return ss->quality; } EAPI Eina_Bool edje_edit_sound_compression_rate_set(Evas_Object *obj, const char *sound, double rate) { - Edje_Sound_Sample *ss = NULL; - unsigned int i; + Edje_Sound_Sample *ss = NULL; + unsigned int i; - GET_ED_OR_RETURN(EINA_FALSE); + GET_ED_OR_RETURN(EINA_FALSE); - if ((!ed->file) || (!ed->file->sound_dir)) - return EINA_FALSE; + if ((!ed->file) || (!ed->file->sound_dir)) + return EINA_FALSE; - for (i = 0; i < ed->file->sound_dir->samples_count; i++) - { - ss = ed->file->sound_dir->samples + i; - if ((ss->name) && (!strcmp(sound, ss->name))) - break; - } + for (i = 0; i < ed->file->sound_dir->samples_count; i++) + { + ss = ed->file->sound_dir->samples + i; + if ((ss->name) && (!strcmp(sound, ss->name))) + break; + } - if (i == ed->file->sound_dir->samples_count) - return EINA_FALSE; + if (i == ed->file->sound_dir->samples_count) + return EINA_FALSE; - ss->quality = rate; - return EINA_TRUE; + ss->quality = rate; + return EINA_TRUE; } #undef GET_TONE_BY_NAME @@ -1422,7 +1429,7 @@ edje_edit_sound_compression_type_get(Evas_Object *obj, const char *sound) GET_ED_OR_RETURN(-1); if ((!ed->file) || (!ed->file->sound_dir)) - return -1; + return -1; for (i = 0; i < ed->file->sound_dir->samples_count; i++) { @@ -1434,7 +1441,7 @@ edje_edit_sound_compression_type_get(Evas_Object *obj, const char *sound) if (i == ed->file->sound_dir->samples_count) return -1; - return (Edje_Edit_Sound_Comp) ss->compression; + return (Edje_Edit_Sound_Comp)ss->compression; } EAPI Eina_Bool @@ -1449,7 +1456,7 @@ edje_edit_sound_compression_type_set(Evas_Object *obj, const char *sound, Edje_E GET_ED_OR_RETURN(EINA_FALSE); if ((!ed->file) || (!ed->file->sound_dir)) - return EINA_FALSE; + return EINA_FALSE; for (i = 0; i < ed->file->sound_dir->samples_count; i++) { @@ -1461,7 +1468,7 @@ edje_edit_sound_compression_type_set(Evas_Object *obj, const char *sound, Edje_E if (i == ed->file->sound_dir->samples_count) return EINA_FALSE; - ss->compression = (int) sc; + ss->compression = (int)sc; return EINA_TRUE; } @@ -1475,17 +1482,17 @@ edje_edit_sound_samplebuffer_get(Evas_Object *obj, const char *sample_name) const void *data; if (!sample_name) - { - ERR("Given Sample Name is NULL\n"); - return NULL; - } + { + ERR("Given Sample Name is NULL\n"); + return NULL; + } GET_ED_OR_RETURN(NULL); if ((!ed) || (!ed->file) || (!ed->file->sound_dir)) return NULL; - for(i = 0; i < (int)ed->file->sound_dir->samples_count; i++) + for (i = 0; i < (int)ed->file->sound_dir->samples_count; i++) { sample = &ed->file->sound_dir->samples[i]; if (!strcmp(sample->name, sample_name)) @@ -1518,17 +1525,17 @@ edje_edit_sound_samplesource_get(Evas_Object *obj, const char *sample_name) int i; if (!sample_name) - { - ERR("Given Sample Name is NULL"); - return NULL; - } + { + ERR("Given Sample Name is NULL"); + return NULL; + } GET_ED_OR_RETURN(NULL); if ((!ed) || (!ed->file) || (!ed->file->sound_dir)) return NULL; - for(i = 0; i < (int)ed->file->sound_dir->samples_count; i++) + for (i = 0; i < (int)ed->file->sound_dir->samples_count; i++) { sample = &ed->file->sound_dir->samples[i]; if (!strcmp(sample->name, sample_name)) @@ -1538,7 +1545,6 @@ edje_edit_sound_samplesource_get(Evas_Object *obj, const char *sample_name) return NULL; } - /****************/ /* GROUPS API */ /****************/ @@ -1570,9 +1576,9 @@ edje_edit_group_copy(Evas_Object *obj, const char *group_name, const char *copy_ eetf = eet_open(ed->file->path, EET_FILE_MODE_READ_WRITE); if (!eetf) { - ERR("Edje_Edit: Error. unable to open \"%s\" " - "for writing output", ed->file->path); - return EINA_FALSE; + ERR("Edje_Edit: Error. unable to open \"%s\" " + "for writing output", ed->file->path); + return EINA_FALSE; } snprintf(buf, sizeof(buf), "edje/collections/%d", e->id); epc = eet_data_read(eetf, _edje_edd_edje_part_collection, buf); @@ -1582,23 +1588,23 @@ edje_edit_group_copy(Evas_Object *obj, const char *group_name, const char *copy_ search = 0; while (id == -1) { - Eina_Iterator *i; - Eina_Bool found = 0; + Eina_Iterator *i; + Eina_Bool found = 0; - i = eina_hash_iterator_data_new(ed->file->collection); + i = eina_hash_iterator_data_new(ed->file->collection); - EINA_ITERATOR_FOREACH(i, d) - { - if (search == d->id) - { - found = 1; - break; - } - } + EINA_ITERATOR_FOREACH(i, d) + { + if (search == d->id) + { + found = 1; + break; + } + } - eina_iterator_free(i); + eina_iterator_free(i); - if (!found) id = search; + if (!found) id = search; else search++; } @@ -1611,10 +1617,10 @@ edje_edit_group_copy(Evas_Object *obj, const char *group_name, const char *copy_ de->entry = eina_stringshare_add(copy_name); memcpy(&de->count, &e->count, sizeof (de->count)); -#define EDIT_EMN(Tp, Sz, Ce) \ - Ce->mp.Tp = eina_mempool_add("chained_mempool", #Tp, NULL, sizeof (Sz), 8); -#define EDIT_EMNP(Tp, Sz, Ce) \ - Ce->mp_rtl.Tp = eina_mempool_add("chained_mempool", #Tp, NULL, sizeof (Sz), 8); +#define EDIT_EMN(Tp, Sz, Ce) \ + Ce->mp.Tp = eina_mempool_add("chained_mempool", #Tp, NULL, sizeof (Sz), 8); +#define EDIT_EMNP(Tp, Sz, Ce) \ + Ce->mp_rtl.Tp = eina_mempool_add("chained_mempool", #Tp, NULL, sizeof (Sz), 8); eina_hash_direct_add(ed->file->collection, de->entry, de); @@ -1662,7 +1668,7 @@ edje_edit_group_copy(Evas_Object *obj, const char *group_name, const char *copy_ keys = eet_list(eetf, buf, &count); if (keys) { - while(count) + while (count) { count--; data = eet_read(eetf, keys[count], &script_count); @@ -1710,8 +1716,8 @@ edje_edit_group_add(Evas_Object *obj, const char *name) pc = _alloc(sizeof(Edje_Part_Collection)); if (!pc) { - free(de); - return EINA_FALSE; + free(de); + return EINA_FALSE; } /* Search first free id */ @@ -1719,25 +1725,25 @@ edje_edit_group_add(Evas_Object *obj, const char *name) search = 0; while (id == -1) { - Eina_Iterator *i; - Eina_Bool found = 0; + Eina_Iterator *i; + Eina_Bool found = 0; - i = eina_hash_iterator_data_new(ed->file->collection); + i = eina_hash_iterator_data_new(ed->file->collection); - EINA_ITERATOR_FOREACH(i, d) - { - // printf("search if %d is free [id %d]\n", search, d->id); - if (search == d->id) - { - found = 1; - break; - } - } + EINA_ITERATOR_FOREACH(i, d) + { + // printf("search if %d is free [id %d]\n", search, d->id); + if (search == d->id) + { + found = 1; + break; + } + } - eina_iterator_free(i); + eina_iterator_free(i); - if (!found) id = search; - else search++; + if (!found) id = search; + else search++; } /* Init Edje_Part_Collection_Directory_Entry */ @@ -1803,7 +1809,7 @@ edje_edit_group_del(Evas_Object *obj, const char *group_name) if (strcmp(g->part, e->entry) == 0) { ed->file->collection_cache = - eina_list_remove_list(ed->file->collection_cache, l); + eina_list_remove_list(ed->file->collection_cache, l); die = g; break; } @@ -1813,9 +1819,9 @@ edje_edit_group_del(Evas_Object *obj, const char *group_name) eetf = eet_open(ed->file->path, EET_FILE_MODE_READ_WRITE); if (!eetf) { - ERR("Edje_Edit: Error. unable to open \"%s\" " - "for writing output", ed->file->path); - return EINA_FALSE; + ERR("Edje_Edit: Error. unable to open \"%s\" " + "for writing output", ed->file->path); + return EINA_FALSE; } snprintf(buf, sizeof(buf), "edje/collections/%d", e->id); eet_delete(eetf, buf); @@ -1832,7 +1838,7 @@ edje_edit_group_del(Evas_Object *obj, const char *group_name) count--; eet_delete(eetf, keys[count]); } - while(count); + while (count); free(keys); } eet_close(eetf); @@ -1846,7 +1852,7 @@ edje_edit_group_del(Evas_Object *obj, const char *group_name) if (e->id == g->id) { ed->file->collection_cache = - eina_list_remove_list(ed->file->collection_cache, l); + eina_list_remove_list(ed->file->collection_cache, l); e_del = eina_hash_find(ed->file->collection, g->part); eina_hash_del(ed->file->collection, g->part, e_del); _edje_collection_free(ed->file, g, e_del); @@ -1892,7 +1898,7 @@ edje_edit_group_name_set(Evas_Object *obj, const char *new_name) _edje_edit_group_references_update(obj, pc->part, new_name); //printf("Set name of current group: %s [id: %d][new name: %s]\n", - // pc->part, pc->id, new_name); + // pc->part, pc->id, new_name); //if (pc->part && ed->file->free_strings) eina_stringshare_del(pc->part); TODO FIXME pce = eina_hash_find(ed->file->collection, pc->part); @@ -1906,22 +1912,22 @@ edje_edit_group_name_set(Evas_Object *obj, const char *new_name) return EINA_TRUE; } -#define FUNC_GROUP_ACCESSOR(Class, Value) \ - EAPI int \ - edje_edit_group_##Class##_##Value##_get(Evas_Object *obj) \ - { \ - GET_ED_OR_RETURN(-1); \ - if (!ed->collection) return -1; \ - return ed->collection->prop.Class.Value; \ - } \ - EAPI Eina_Bool \ - edje_edit_group_##Class##_##Value##_set(Evas_Object *obj, int v) \ - { \ - GET_ED_OR_RETURN(EINA_FALSE); \ - if (!ed->collection) return EINA_FALSE; \ - if (v < 0) return EINA_FALSE; \ - ed->collection->prop.Class.Value = v; \ - return EINA_TRUE; \ +#define FUNC_GROUP_ACCESSOR(Class, Value) \ + EAPI int \ + edje_edit_group_##Class##_##Value##_get(Evas_Object * obj) \ + { \ + GET_ED_OR_RETURN(-1); \ + if (!ed->collection) return -1; \ + return ed->collection->prop.Class.Value; \ + } \ + EAPI Eina_Bool \ + edje_edit_group_##Class##_##Value##_set(Evas_Object * obj, int v) \ + { \ + GET_ED_OR_RETURN(EINA_FALSE); \ + if (!ed->collection) return EINA_FALSE; \ + if (v < 0) return EINA_FALSE; \ + ed->collection->prop.Class.Value = v; \ + return EINA_TRUE; \ } FUNC_GROUP_ACCESSOR(min, w); @@ -1936,6 +1942,7 @@ edje_edit_group_orientation_get(Evas_Object *obj) if (!ed->collection) return -1; return ed->collection->prop.orientation; } + EAPI Eina_Bool edje_edit_group_orientation_set(Evas_Object *obj, unsigned char orient) { @@ -1953,6 +1960,7 @@ edje_edit_group_broadcast_signal_get(Evas_Object *obj) if (!ed->collection) return EINA_TRUE; return ed->collection->broadcast_signal; } + EAPI Eina_Bool edje_edit_group_broadcast_signal_set(Evas_Object *obj, Eina_Bool bs) { @@ -1962,87 +1970,87 @@ edje_edit_group_broadcast_signal_set(Evas_Object *obj, Eina_Bool bs) return EINA_TRUE; } -#define LIMITS(TYPE) \ -EAPI Eina_List * \ -edje_edit_group_limits_##TYPE##_list_get(Evas_Object * obj) \ -{ \ - Eina_List *limits = NULL; \ - unsigned int i; \ - Edje_Edit_Limit *lim; \ - \ - GET_ED_OR_RETURN(NULL); \ - \ - if (!ed->file || !ed->collection) \ - return NULL; \ - for(i = 0; i < ed->collection->limits.TYPE##_count; i++) \ - { \ - lim = malloc(sizeof(Edje_Edit_Limit)); \ - lim->name = eina_stringshare_add(ed->collection->limits.TYPE[i]->name); \ - lim->value = ed->collection->limits.TYPE[i]->value; \ - limits = eina_list_append(limits, &lim); \ - } \ - \ - return limits; \ -} \ - \ -EAPI Eina_Bool \ -edje_edit_group_limits_##TYPE##_del(Evas_Object * obj, const char * name, int value) \ -{ \ - unsigned int i; \ - unsigned int new_count; \ - \ - if ((!name) || (value < 1)) \ - return EINA_FALSE; \ - GET_ED_OR_RETURN(EINA_FALSE); \ - GET_EED_OR_RETURN(EINA_FALSE); \ - \ - new_count = ed->collection->limits.TYPE##_count - 1; \ - for(i = 0; i < ed->collection->limits.TYPE##_count; i++) \ - if ((ed->collection->limits.TYPE[i]->value == value) \ - && (!strcmp(ed->collection->limits.TYPE[i]->name, name))) \ - { \ - _edje_if_string_free(ed, &ed->collection->limits.TYPE[i]->name); \ - free(ed->collection->limits.TYPE[i]); \ - if (i < new_count) \ - { \ - ed->collection->limits.TYPE[i] = \ +#define LIMITS(TYPE) \ + EAPI Eina_List * \ + edje_edit_group_limits_##TYPE##_list_get(Evas_Object * obj) \ + { \ + Eina_List *limits = NULL; \ + unsigned int i; \ + Edje_Edit_Limit *lim; \ + \ + GET_ED_OR_RETURN(NULL); \ + \ + if (!ed->file || !ed->collection) \ + return NULL; \ + for (i = 0; i < ed->collection->limits.TYPE##_count; i++) \ + { \ + lim = malloc(sizeof(Edje_Edit_Limit)); \ + lim->name = eina_stringshare_add(ed->collection->limits.TYPE[i]->name); \ + lim->value = ed->collection->limits.TYPE[i]->value; \ + limits = eina_list_append(limits, &lim); \ + } \ + \ + return limits; \ + } \ + \ + EAPI Eina_Bool \ + edje_edit_group_limits_##TYPE##_del(Evas_Object * obj, const char *name, int value) \ + { \ + unsigned int i; \ + unsigned int new_count; \ + \ + if ((!name) || (value < 1)) \ + return EINA_FALSE; \ + GET_ED_OR_RETURN(EINA_FALSE); \ + GET_EED_OR_RETURN(EINA_FALSE); \ + \ + new_count = ed->collection->limits.TYPE##_count - 1; \ + for (i = 0; i < ed->collection->limits.TYPE##_count; i++) \ + if ((ed->collection->limits.TYPE[i]->value == value) \ + && (!strcmp(ed->collection->limits.TYPE[i]->name, name))) \ + { \ + _edje_if_string_free(ed, &ed->collection->limits.TYPE[i]->name); \ + free(ed->collection->limits.TYPE[i]); \ + if (i < new_count) \ + { \ + ed->collection->limits.TYPE[i] = \ ed->collection->limits.TYPE[ed->collection->limits.TYPE##_count - 1]; \ - } \ - ed->collection->limits.TYPE = realloc(ed->collection->limits.TYPE, \ - new_count * sizeof(Edje_Limit *)); \ - --ed->collection->limits.TYPE##_count; \ - _edje_edit_flag_script_dirty(eed, EINA_TRUE); \ - \ - return EINA_TRUE; \ - } \ - return EINA_FALSE; \ -} \ - \ -EAPI Eina_Bool \ -edje_edit_group_limits_##TYPE##_add(Evas_Object * obj, const char * name, int value) \ -{ \ - unsigned int i; \ - unsigned int new_count; \ - \ - if ((!name) || (value < 1)) \ - return EINA_FALSE; \ - GET_ED_OR_RETURN(EINA_FALSE); \ - \ - for(i = 0; i < ed->collection->limits.TYPE##_count; i++) \ - if ((ed->collection->limits.TYPE[i]->value == value) \ - && (!strcmp(ed->collection->limits.TYPE[i]->name, name))) \ - { \ - return EINA_FALSE; \ - } \ - new_count = ed->collection->limits.TYPE##_count + 1; \ - ed->collection->limits.TYPE = realloc(ed->collection->limits.TYPE, \ - new_count * sizeof(Edje_Limit *)); \ - ed->collection->limits.TYPE[new_count-1] = malloc(sizeof(Edje_Limit)); \ - ed->collection->limits.TYPE[new_count-1]->name = eina_stringshare_add(name); \ - ed->collection->limits.TYPE[new_count-1]->value = value; \ - ++ed->collection->limits.TYPE##_count; \ - return EINA_TRUE; \ -} + } \ + ed->collection->limits.TYPE = realloc(ed->collection->limits.TYPE, \ + new_count * sizeof(Edje_Limit *)); \ + --ed->collection->limits.TYPE##_count; \ + _edje_edit_flag_script_dirty(eed, EINA_TRUE); \ + \ + return EINA_TRUE; \ + } \ + return EINA_FALSE; \ + } \ + \ + EAPI Eina_Bool \ + edje_edit_group_limits_##TYPE##_add(Evas_Object * obj, const char *name, int value) \ + { \ + unsigned int i; \ + unsigned int new_count; \ + \ + if ((!name) || (value < 1)) \ + return EINA_FALSE; \ + GET_ED_OR_RETURN(EINA_FALSE); \ + \ + for (i = 0; i < ed->collection->limits.TYPE##_count; i++) \ + if ((ed->collection->limits.TYPE[i]->value == value) \ + && (!strcmp(ed->collection->limits.TYPE[i]->name, name))) \ + { \ + return EINA_FALSE; \ + } \ + new_count = ed->collection->limits.TYPE##_count + 1; \ + ed->collection->limits.TYPE = realloc(ed->collection->limits.TYPE, \ + new_count * sizeof(Edje_Limit *)); \ + ed->collection->limits.TYPE[new_count - 1] = malloc(sizeof(Edje_Limit)); \ + ed->collection->limits.TYPE[new_count - 1]->name = eina_stringshare_add(name); \ + ed->collection->limits.TYPE[new_count - 1]->value = value; \ + ++ed->collection->limits.TYPE##_count; \ + return EINA_TRUE; \ + } LIMITS(vertical); LIMITS(horizontal); @@ -2185,7 +2193,7 @@ edje_edit_group_alias_add(Evas_Object *obj, const char *group_name, const char * /***************/ EAPI Eina_List * -edje_edit_group_data_list_get(Evas_Object * obj) +edje_edit_group_data_list_get(Evas_Object *obj) { Eina_Iterator *it; Eina_List *datas = NULL; @@ -2208,7 +2216,7 @@ edje_edit_group_data_list_get(Evas_Object * obj) } EAPI Eina_List * -edje_edit_data_list_get(Evas_Object * obj) +edje_edit_data_list_get(Evas_Object *obj) { Eina_Iterator *i; Eina_List *datas = NULL; @@ -2331,7 +2339,7 @@ edje_edit_data_del(Evas_Object *obj, const char *itemname) } EAPI const char * -edje_edit_group_data_value_get(Evas_Object * obj, const char *key) +edje_edit_group_data_value_get(Evas_Object *obj, const char *key) { Edje_String *value; @@ -2348,7 +2356,7 @@ edje_edit_group_data_value_get(Evas_Object * obj, const char *key) } EAPI const char * -edje_edit_data_value_get(Evas_Object * obj, const char *itemname) +edje_edit_data_value_get(Evas_Object *obj, const char *itemname) { Edje_String *value; @@ -2406,19 +2414,20 @@ edje_edit_data_value_set(Evas_Object *obj, const char *itemname, const char *val } EAPI Eina_Bool -edje_edit_group_data_name_set(Evas_Object *obj, const char *key, const char *new_key) +edje_edit_group_data_name_set(Evas_Object *obj, const char *key, const char *new_key) { GET_ED_OR_RETURN(EINA_FALSE); - if (!key || !new_key || !ed->file || !ed->collection) { - return EINA_FALSE; - } + if (!key || !new_key || !ed->file || !ed->collection) + { + return EINA_FALSE; + } return eina_hash_move(ed->collection->data, key, new_key); } EAPI Eina_Bool -edje_edit_data_name_set(Evas_Object *obj, const char *itemname, const char *newname) +edje_edit_data_name_set(Evas_Object *obj, const char *itemname, const char *newname) { GET_ED_OR_RETURN(EINA_FALSE); @@ -2433,7 +2442,7 @@ edje_edit_data_name_set(Evas_Object *obj, const char *itemname, const char *new /***********************/ EAPI Eina_List * -edje_edit_color_classes_list_get(Evas_Object * obj) +edje_edit_color_classes_list_get(Evas_Object *obj) { Eina_List *classes = NULL; Eina_List *l; @@ -2442,7 +2451,7 @@ edje_edit_color_classes_list_get(Evas_Object * obj) GET_ED_OR_RETURN(NULL); if (!ed->file || !ed->file->color_classes) - return NULL; + return NULL; //printf("GET CLASSES LIST %d %d\n", eina_list_count(ed->color_classes), eina_list_count(ed->file->color_classes)); EINA_LIST_FOREACH(ed->file->color_classes, l, cc) classes = eina_list_append(classes, eina_stringshare_add(cc->name)); @@ -2459,27 +2468,27 @@ edje_edit_color_class_colors_get(Evas_Object *obj, const char *class_name, int * GET_ED_OR_RETURN(EINA_FALSE); if (!ed->file || !ed->file->color_classes) - return EINA_FALSE; + return EINA_FALSE; EINA_LIST_FOREACH(ed->file->color_classes, l, cc) if (!strcmp(cc->name, class_name)) { - if (r) *r = cc->r; - if (g) *g = cc->g; - if (b) *b = cc->b; - if (a) *a = cc->a; + if (r) *r = cc->r; + if (g) *g = cc->g; + if (b) *b = cc->b; + if (a) *a = cc->a; - if (r2) *r2 = cc->r2; - if (g2) *g2 = cc->g2; - if (b2) *b2 = cc->b2; - if (a2) *a2 = cc->a2; + if (r2) *r2 = cc->r2; + if (g2) *g2 = cc->g2; + if (b2) *b2 = cc->b2; + if (a2) *a2 = cc->a2; - if (r3) *r3 = cc->r3; - if (g3) *g3 = cc->g3; - if (b3) *b3 = cc->b3; - if (a3) *a3 = cc->a3; + if (r3) *r3 = cc->r3; + if (g3) *g3 = cc->g3; + if (b3) *b3 = cc->b3; + if (a3) *a3 = cc->a3; - return EINA_TRUE; + return EINA_TRUE; } return EINA_FALSE; } @@ -2493,27 +2502,27 @@ edje_edit_color_class_colors_set(Evas_Object *obj, const char *class_name, int r GET_ED_OR_RETURN(EINA_FALSE); if (!ed->file || !ed->file->color_classes) - return EINA_FALSE; + return EINA_FALSE; EINA_LIST_FOREACH(ed->file->color_classes, l, cc) if (!strcmp(cc->name, class_name)) { - if (r > -1) cc->r = r; - if (g > -1) cc->g = g; - if (b > -1) cc->b = b; - if (a > -1) cc->a = a; + if (r > -1) cc->r = r; + if (g > -1) cc->g = g; + if (b > -1) cc->b = b; + if (a > -1) cc->a = a; - if (r2 > -1) cc->r2 = r2; - if (g2 > -1) cc->g2 = g2; - if (b2 > -1) cc->b2 = b2; - if (a2 > -1) cc->a2 = a2; + if (r2 > -1) cc->r2 = r2; + if (g2 > -1) cc->g2 = g2; + if (b2 > -1) cc->b2 = b2; + if (a2 > -1) cc->a2 = a2; - if (r3 > -1) cc->r3 = r3; - if (g3 > -1) cc->g3 = g3; - if (b3 > -1) cc->b3 = b3; - if (a3 > -1) cc->a3 = a3; + if (r3 > -1) cc->r3 = r3; + if (g3 > -1) cc->g3 = g3; + if (b3 > -1) cc->b3 = b3; + if (a3 > -1) cc->a3 = a3; - return EINA_TRUE; + return EINA_TRUE; } return EINA_FALSE; } @@ -2574,7 +2583,7 @@ edje_edit_color_class_add(Evas_Object *obj, const char *name) c = _alloc(sizeof(Edje_Color_Class)); if (!c) return EINA_FALSE; - c->name = (char*)eina_stringshare_add(name); + c->name = (char *)eina_stringshare_add(name); c->r = c->g = c->b = c->a = 255; c->r2 = c->g2 = c->b2 = c->a2 = 255; c->r3 = c->g3 = c->b3 = c->a3 = 255; @@ -2598,10 +2607,10 @@ edje_edit_color_class_del(Evas_Object *obj, const char *name) EINA_LIST_FOREACH(ed->file->color_classes, l, cc) if (strcmp(cc->name, name) == 0) { - _edje_if_string_free(ed, &cc->name); - ed->file->color_classes = eina_list_remove(ed->file->color_classes, cc); - free(cc); - return EINA_TRUE; + _edje_if_string_free(ed, &cc->name); + ed->file->color_classes = eina_list_remove(ed->file->color_classes, cc); + free(cc); + return EINA_TRUE; } return EINA_FALSE; } @@ -2615,7 +2624,7 @@ edje_edit_color_class_name_set(Evas_Object *obj, const char *name, const char *n GET_ED_OR_RETURN(EINA_FALSE); if (!ed->file || !ed->file->color_classes) - return EINA_FALSE; + return EINA_FALSE; EINA_LIST_FOREACH(ed->file->color_classes, l, cc) if (!strcmp(cc->name, name)) @@ -2627,14 +2636,12 @@ edje_edit_color_class_name_set(Evas_Object *obj, const char *name, const char *n return EINA_FALSE; } - - /*********************/ /* TEXT STYLES API */ /*********************/ EAPI Eina_List * -edje_edit_styles_list_get(Evas_Object * obj) +edje_edit_styles_list_get(Evas_Object *obj) { Eina_List *styles = NULL; Eina_List *l; @@ -2643,7 +2650,7 @@ edje_edit_styles_list_get(Evas_Object * obj) GET_ED_OR_RETURN(NULL); if (!ed->file || !ed->file->styles) - return NULL; + return NULL; //printf("GET STYLES LIST %d\n", eina_list_count(ed->file->styles)); EINA_LIST_FOREACH(ed->file->styles, l, s) styles = eina_list_append(styles, eina_stringshare_add(s->name)); @@ -2652,7 +2659,7 @@ edje_edit_styles_list_get(Evas_Object * obj) } EAPI Eina_Bool -edje_edit_style_add(Evas_Object * obj, const char* style) +edje_edit_style_add(Evas_Object *obj, const char *style) { Edje_Style *s; @@ -2664,7 +2671,7 @@ edje_edit_style_add(Evas_Object * obj, const char* style) s = _alloc(sizeof(Edje_Style)); if (!s) return EINA_FALSE; - s->name = (char*)eina_stringshare_add(style); + s->name = (char *)eina_stringshare_add(style); s->tags = NULL; s->style = NULL; @@ -2673,7 +2680,7 @@ edje_edit_style_add(Evas_Object * obj, const char* style) } EAPI Eina_Bool -edje_edit_style_del(Evas_Object * obj, const char* style) +edje_edit_style_del(Evas_Object *obj, const char *style) { Edje_Style *s; @@ -2687,19 +2694,19 @@ edje_edit_style_del(Evas_Object * obj, const char* style) _edje_if_string_free(ed, (const char **)&s->name); //~ //s->style HOWTO FREE ??? while (s->tags) - { - Edje_Style_Tag *t; + { + Edje_Style_Tag *t; - t = s->tags->data; + t = s->tags->data; - s->tags = eina_list_remove(s->tags, t); - _edje_if_string_free(ed, &t->key); - _edje_if_string_free(ed, &t->value); - _edje_if_string_free(ed, &t->font); - _edje_if_string_free(ed, &t->text_class); - free(t); - t = NULL; - } + s->tags = eina_list_remove(s->tags, t); + _edje_if_string_free(ed, &t->key); + _edje_if_string_free(ed, &t->value); + _edje_if_string_free(ed, &t->font); + _edje_if_string_free(ed, &t->text_class); + free(t); + t = NULL; + } free(s); s = NULL; s = NULL; @@ -2707,7 +2714,7 @@ edje_edit_style_del(Evas_Object * obj, const char* style) } EAPI Eina_List * -edje_edit_style_tags_list_get(Evas_Object * obj, const char* style) +edje_edit_style_tags_list_get(Evas_Object *obj, const char *style) { Eina_List *tags = NULL; Eina_List *l; @@ -2716,26 +2723,26 @@ edje_edit_style_tags_list_get(Evas_Object * obj, const char* style) GET_ED_OR_RETURN(NULL); if (!ed->file || !ed->file->styles || !style) - return NULL; + return NULL; s = _edje_edit_style_get(ed, style); //printf("GET STYLE TAG LIST %d\n", eina_list_count(s->tags)); EINA_LIST_FOREACH(s->tags, l, t) - tags = eina_list_append(tags, eina_stringshare_add(t->key)); + tags = eina_list_append(tags, eina_stringshare_add(t->key)); return tags; } EAPI Eina_Bool -edje_edit_style_tag_name_set(Evas_Object * obj, const char* style, const char* tag, const char*new_name) +edje_edit_style_tag_name_set(Evas_Object *obj, const char *style, const char *tag, const char *new_name) { Edje_Style_Tag *t; GET_ED_OR_RETURN(EINA_FALSE); if (!ed->file || !ed->file->styles || !style || !tag) - return EINA_FALSE; + return EINA_FALSE; t = _edje_edit_style_tag_get(ed, style, tag); if (!t) return EINA_FALSE; @@ -2743,8 +2750,8 @@ edje_edit_style_tag_name_set(Evas_Object * obj, const char* style, const char* t return EINA_TRUE; } -EAPI const char* -edje_edit_style_tag_value_get(Evas_Object * obj, const char* style, const char* tag) +EAPI const char * +edje_edit_style_tag_value_get(Evas_Object *obj, const char *style, const char *tag) { Edje_Style_Tag *t; @@ -2752,24 +2759,24 @@ edje_edit_style_tag_value_get(Evas_Object * obj, const char* style, const char* //printf("GET TAG '%s' FOR STYLE '%s'\n", tag, style); if (!ed->file || !ed->file->styles || !style || !tag) - return NULL; + return NULL; t = _edje_edit_style_tag_get(ed, style, tag); if (t && t->value) - return eina_stringshare_add(t->value); + return eina_stringshare_add(t->value); return NULL; } EAPI Eina_Bool -edje_edit_style_tag_value_set(Evas_Object * obj, const char* style, const char* tag, const char*new_value) +edje_edit_style_tag_value_set(Evas_Object *obj, const char *style, const char *tag, const char *new_value) { Edje_Style_Tag *t; GET_ED_OR_RETURN(EINA_FALSE); if (!ed->file || !ed->file->styles || !style || !tag || !new_value) - return EINA_FALSE; + return EINA_FALSE; t = _edje_edit_style_tag_get(ed, style, tag); if (!t) return EINA_FALSE; @@ -2778,7 +2785,7 @@ edje_edit_style_tag_value_set(Evas_Object * obj, const char* style, const char* } EAPI Eina_Bool -edje_edit_style_tag_add(Evas_Object * obj, const char* style, const char* tag_name) +edje_edit_style_tag_add(Evas_Object *obj, const char *style, const char *tag_name) { Edje_Style *s; Edje_Style_Tag *t; @@ -2803,14 +2810,14 @@ edje_edit_style_tag_add(Evas_Object * obj, const char* style, const char* tag_na } EAPI Eina_Bool -edje_edit_style_tag_del(Evas_Object * obj, const char* style, const char* tag) +edje_edit_style_tag_del(Evas_Object *obj, const char *style, const char *tag) { Edje_Style *s; Edje_Style_Tag *t; GET_ED_OR_RETURN(EINA_FALSE); if (!ed->file || !ed->file->styles || !style || !tag ) - return EINA_FALSE; + return EINA_FALSE; s = _edje_edit_style_get(ed, style); t = _edje_edit_style_tag_get(ed, style, tag); @@ -2839,11 +2846,11 @@ edje_edit_externals_list_get(Evas_Object *obj) GET_ED_OR_RETURN(NULL); if (!ed->file || !ed->file->external_dir) - return NULL; + return NULL; //printf("GET STYLES LIST %d\n", eina_list_count(ed->file->styles)); for (i = 0; i < ed->file->external_dir->entries_count; ++i) externals = eina_list_append(externals, - eina_stringshare_add(ed->file->external_dir->entries[i].entry)); + eina_stringshare_add(ed->file->external_dir->entries[i].entry)); return externals; } @@ -2865,27 +2872,27 @@ edje_edit_external_add(Evas_Object *obj, const char *external) for (i = 0; i < ed->file->external_dir->entries_count; ++i) if (!ed->file->external_dir->entries[i].entry) - break ; + break; if (i == ed->file->external_dir->entries_count) { - Edje_External_Directory_Entry *tmp; - unsigned int max; + Edje_External_Directory_Entry *tmp; + unsigned int max; - max = ed->file->external_dir->entries_count + 1; - tmp = realloc(ed->file->external_dir->entries, - sizeof (Edje_External_Directory_Entry) * max); + max = ed->file->external_dir->entries_count + 1; + tmp = realloc(ed->file->external_dir->entries, + sizeof (Edje_External_Directory_Entry) * max); - if (!tmp) return EINA_FALSE; + if (!tmp) return EINA_FALSE; - ed->file->external_dir->entries = tmp; - freeid = ed->file->external_dir->entries_count; - ed->file->external_dir->entries_count = max; + ed->file->external_dir->entries = tmp; + freeid = ed->file->external_dir->entries_count; + ed->file->external_dir->entries_count = max; } else freeid = i; - ed->file->external_dir->entries[freeid].entry = (char*)eina_stringshare_add(external); + ed->file->external_dir->entries[freeid].entry = (char *)eina_stringshare_add(external); return EINA_TRUE; } @@ -2918,7 +2925,7 @@ edje_edit_part_select_mode_get(Evas_Object *obj, const char *part) if (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) return EINA_FALSE; - return (Edje_Edit_Select_Mode) rp->part->select_mode; + return (Edje_Edit_Select_Mode)rp->part->select_mode; } EAPI Eina_Bool @@ -2931,7 +2938,7 @@ edje_edit_part_select_mode_set(Evas_Object *obj, const char *part, Edje_Edit_Sel if (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) return EINA_FALSE; - rp->part->select_mode = (unsigned char) mode; + rp->part->select_mode = (unsigned char)mode; return EINA_TRUE; } @@ -2943,7 +2950,7 @@ edje_edit_part_entry_mode_get(Evas_Object *obj, const char *part) if (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) return EINA_FALSE; - return (Edje_Edit_Entry_Mode) rp->part->entry_mode; + return (Edje_Edit_Entry_Mode)rp->part->entry_mode; } EAPI Eina_Bool @@ -2956,7 +2963,7 @@ edje_edit_part_entry_mode_set(Evas_Object *obj, const char *part, Edje_Edit_Entr if (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) return EINA_FALSE; - rp->part->entry_mode = (unsigned char) mode; + rp->part->entry_mode = (unsigned char)mode; return EINA_TRUE; } @@ -2973,17 +2980,17 @@ edje_edit_parts_list_get(Evas_Object *obj) parts = NULL; for (i = 0; i < ed->table_parts_size; i++) { - Edje_Real_Part *rp; + Edje_Real_Part *rp; - rp = ed->table_parts[i]; - parts = eina_list_append(parts, eina_stringshare_add(rp->part->name)); + rp = ed->table_parts[i]; + parts = eina_list_append(parts, eina_stringshare_add(rp->part->name)); } return parts; } EAPI Eina_Bool -edje_edit_part_name_set(Evas_Object *obj, const char* part, const char* new_name) +edje_edit_part_name_set(Evas_Object *obj, const char *part, const char *new_name) { GET_EED_OR_RETURN(EINA_FALSE); GET_RP_OR_RETURN(EINA_FALSE); @@ -3001,19 +3008,19 @@ edje_edit_part_name_set(Evas_Object *obj, const char* part, const char* new_name return EINA_TRUE; } -#define FUNC_PART_API_STRING(Value) \ - EAPI const char * \ - edje_edit_part_api_##Value##_get(Evas_Object *obj, const char *part) \ - { \ - GET_RP_OR_RETURN(NULL); \ - return eina_stringshare_add(rp->part->api.Value); \ - } \ - EAPI Eina_Bool \ - edje_edit_part_api_##Value##_set(Evas_Object *obj, const char *part, const char *s) \ - { \ - GET_RP_OR_RETURN(EINA_FALSE); \ - _edje_if_string_replace(ed, &rp->part->api.Value, s); \ - return EINA_TRUE; \ +#define FUNC_PART_API_STRING(Value) \ + EAPI const char * \ + edje_edit_part_api_##Value##_get(Evas_Object * obj, const char *part) \ + { \ + GET_RP_OR_RETURN(NULL); \ + return eina_stringshare_add(rp->part->api.Value); \ + } \ + EAPI Eina_Bool \ + edje_edit_part_api_##Value##_set(Evas_Object * obj, const char *part, const char *s) \ + { \ + GET_RP_OR_RETURN(EINA_FALSE); \ + _edje_if_string_replace(ed, &rp->part->api.Value, s); \ + return EINA_TRUE; \ } FUNC_PART_API_STRING(name); @@ -3217,7 +3224,7 @@ edje_edit_part_external_add(Evas_Object *obj, const char *name, const char *sour } EAPI Eina_Bool -edje_edit_part_del(Evas_Object *obj, const char* part) +edje_edit_part_del(Evas_Object *obj, const char *part) { Edje_Part_Collection_Directory_Entry *ce; Edje_Part_Collection *pc; @@ -3237,34 +3244,34 @@ edje_edit_part_del(Evas_Object *obj, const char* part) /* Unlik Edje_Real_Parts that link to the removed one */ for (i = 0; i < ed->table_parts_size; i++) { - Edje_Real_Part *real; + Edje_Real_Part *real; - if (i == id) continue; //don't check the deleted id - real = ed->table_parts[i]; + if (i == id) continue; //don't check the deleted id + real = ed->table_parts[i]; - if ((rp->type == EDJE_RP_TYPE_TEXT) && + if ((rp->type == EDJE_RP_TYPE_TEXT) && (real->typedata.text) && (real->typedata.text->source == rp)) real->typedata.text->source = NULL; - if ((rp->type == EDJE_RP_TYPE_TEXT) && - (real->typedata.text) && (real->typedata.text->text_source == rp)) + if ((rp->type == EDJE_RP_TYPE_TEXT) && + (real->typedata.text) && (real->typedata.text->text_source == rp)) real->typedata.text->text_source = NULL; - if (real->part->clip_to_id == rp->part->id) - { - evas_object_clip_set(real->object, ed->base->clipper); - real->part->clip_to_id = -1; - } - if (real->drag && real->drag->confine_to == rp) - { - real->drag->confine_to = NULL; - } - if (real->part->dragable.event_id != -1) - { - if (real->part->dragable.event_id == TO_INT(id)) - real->part->dragable.event_id = -1; - else if (i > id) - real->part->dragable.event_id--; - } + if (real->part->clip_to_id == rp->part->id) + { + evas_object_clip_set(real->object, ed->base->clipper); + real->part->clip_to_id = -1; + } + if (real->drag && real->drag->confine_to == rp) + { + real->drag->confine_to = NULL; + } + if (real->part->dragable.event_id != -1) + { + if (real->part->dragable.event_id == TO_INT(id)) + real->part->dragable.event_id = -1; + else if (i > id) + real->part->dragable.event_id--; + } } /* Unlink all the parts and descriptions that refer to id */ @@ -3275,8 +3282,8 @@ edje_edit_part_del(Evas_Object *obj, const char* part) pc->parts_count--; if (id < pc->parts_count) /* Forward parts */ { - int mcount = (pc->parts_count - id) * sizeof(Edje_Part *); - memmove(&pc->parts[id], &pc->parts[id+1], mcount); + int mcount = (pc->parts_count - id) * sizeof(Edje_Part *); + memmove(&pc->parts[id], &pc->parts[id + 1], mcount); } pc->parts[pc->parts_count] = NULL; _edje_fix_parts_id(ed); @@ -3287,8 +3294,8 @@ edje_edit_part_del(Evas_Object *obj, const char* part) _edje_if_string_free(ed, &ep->name); if (ep->default_desc) { - _edje_collection_free_part_description_free(ep->type, ep->default_desc, ce, 0); - ep->default_desc = NULL; + _edje_collection_free_part_description_free(ep->type, ep->default_desc, ce, 0); + ep->default_desc = NULL; } for (k = 0; k < ep->other.desc_count; ++k) @@ -3344,7 +3351,7 @@ edje_edit_part_copy(Evas_Object *obj, const char *part, const char *new_copy) epcopy = rpcopy->part; #define _PARAM_PART_COPY(param) \ - epcopy->param = ep->param; + epcopy->param = ep->param; _PARAM_PART_COPY(scale) _PARAM_PART_COPY(mouse_events) @@ -3385,9 +3392,9 @@ edje_edit_part_copy(Evas_Object *obj, const char *part, const char *new_copy) _PARAM_PART_COPY(access) if (ep->api.name) - epcopy->api.name = eina_stringshare_add(ep->api.name); + epcopy->api.name = eina_stringshare_add(ep->api.name); if (ep->api.description) - epcopy->api.description = eina_stringshare_add(ep->api.description); + epcopy->api.description = eina_stringshare_add(ep->api.description); #undef _PARAM_PART_COPY @@ -3413,8 +3420,8 @@ edje_edit_part_exist(Evas_Object *obj, const char *part) return EINA_TRUE; } -EAPI const char* -edje_edit_part_below_get(Evas_Object *obj, const char* part) +EAPI const char * +edje_edit_part_below_get(Evas_Object *obj, const char *part) { Edje_Real_Part *prev; @@ -3427,14 +3434,14 @@ edje_edit_part_below_get(Evas_Object *obj, const char* part) return eina_stringshare_add(prev->part->name); } -EAPI const char* -edje_edit_part_above_get(Evas_Object *obj, const char* part) +EAPI const char * +edje_edit_part_above_get(Evas_Object *obj, const char *part) { Edje_Real_Part *next; GET_RP_OR_RETURN(0); - if ((unsigned int) rp->part->id >= ed->table_parts_size - 1) return 0; + if ((unsigned int)rp->part->id >= ed->table_parts_size - 1) return 0; next = ed->table_parts[(rp->part->id + 1) % ed->table_parts_size]; @@ -3442,7 +3449,7 @@ edje_edit_part_above_get(Evas_Object *obj, const char* part) } EAPI Eina_Bool -edje_edit_part_restack_below(Evas_Object *obj, const char* part) +edje_edit_part_restack_below(Evas_Object *obj, const char *part) { Edje_Part_Collection *group; Edje_Real_Part *prev; @@ -3476,7 +3483,7 @@ edje_edit_part_restack_below(Evas_Object *obj, const char* part) } EAPI Eina_Bool -edje_edit_part_restack_part_below(Evas_Object *obj, const char* part, const char *below) +edje_edit_part_restack_part_below(Evas_Object *obj, const char *part, const char *below) { Edje_Part_Collection *group; Edje_Real_Part *rp, *rp_below, *prev; @@ -3514,7 +3521,7 @@ edje_edit_part_restack_part_below(Evas_Object *obj, const char* part, const char } EAPI Eina_Bool -edje_edit_part_restack_above(Evas_Object *obj, const char* part) +edje_edit_part_restack_above(Evas_Object *obj, const char *part) { Edje_Part_Collection *group; Edje_Real_Part *next; @@ -3525,7 +3532,7 @@ edje_edit_part_restack_above(Evas_Object *obj, const char* part) //printf("RESTACK PART: %s ABOVE\n", part); - if ((unsigned int) rp->part->id >= ed->table_parts_size - 1) return EINA_FALSE; + if ((unsigned int)rp->part->id >= ed->table_parts_size - 1) return EINA_FALSE; group = ed->collection; @@ -3550,7 +3557,7 @@ edje_edit_part_restack_above(Evas_Object *obj, const char* part) } EAPI Eina_Bool -edje_edit_part_restack_part_above(Evas_Object *obj, const char* part, const char *above) +edje_edit_part_restack_part_above(Evas_Object *obj, const char *part, const char *above) { Edje_Part_Collection *group; Edje_Real_Part *rp, *rp_above, *next; @@ -3601,8 +3608,8 @@ edje_edit_part_selected_state_get(Evas_Object *obj, const char *part, double *va if (!rp->chosen_description) { - if (value) *value = 0.0; // FIXME: Make sure edje_edit supports correctly the default having any value - return eina_stringshare_add("default"); + if (value) *value = 0.0; // FIXME: Make sure edje_edit supports correctly the default having any value + return eina_stringshare_add("default"); } if (value) *value = rp->chosen_description->state.value; @@ -3659,25 +3666,25 @@ edje_edit_part_clip_to_set(Evas_Object *obj, const char *part, const char *clip_ /* unset clipping */ if (!clip_to) { - if (rp->part->clip_to_id >= 0) - { - clip = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size]; + if (rp->part->clip_to_id >= 0) + { + clip = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size]; - evas_object_pointer_mode_set(clip->object, - EVAS_OBJECT_POINTER_MODE_AUTOGRAB); - evas_object_clip_unset(rp->object); - } + evas_object_pointer_mode_set(clip->object, + EVAS_OBJECT_POINTER_MODE_AUTOGRAB); + evas_object_clip_unset(rp->object); + } - evas_object_clip_set(rp->object, ed->base->clipper); + evas_object_clip_set(rp->object, ed->base->clipper); if ((rp->type == EDJE_RP_TYPE_SWALLOW) && (rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object)) evas_object_clip_set(rp->typedata.swallow->swallowed_object, ed->base->clipper); - rp->part->clip_to_id = -1; + rp->part->clip_to_id = -1; - edje_object_calc_force(obj); + edje_object_calc_force(obj); - return EINA_TRUE; + return EINA_TRUE; } /* set clipping */ @@ -3687,9 +3694,9 @@ edje_edit_part_clip_to_set(Evas_Object *obj, const char *part, const char *clip_ o = clip->object; while ((oo = evas_object_clip_get(o))) { - if (o == rp->object) - return EINA_FALSE; - o = oo; + if (o == rp->object) + return EINA_FALSE; + o = oo; } rp->part->clip_to_id = clip->part->id; @@ -3755,7 +3762,6 @@ edje_edit_part_anti_alias_set(Evas_Object *obj, const char *part, Eina_Bool anti return EINA_TRUE; } - EAPI Eina_Bool edje_edit_part_repeat_events_get(Evas_Object *obj, const char *part) { @@ -3798,8 +3804,8 @@ edje_edit_part_multiline_set(Evas_Object *obj, const char *part, Eina_Bool multi GET_RP_OR_RETURN(EINA_FALSE); if ((!rp->object) || - ((rp->part->type != EDJE_PART_TYPE_TEXT) && - (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))) + ((rp->part->type != EDJE_PART_TYPE_TEXT) && + (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))) return EINA_FALSE; rp->part->multiline = multiline; @@ -3961,7 +3967,7 @@ _check_recursive_reference(Edje *ed, const char *source, Eina_List *group_path, eina_stringshare_del(part_source); part_source = edje_edit_part_source_get(part_obj, part_name); type = edje_edit_part_type_get(part_obj, part_name); - if ((type == EDJE_PART_TYPE_GROUP) && part_source) + if ((type == EDJE_PART_TYPE_GROUP) && part_source) { /* Make sure that this group isn't already in the tree of parents */ EINA_LIST_FOREACH(group_path, l, data) @@ -4005,7 +4011,7 @@ edje_edit_part_source_set(Evas_Object *obj, const char *part, const char *source case EDJE_PART_TYPE_GROUP: /* find source group */ if (!_check_recursive_reference(ed, source, group_path, rp->part)) - return EINA_FALSE; + return EINA_FALSE; if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object)) { @@ -4019,45 +4025,48 @@ edje_edit_part_source_set(Evas_Object *obj, const char *part, const char *source edje_object_file_set(child_obj, ed->file->path, source); _edje_real_part_swallow(ed, rp, child_obj, EINA_TRUE); } - // this fall through case is intentional + + // this fall through case is intentional case EDJE_PART_TYPE_TEXTBLOCK: if (source) _edje_if_string_replace(ed, &rp->part->source, source); else _edje_if_string_free(ed, &rp->part->source); return EINA_TRUE; + case EDJE_PART_TYPE_EXTERNAL: //EXTERNAL part has source property but it cannot be changed break; + default: break; } return EINA_FALSE; } -#define TEXT_BLOCK_SOURCE_GET(N) \ -EAPI const char * \ -edje_edit_part_source ## N ## _get(Evas_Object *obj, const char *part) \ -{ \ - GET_RP_OR_RETURN(NULL); \ - if (!rp->part->source ## N) return NULL; \ - return eina_stringshare_add(rp->part->source ## N); \ -} +#define TEXT_BLOCK_SOURCE_GET(N) \ + EAPI const char * \ + edje_edit_part_source ## N ## _get(Evas_Object * obj, const char *part) \ + { \ + GET_RP_OR_RETURN(NULL); \ + if (!rp->part->source ## N) return NULL; \ + return eina_stringshare_add(rp->part->source ## N); \ + } -#define TEXT_BLOCK_SOURCE_SET(N) \ -EAPI Eina_Bool \ -edje_edit_part_source ## N ##_set(Evas_Object *obj, const char *part, const char *source) \ -{ \ - GET_RP_OR_RETURN(EINA_FALSE); \ - \ - if (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) \ - return EINA_FALSE; \ - \ - eina_stringshare_del(rp->part->source ## N); \ - if (source) \ - rp->part->source ## N = eina_stringshare_add(source); \ - else \ - rp->part->source ## N = NULL; \ - edje_object_calc_force(obj); \ - return EINA_TRUE; \ -} +#define TEXT_BLOCK_SOURCE_SET(N) \ + EAPI Eina_Bool \ + edje_edit_part_source ## N ##_set(Evas_Object * obj, const char *part, const char *source) \ + { \ + GET_RP_OR_RETURN(EINA_FALSE); \ + \ + if (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) \ + return EINA_FALSE; \ + \ + eina_stringshare_del(rp->part->source ## N); \ + if (source) \ + rp->part->source ## N = eina_stringshare_add(source); \ + else \ + rp->part->source ## N = NULL; \ + edje_object_calc_force(obj); \ + return EINA_TRUE; \ + } TEXT_BLOCK_SOURCE_GET(2); TEXT_BLOCK_SOURCE_GET(3); TEXT_BLOCK_SOURCE_GET(4); @@ -4130,19 +4139,19 @@ edje_edit_part_drag_y_set(Evas_Object *obj, const char *part, int drag) return EINA_TRUE; } -#define FUNC_PART_DRAG_INT(Class, Value) \ - EAPI int \ - edje_edit_part_drag_##Class##_##Value##_get(Evas_Object *obj, const char *part) \ - { \ - GET_RP_OR_RETURN(0); \ - return rp->part->dragable.Class##_##Value; \ - } \ - EAPI Eina_Bool \ - edje_edit_part_drag_##Class##_##Value##_set(Evas_Object *obj, const char *part, int v) \ - { \ - GET_RP_OR_RETURN(EINA_FALSE); \ - rp->part->dragable.Class##_##Value = v; \ - return EINA_TRUE; \ +#define FUNC_PART_DRAG_INT(Class, Value) \ + EAPI int \ + edje_edit_part_drag_##Class##_##Value##_get(Evas_Object * obj, const char *part) \ + { \ + GET_RP_OR_RETURN(0); \ + return rp->part->dragable.Class##_##Value; \ + } \ + EAPI Eina_Bool \ + edje_edit_part_drag_##Class##_##Value##_set(Evas_Object * obj, const char *part, int v) \ + { \ + GET_RP_OR_RETURN(EINA_FALSE); \ + rp->part->dragable.Class##_##Value = v; \ + return EINA_TRUE; \ } FUNC_PART_DRAG_INT(step, x); @@ -4150,39 +4159,39 @@ FUNC_PART_DRAG_INT(step, y); FUNC_PART_DRAG_INT(count, x); FUNC_PART_DRAG_INT(count, y); -#define FUNC_PART_DRAG_ID(Id) \ - EAPI const char* \ - edje_edit_part_drag_##Id##_get(Evas_Object *obj, const char *part) \ - { \ - Edje_Real_Part *p; \ - \ - GET_RP_OR_RETURN(NULL); \ - \ - if (rp->part->dragable.Id##_id < 0) \ - return NULL; \ - \ - p = ed->table_parts[rp->part->dragable.Id##_id]; \ - return eina_stringshare_add(p->part->name); \ - } \ - EAPI Eina_Bool \ - edje_edit_part_drag_##Id##_set(Evas_Object *obj, const char *part, const char *e) \ - { \ - Edje_Real_Part *e_part; \ - \ - eina_error_set(0); \ - if ((!obj) || (!part)) \ - return EINA_FALSE; \ - \ - GET_RP_OR_RETURN(EINA_FALSE); \ - if (!e) \ - { \ - rp->part->dragable.Id##_id = -1; \ - return EINA_TRUE; \ - } \ - e_part = _edje_real_part_get(ed, e); \ - if (!e_part) return EINA_FALSE; \ - rp->part->dragable.Id##_id = e_part->part->id; \ - return EINA_TRUE; \ +#define FUNC_PART_DRAG_ID(Id) \ + EAPI const char * \ + edje_edit_part_drag_##Id##_get(Evas_Object * obj, const char *part) \ + { \ + Edje_Real_Part *p; \ + \ + GET_RP_OR_RETURN(NULL); \ + \ + if (rp->part->dragable.Id##_id < 0) \ + return NULL; \ + \ + p = ed->table_parts[rp->part->dragable.Id##_id]; \ + return eina_stringshare_add(p->part->name); \ + } \ + EAPI Eina_Bool \ + edje_edit_part_drag_##Id##_set(Evas_Object * obj, const char *part, const char *e) \ + { \ + Edje_Real_Part *e_part; \ + \ + eina_error_set(0); \ + if ((!obj) || (!part)) \ + return EINA_FALSE; \ + \ + GET_RP_OR_RETURN(EINA_FALSE); \ + if (!e) \ + { \ + rp->part->dragable.Id##_id = -1; \ + return EINA_TRUE; \ + } \ + e_part = _edje_real_part_get(ed, e); \ + if (!e_part) return EINA_FALSE; \ + rp->part->dragable.Id##_id = e_part->part->id; \ + return EINA_TRUE; \ } FUNC_PART_DRAG_ID(confine); @@ -4193,32 +4202,32 @@ FUNC_PART_DRAG_ID(threshold); /* BOX API */ /***************************/ -#define FUNC_STATE_BOX_LAYOUT(Layout) \ - EAPI Eina_Stringshare * \ - edje_edit_state_box_##Layout##_get(Evas_Object *obj, const char *part, const char *state, double value) \ - { \ - GET_PD_OR_RETURN(0) \ - if (rp->part->type == EDJE_PART_TYPE_BOX) \ - { \ - Edje_Part_Description_Box *box; \ - box = (Edje_Part_Description_Box *) pd; \ - return eina_stringshare_add(box->box.Layout); \ - } \ - return NULL; \ - } \ - EAPI Eina_Bool \ - edje_edit_state_box_##Layout##_set(Evas_Object *obj, const char *part, const char *state, double value, char *layout) \ - { \ - GET_PD_OR_RETURN(EINA_FALSE) \ - if (rp->part->type == EDJE_PART_TYPE_BOX) \ - { \ - Edje_Part_Description_Box *box; \ - box = (Edje_Part_Description_Box *) pd; \ - box->box.Layout = layout; \ - } \ - else \ - return EINA_FALSE; \ - return EINA_TRUE; \ +#define FUNC_STATE_BOX_LAYOUT(Layout) \ + EAPI Eina_Stringshare * \ + edje_edit_state_box_##Layout##_get(Evas_Object * obj, const char *part, const char *state, double value) \ + { \ + GET_PD_OR_RETURN(0) \ + if (rp->part->type == EDJE_PART_TYPE_BOX) \ + { \ + Edje_Part_Description_Box *box; \ + box = (Edje_Part_Description_Box *)pd; \ + return eina_stringshare_add(box->box.Layout); \ + } \ + return NULL; \ + } \ + EAPI Eina_Bool \ + edje_edit_state_box_##Layout##_set(Evas_Object * obj, const char *part, const char *state, double value, char *layout) \ + { \ + GET_PD_OR_RETURN(EINA_FALSE) \ + if (rp->part->type == EDJE_PART_TYPE_BOX) \ + { \ + Edje_Part_Description_Box *box; \ + box = (Edje_Part_Description_Box *)pd; \ + box->box.Layout = layout; \ + } \ + else \ + return EINA_FALSE; \ + return EINA_TRUE; \ } FUNC_STATE_BOX_LAYOUT(layout); @@ -4236,11 +4245,12 @@ edje_edit_state_table_homogeneous_get(Evas_Object *obj, const char *part, const switch (rp->part->type) { case EDJE_PART_TYPE_TABLE: - { - Edje_Part_Description_Table *table; - table = (Edje_Part_Description_Table*) pd; - return table->table.homogeneous; - } + { + Edje_Part_Description_Table *table; + table = (Edje_Part_Description_Table *)pd; + return table->table.homogeneous; + } + default: return 0; } @@ -4255,12 +4265,13 @@ edje_edit_state_table_homogeneous_set(Evas_Object *obj, const char *part, const switch (rp->part->type) { case EDJE_PART_TYPE_TABLE: - { - Edje_Part_Description_Table *table; - table = (Edje_Part_Description_Table*) pd; - table->table.homogeneous = homogeneous; - break; - } + { + Edje_Part_Description_Table *table; + table = (Edje_Part_Description_Table *)pd; + table->table.homogeneous = homogeneous; + break; + } + default: return EINA_FALSE; } @@ -4279,21 +4290,23 @@ edje_edit_state_container_align_get(Evas_Object *obj, const char *part, const ch switch (rp->part->type) { case EDJE_PART_TYPE_TABLE: - { - Edje_Part_Description_Table *table; - table = (Edje_Part_Description_Table*) pd; - if (x) *x = FROM_DOUBLE(table->table.align.x); - if (y) *y = FROM_DOUBLE(table->table.align.y); - break; - } + { + Edje_Part_Description_Table *table; + table = (Edje_Part_Description_Table *)pd; + if (x) *x = FROM_DOUBLE(table->table.align.x); + if (y) *y = FROM_DOUBLE(table->table.align.y); + break; + } + case EDJE_PART_TYPE_BOX: - { - Edje_Part_Description_Box *box; - box = (Edje_Part_Description_Box*) pd; - if (x) *x = FROM_DOUBLE(box->box.align.x); - if (y) *y = FROM_DOUBLE(box->box.align.y); - break; - } + { + Edje_Part_Description_Box *box; + box = (Edje_Part_Description_Box *)pd; + if (x) *x = FROM_DOUBLE(box->box.align.x); + if (y) *y = FROM_DOUBLE(box->box.align.y); + break; + } + default: return EINA_FALSE; } @@ -4308,28 +4321,30 @@ edje_edit_state_container_align_set(Evas_Object *obj, const char *part, const ch switch (rp->part->type) { case EDJE_PART_TYPE_TABLE: - { - Edje_Part_Description_Table *table; - table = (Edje_Part_Description_Table*) pd; - table->table.align.x = TO_DOUBLE(x); - table->table.align.y = TO_DOUBLE(y); - break; - } + { + Edje_Part_Description_Table *table; + table = (Edje_Part_Description_Table *)pd; + table->table.align.x = TO_DOUBLE(x); + table->table.align.y = TO_DOUBLE(y); + break; + } + case EDJE_PART_TYPE_BOX: - { - Edje_Part_Description_Box *box; - box = (Edje_Part_Description_Box*) pd; - box->box.align.x = x; - box->box.align.y = y; - break; - } + { + Edje_Part_Description_Box *box; + box = (Edje_Part_Description_Box *)pd; + box->box.align.x = x; + box->box.align.y = y; + break; + } + default: return EINA_FALSE; } return EINA_TRUE; } -EAPI Eina_Bool +EAPI Eina_Bool edje_edit_state_container_padding_get(Evas_Object *obj, const char *part, const char *state, double value, int *x, int *y) { GET_PD_OR_RETURN(EINA_FALSE) @@ -4337,21 +4352,23 @@ edje_edit_state_container_padding_get(Evas_Object *obj, const char *part, const switch (rp->part->type) { case EDJE_PART_TYPE_TABLE: - { - Edje_Part_Description_Table *table; - table = (Edje_Part_Description_Table*) pd; - if (x) *x = table->table.padding.x; - if (y) *y = table->table.padding.y; - break; - } + { + Edje_Part_Description_Table *table; + table = (Edje_Part_Description_Table *)pd; + if (x) *x = table->table.padding.x; + if (y) *y = table->table.padding.y; + break; + } + case EDJE_PART_TYPE_BOX: - { - Edje_Part_Description_Box *box; - box = (Edje_Part_Description_Box*) pd; - if (x) *x = box->box.padding.x; - if (y) *y = box->box.padding.y; - break; - } + { + Edje_Part_Description_Box *box; + box = (Edje_Part_Description_Box *)pd; + if (x) *x = box->box.padding.x; + if (y) *y = box->box.padding.y; + break; + } + default: return EINA_FALSE; } @@ -4367,23 +4384,25 @@ edje_edit_state_container_padding_set(Evas_Object *obj, const char *part, const switch (rp->part->type) { case EDJE_PART_TYPE_TABLE: - { - Edje_Part_Description_Table *table; - table = (Edje_Part_Description_Table*) pd; - table->table.padding.x = x; - table->table.padding.y = y; - break; - } + { + Edje_Part_Description_Table *table; + table = (Edje_Part_Description_Table *)pd; + table->table.padding.x = x; + table->table.padding.y = y; + break; + } + case EDJE_PART_TYPE_BOX: - { - Edje_Part_Description_Box *box; - box = (Edje_Part_Description_Box*) pd; - box->box.padding.x = x; - box->box.padding.y = y; - break; - } + { + Edje_Part_Description_Box *box; + box = (Edje_Part_Description_Box *)pd; + box->box.padding.x = x; + box->box.padding.y = y; + break; + } + default: - return EINA_FALSE; + return EINA_FALSE; } return EINA_TRUE; } @@ -4396,21 +4415,23 @@ edje_edit_state_container_min_get(Evas_Object *obj, const char *part, const char switch (rp->part->type) { case EDJE_PART_TYPE_TABLE: - { - Edje_Part_Description_Table *table; - table = (Edje_Part_Description_Table*) pd; - if (h) *h = table->table.min.h; - if (v) *v = table->table.min.v; - break; - } + { + Edje_Part_Description_Table *table; + table = (Edje_Part_Description_Table *)pd; + if (h) *h = table->table.min.h; + if (v) *v = table->table.min.v; + break; + } + case EDJE_PART_TYPE_BOX: - { - Edje_Part_Description_Box *box; - box = (Edje_Part_Description_Box*) pd; - if (h) *h = box->box.min.h; - if (v) *v = box->box.min.v; - break; - } + { + Edje_Part_Description_Box *box; + box = (Edje_Part_Description_Box *)pd; + if (h) *h = box->box.min.h; + if (v) *v = box->box.min.v; + break; + } + default: return EINA_FALSE; } @@ -4426,23 +4447,25 @@ edje_edit_state_container_min_set(Evas_Object *obj, const char *part, const char switch (rp->part->type) { case EDJE_PART_TYPE_TABLE: - { - Edje_Part_Description_Table *table; - table = (Edje_Part_Description_Table*) pd; - table->table.min.h = h; - table->table.min.v = v; - break; - } + { + Edje_Part_Description_Table *table; + table = (Edje_Part_Description_Table *)pd; + table->table.min.h = h; + table->table.min.v = v; + break; + } + case EDJE_PART_TYPE_BOX: - { - Edje_Part_Description_Box *box; - box = (Edje_Part_Description_Box*) pd; - box->box.min.h = h; - box->box.min.v = v; - break; - } + { + Edje_Part_Description_Box *box; + box = (Edje_Part_Description_Box *)pd; + box->box.min.h = h; + box->box.min.v = v; + break; + } + default: - return EINA_FALSE; + return EINA_FALSE; } return EINA_TRUE; } @@ -4454,7 +4477,6 @@ edje_edit_state_container_min_set(Evas_Object *obj, const char *part, const char EAPI Eina_Bool edje_edit_part_item_append(Evas_Object *obj, const char *part, const char *item_name, const char *source_group) { - Edje_Part *ep; unsigned int i; Edje_Pack_Element *item; @@ -4463,7 +4485,7 @@ edje_edit_part_item_append(Evas_Object *obj, const char *part, const char *item_ /* There is only Box and Table is allowed. */ if ((rp->part->type != EDJE_PART_TYPE_BOX) && - (rp->part->type != EDJE_PART_TYPE_TABLE)) + (rp->part->type != EDJE_PART_TYPE_TABLE)) return EINA_FALSE; ep = rp->part; @@ -4525,20 +4547,20 @@ edje_edit_part_items_list_get(Evas_Object *obj, const char *part) GET_RP_OR_RETURN(NULL); /* There is only Box and Table is allowed. */ if ((rp->part->type != EDJE_PART_TYPE_BOX) && - (rp->part->type != EDJE_PART_TYPE_TABLE)) + (rp->part->type != EDJE_PART_TYPE_TABLE)) return NULL; ep = rp->part; if (!ed->file) return NULL; for (i = 0; i < ep->items_count; ++i) items_list = eina_list_append(items_list, - eina_stringshare_add(ep->items[i]->name)); + eina_stringshare_add(ep->items[i]->name)); return items_list; } EAPI Eina_Bool -edje_edit_part_item_del(Evas_Object *obj, const char *part, const char* name) +edje_edit_part_item_del(Evas_Object *obj, const char *part, const char *name) { Edje_Part *ep; Edje_Pack_Element *item; @@ -4546,7 +4568,7 @@ edje_edit_part_item_del(Evas_Object *obj, const char *part, const char* name) GET_RP_OR_RETURN(EINA_FALSE); /* There is only Box and Table is allowed. */ if ((rp->part->type != EDJE_PART_TYPE_BOX) && - (rp->part->type != EDJE_PART_TYPE_TABLE)) + (rp->part->type != EDJE_PART_TYPE_TABLE)) return EINA_FALSE; ep = rp->part; if (!ed->file) return EINA_FALSE; @@ -4555,7 +4577,7 @@ edje_edit_part_item_del(Evas_Object *obj, const char *part, const char* name) { item = ep->items[i]; if (!strcmp(name, item->name)) - break; + break; } if (i == ep->items_count) { @@ -4594,7 +4616,6 @@ edje_edit_part_item_del(Evas_Object *obj, const char *part, const char* name) return EINA_TRUE; } - EAPI Eina_Bool edje_edit_part_item_source_set(Evas_Object *obj, const char *part, const char *item_name, const char *source_group) { @@ -4606,7 +4627,7 @@ edje_edit_part_item_source_set(Evas_Object *obj, const char *part, const char *i /* There is only Box and Table is allowed. */ if ((rp->part->type != EDJE_PART_TYPE_BOX) && - (rp->part->type != EDJE_PART_TYPE_TABLE)) + (rp->part->type != EDJE_PART_TYPE_TABLE)) return EINA_FALSE; ep = rp->part; @@ -4644,7 +4665,7 @@ edje_edit_part_item_source_get(Evas_Object *obj, const char *part, const char *i /* There is only Box and Table is allowed. */ if ((rp->part->type != EDJE_PART_TYPE_BOX) && - (rp->part->type != EDJE_PART_TYPE_TABLE)) + (rp->part->type != EDJE_PART_TYPE_TABLE)) return NULL; ep = rp->part; @@ -4665,53 +4686,53 @@ edje_edit_part_item_source_get(Evas_Object *obj, const char *part, const char *i return eina_stringshare_add(item->source); } -#define FUNC_PART_ITEM_INT(Class, Value, Min) \ - EAPI int \ - edje_edit_part_item_##Class##_##Value##_get(Evas_Object *obj, const char *part, const char *item_name) \ - { \ - Edje_Part *ep; \ - unsigned int i; \ - Edje_Pack_Element *item = NULL; \ - if ((!obj) || (!part) || (!item_name)) \ - return Min; \ - GET_RP_OR_RETURN(Min); \ - ep = rp->part; \ - for (i = 0; i < ep->items_count; ++i) \ - { \ - if (ep->items[i]->name && (!strcmp(ep->items[i]->name, item_name))) \ - { \ - item = ep->items[i]; \ - break; \ - } \ - } \ - if (!item) return Min; \ - return item->Class.Value; \ - } \ - EAPI Eina_Bool \ - edje_edit_part_item_##Class##_##Value##_set(Evas_Object *obj, const char *part, const char *item_name, int v) \ - { \ - Edje_Part *ep; \ - unsigned int i; \ - Edje_Pack_Element *item = NULL; \ - if ((!obj) || (!part) || (!item_name)) \ - return EINA_FALSE; \ - if (v < Min) return EINA_FALSE; \ - GET_RP_OR_RETURN(EINA_FALSE); \ - ep = rp->part; \ - if ((rp->part->type != EDJE_PART_TYPE_BOX) && \ - (rp->part->type != EDJE_PART_TYPE_TABLE)) \ - return EINA_FALSE; \ - for (i = 0; i < ep->items_count; ++i) \ - { \ - if (ep->items[i]->name && (!strcmp(ep->items[i]->name, item_name))) \ - { \ - item = ep->items[i]; \ - break; \ - } \ - } \ - if (!item) return EINA_FALSE; \ - item->Class.Value = v; \ - return EINA_TRUE; \ +#define FUNC_PART_ITEM_INT(Class, Value, Min) \ + EAPI int \ + edje_edit_part_item_##Class##_##Value##_get(Evas_Object * obj, const char *part, const char *item_name) \ + { \ + Edje_Part *ep; \ + unsigned int i; \ + Edje_Pack_Element *item = NULL; \ + if ((!obj) || (!part) || (!item_name)) \ + return Min; \ + GET_RP_OR_RETURN(Min); \ + ep = rp->part; \ + for (i = 0; i < ep->items_count; ++i) \ + { \ + if (ep->items[i]->name && (!strcmp(ep->items[i]->name, item_name))) \ + { \ + item = ep->items[i]; \ + break; \ + } \ + } \ + if (!item) return Min; \ + return item->Class.Value; \ + } \ + EAPI Eina_Bool \ + edje_edit_part_item_##Class##_##Value##_set(Evas_Object * obj, const char *part, const char *item_name, int v) \ + { \ + Edje_Part *ep; \ + unsigned int i; \ + Edje_Pack_Element *item = NULL; \ + if ((!obj) || (!part) || (!item_name)) \ + return EINA_FALSE; \ + if (v < Min) return EINA_FALSE; \ + GET_RP_OR_RETURN(EINA_FALSE); \ + ep = rp->part; \ + if ((rp->part->type != EDJE_PART_TYPE_BOX) && \ + (rp->part->type != EDJE_PART_TYPE_TABLE)) \ + return EINA_FALSE; \ + for (i = 0; i < ep->items_count; ++i) \ + { \ + if (ep->items[i]->name && (!strcmp(ep->items[i]->name, item_name))) \ + { \ + item = ep->items[i]; \ + break; \ + } \ + } \ + if (!item) return EINA_FALSE; \ + item->Class.Value = v; \ + return EINA_TRUE; \ } FUNC_PART_ITEM_INT(min, w, 0); @@ -4749,7 +4770,6 @@ edje_edit_part_item_aspect_mode_get(Evas_Object *obj, const char *part, const ch if (!item) return EDJE_ASPECT_CONTROL_NONE; return item->aspect.mode; - } EAPI Eina_Bool @@ -4783,7 +4803,6 @@ edje_edit_part_item_aspect_mode_set(Evas_Object *obj, const char *part, const ch item->aspect.mode = mode; return EINA_TRUE; - } EAPI Eina_Bool @@ -4852,54 +4871,54 @@ edje_edit_part_item_padding_set(Evas_Object *obj, const char *part, const char * return EINA_TRUE; } -#define FUNC_PART_ITEM_DOUBLE(Name, Value, Min, Max) \ - EAPI double \ - edje_edit_part_item_##Name##_get(Evas_Object *obj, const char *part, const char *item_name) \ - { \ - Edje_Part *ep; \ - unsigned int i; \ - Edje_Pack_Element *item = NULL; \ - if ((!obj) || (!part) || (!item_name)) \ - return 0.0; \ - GET_RP_OR_RETURN(0.0); \ - ep = rp->part; \ - for (i = 0; i < ep->items_count; ++i) \ - { \ - if (ep->items[i]->name && (!strcmp(ep->items[i]->name, item_name))) \ - { \ - item = ep->items[i]; \ - break; \ - } \ - } \ - if (!item) return EINA_FALSE; \ - return TO_DOUBLE(item->Value); \ - } \ - EAPI Eina_Bool \ - edje_edit_part_item_##Name##_set(Evas_Object *obj, const char *part, const char *item_name, double v) \ - { \ - Edje_Part *ep; \ - unsigned int i; \ - Edje_Pack_Element *item = NULL; \ - if ((!obj) || (!part) || (!item_name)) \ - return EINA_FALSE; \ - if ((v < Min) || (v > Max)) \ - return EINA_FALSE; \ - GET_RP_OR_RETURN(EINA_FALSE); \ - ep = rp->part; \ - if ((rp->part->type != EDJE_PART_TYPE_BOX) && \ - (rp->part->type != EDJE_PART_TYPE_TABLE)) \ - return EINA_FALSE; \ - for (i = 0; i < ep->items_count; ++i) \ - { \ - if (ep->items[i]->name && (!strcmp(ep->items[i]->name, item_name))) \ - { \ - item = ep->items[i]; \ - break; \ - } \ - } \ - if (!item) return EINA_FALSE; \ - item->Value = FROM_DOUBLE(v); \ - return EINA_TRUE; \ +#define FUNC_PART_ITEM_DOUBLE(Name, Value, Min, Max) \ + EAPI double \ + edje_edit_part_item_##Name##_get(Evas_Object * obj, const char *part, const char *item_name) \ + { \ + Edje_Part *ep; \ + unsigned int i; \ + Edje_Pack_Element *item = NULL; \ + if ((!obj) || (!part) || (!item_name)) \ + return 0.0; \ + GET_RP_OR_RETURN(0.0); \ + ep = rp->part; \ + for (i = 0; i < ep->items_count; ++i) \ + { \ + if (ep->items[i]->name && (!strcmp(ep->items[i]->name, item_name))) \ + { \ + item = ep->items[i]; \ + break; \ + } \ + } \ + if (!item) return EINA_FALSE; \ + return TO_DOUBLE(item->Value); \ + } \ + EAPI Eina_Bool \ + edje_edit_part_item_##Name##_set(Evas_Object * obj, const char *part, const char *item_name, double v) \ + { \ + Edje_Part *ep; \ + unsigned int i; \ + Edje_Pack_Element *item = NULL; \ + if ((!obj) || (!part) || (!item_name)) \ + return EINA_FALSE; \ + if ((v < Min) || (v > Max)) \ + return EINA_FALSE; \ + GET_RP_OR_RETURN(EINA_FALSE); \ + ep = rp->part; \ + if ((rp->part->type != EDJE_PART_TYPE_BOX) && \ + (rp->part->type != EDJE_PART_TYPE_TABLE)) \ + return EINA_FALSE; \ + for (i = 0; i < ep->items_count; ++i) \ + { \ + if (ep->items[i]->name && (!strcmp(ep->items[i]->name, item_name))) \ + { \ + item = ep->items[i]; \ + break; \ + } \ + } \ + if (!item) return EINA_FALSE; \ + item->Value = FROM_DOUBLE(v); \ + return EINA_TRUE; \ } FUNC_PART_ITEM_DOUBLE(align_x, align.x, -1.0, 1.0); @@ -4911,52 +4930,53 @@ FUNC_PART_ITEM_DOUBLE(weight_y, weight.y, 0.0, 99999.990); EAPI Eina_Bool edje_edit_part_item_position_get(Evas_Object *obj, const char *part, const char *item_name, unsigned short *col, unsigned short *row) - { - Edje_Part *ep; - unsigned int i; - Edje_Pack_Element *item = NULL; - if ((!obj) || (!part) || (!item_name)) - return EINA_FALSE; - GET_RP_OR_RETURN(EINA_FALSE); - ep = rp->part; - for (i = 0; i < ep->items_count; ++i) - { - if (ep->items[i]->name && (!strcmp(ep->items[i]->name, item_name))) - { - item = ep->items[i]; - break; - } - } - if (!item) return EINA_FALSE; - *col = item->col; - *row = item->row; - return EINA_TRUE; - } +{ + Edje_Part *ep; + unsigned int i; + Edje_Pack_Element *item = NULL; + if ((!obj) || (!part) || (!item_name)) + return EINA_FALSE; + GET_RP_OR_RETURN(EINA_FALSE); + ep = rp->part; + for (i = 0; i < ep->items_count; ++i) + { + if (ep->items[i]->name && (!strcmp(ep->items[i]->name, item_name))) + { + item = ep->items[i]; + break; + } + } + if (!item) return EINA_FALSE; + *col = item->col; + *row = item->row; + return EINA_TRUE; +} + EAPI Eina_Bool edje_edit_part_item_position_set(Evas_Object *obj, const char *part, const char *item_name, unsigned short col, unsigned short row) - { - Edje_Part *ep; - unsigned int i; - Edje_Pack_Element *item = NULL; - if ((!obj) || (!part) || (!item_name)) - return EINA_FALSE; - GET_RP_OR_RETURN(EINA_FALSE); - ep = rp->part; - if (rp->part->type != EDJE_PART_TYPE_TABLE) - return EINA_FALSE; - for (i = 0; i < ep->items_count; ++i) - { - if (ep->items[i]->name && (!strcmp(ep->items[i]->name, item_name))) - { - item = ep->items[i]; - break; - } - } - if (!item) return EINA_FALSE; - item->col = col; - item->row = row; - return EINA_TRUE; - } +{ + Edje_Part *ep; + unsigned int i; + Edje_Pack_Element *item = NULL; + if ((!obj) || (!part) || (!item_name)) + return EINA_FALSE; + GET_RP_OR_RETURN(EINA_FALSE); + ep = rp->part; + if (rp->part->type != EDJE_PART_TYPE_TABLE) + return EINA_FALSE; + for (i = 0; i < ep->items_count; ++i) + { + if (ep->items[i]->name && (!strcmp(ep->items[i]->name, item_name))) + { + item = ep->items[i]; + break; + } + } + if (!item) return EINA_FALSE; + item->col = col; + item->row = row; + return EINA_TRUE; +} EAPI void edje_edit_part_item_span_get(Evas_Object *obj, const char *part, const char *item_name, unsigned char *col, unsigned char *row) @@ -4993,9 +5013,9 @@ edje_edit_part_item_span_set(Evas_Object *obj, const char *part, const char *ite GET_RP_OR_RETURN(EINA_FALSE); ep = rp->part; if ((rp->part->type != EDJE_PART_TYPE_BOX) && - (rp->part->type != EDJE_PART_TYPE_TABLE)) + (rp->part->type != EDJE_PART_TYPE_TABLE)) return EINA_FALSE; - for (i = 0; i < ep->items_count; i++) + for (i = 0; i < ep->items_count; i++) { if ((ep->items[i]->name) && (!strcmp(ep->items[i]->name, item_name))) { @@ -5029,20 +5049,20 @@ edje_edit_part_states_list_get(Evas_Object *obj, const char *part) //append default state snprintf(state_name, PATH_MAX, "%s %.2f", - rp->part->default_desc->state.name, - rp->part->default_desc->state.value); + rp->part->default_desc->state.name, + rp->part->default_desc->state.value); states = eina_list_append(states, eina_stringshare_add(state_name)); //printf("NEW STATE def: %s\n", state->state.name); //append other states for (i = 0; i < rp->part->other.desc_count; ++i) { - snprintf(state_name, sizeof(state_name), - "%s %.2f", - rp->part->other.desc[i]->state.name, - rp->part->other.desc[i]->state.value); - states = eina_list_append(states, eina_stringshare_add(state_name)); - //printf("NEW STATE: %s\n", state_name); + snprintf(state_name, sizeof(state_name), + "%s %.2f", + rp->part->other.desc[i]->state.name, + rp->part->other.desc[i]->state.value); + states = eina_list_append(states, eina_stringshare_add(state_name)); + //printf("NEW STATE: %s\n", state_name); } return states; } @@ -5055,7 +5075,7 @@ edje_edit_state_name_set(Evas_Object *obj, const char *part, const char *state, GET_PD_OR_RETURN(EINA_FALSE); //printf("Set name of state: %s in part: %s [new name: %s]\n", - // part, state, new_name); + // part, state, new_name); if (!new_name) return EINA_FALSE; @@ -5065,20 +5085,20 @@ edje_edit_state_name_set(Evas_Object *obj, const char *part, const char *state, part_id = _edje_part_id_find(ed, part); for (i = 0; i < ed->collection->patterns.table_programs_size; i++) { - Edje_Program *epr = ed->collection->patterns.table_programs[i]; + Edje_Program *epr = ed->collection->patterns.table_programs[i]; - if (eina_list_count(epr->targets) == 1) - { - Edje_Program_Target *t = eina_list_data_get(epr->targets); + if (eina_list_count(epr->targets) == 1) + { + Edje_Program_Target *t = eina_list_data_get(epr->targets); - if (t->id == part_id && - !strcmp(epr->state, pd->state.name) && - pd->state.value == epr->value) - { - _edje_if_string_replace(ed, &epr->state, new_name); - epr->value = value; - } - } + if (t->id == part_id && + !strcmp(epr->state, pd->state.name) && + pd->state.value == epr->value) + { + _edje_if_string_replace(ed, &epr->state, new_name); + epr->value = value; + } + } } /* set name */ @@ -5100,7 +5120,7 @@ edje_edit_state_del(Evas_Object *obj, const char *part, const char *state, doubl GET_RP_OR_RETURN(EINA_FALSE); if (!edje_edit_state_exist(obj, part, state, value)) - return EINA_FALSE; + return EINA_FALSE; pd = _edje_part_description_find_byname(eed, part, state, value); if (!pd) return EINA_FALSE; @@ -5118,11 +5138,11 @@ edje_edit_state_del(Evas_Object *obj, const char *part, const char *state, doubl for (i = 0; i < rp->part->other.desc_count; ++i) if (pd == rp->part->other.desc[i]) { - memmove(rp->part->other.desc + i, - rp->part->other.desc + i + 1, - sizeof (Edje_Part_Description_Common*) * (rp->part->other.desc_count - i - 1)); - rp->part->other.desc_count--; - break; + memmove(rp->part->other.desc + i, + rp->part->other.desc + i + 1, + sizeof (Edje_Part_Description_Common *) * (rp->part->other.desc_count - i - 1)); + rp->part->other.desc_count--; + break; } _edje_collection_free_part_description_free(rp->part->type, pd, ce, 0); @@ -5140,42 +5160,45 @@ _edje_edit_state_alloc(int type, Edje *ed) switch (type) { case EDJE_PART_TYPE_RECTANGLE: - pd = eina_mempool_malloc(ce->mp.RECTANGLE, sizeof (Edje_Part_Description_Common)); - ce->count.RECTANGLE++; - break; + pd = eina_mempool_malloc(ce->mp.RECTANGLE, sizeof (Edje_Part_Description_Common)); + ce->count.RECTANGLE++; + break; + case EDJE_PART_TYPE_SPACER: - pd = eina_mempool_malloc(ce->mp.SPACER, sizeof (Edje_Part_Description_Common)); - ce->count.SPACER++; - break; + pd = eina_mempool_malloc(ce->mp.SPACER, sizeof (Edje_Part_Description_Common)); + ce->count.SPACER++; + break; + case EDJE_PART_TYPE_SWALLOW: - pd = eina_mempool_malloc(ce->mp.SWALLOW, sizeof (Edje_Part_Description_Common)); - ce->count.SWALLOW++; - break; + pd = eina_mempool_malloc(ce->mp.SWALLOW, sizeof (Edje_Part_Description_Common)); + ce->count.SWALLOW++; + break; + case EDJE_PART_TYPE_GROUP: - pd = eina_mempool_malloc(ce->mp.GROUP, sizeof (Edje_Part_Description_Common)); - ce->count.GROUP++; - break; + pd = eina_mempool_malloc(ce->mp.GROUP, sizeof (Edje_Part_Description_Common)); + ce->count.GROUP++; + break; -#define EDIT_ALLOC_POOL(Short, Type, Name) \ - case EDJE_PART_TYPE_##Short: \ - { \ - Edje_Part_Description_##Type *Name; \ - \ - Name = eina_mempool_malloc(ce->mp.Short, \ - sizeof (Edje_Part_Description_##Type)); \ - memset(Name, 0, sizeof(Edje_Part_Description_##Type)); \ - pd = &Name->common; \ - ce->count.Short++; \ - break; \ - } +#define EDIT_ALLOC_POOL(Short, Type, Name) \ +case EDJE_PART_TYPE_##Short: \ +{ \ + Edje_Part_Description_##Type * Name; \ + \ + Name = eina_mempool_malloc(ce->mp.Short, \ + sizeof (Edje_Part_Description_##Type)); \ + memset(Name, 0, sizeof(Edje_Part_Description_##Type)); \ + pd = &Name->common; \ + ce->count.Short++; \ + break; \ +} - EDIT_ALLOC_POOL(IMAGE, Image, image); - EDIT_ALLOC_POOL(PROXY, Proxy, proxy); - EDIT_ALLOC_POOL(TEXT, Text, text); - EDIT_ALLOC_POOL(TEXTBLOCK, Text, text); - EDIT_ALLOC_POOL(BOX, Box, box); - EDIT_ALLOC_POOL(TABLE, Table, table); - EDIT_ALLOC_POOL(EXTERNAL, External, external_params); + EDIT_ALLOC_POOL(IMAGE, Image, image); + EDIT_ALLOC_POOL(PROXY, Proxy, proxy); + EDIT_ALLOC_POOL(TEXT, Text, text); + EDIT_ALLOC_POOL(TEXTBLOCK, Text, text); + EDIT_ALLOC_POOL(BOX, Box, box); + EDIT_ALLOC_POOL(TABLE, Table, table); + EDIT_ALLOC_POOL(EXTERNAL, External, external_params); } return pd; @@ -5197,21 +5220,21 @@ edje_edit_state_add(Evas_Object *obj, const char *part, const char *name, double if (!rp->part->default_desc) { - rp->part->default_desc = pd; + rp->part->default_desc = pd; } else { - Edje_Part_Description_Common **tmp; + Edje_Part_Description_Common **tmp; - tmp = realloc(rp->part->other.desc, - sizeof (Edje_Part_Description_Common *) * (rp->part->other.desc_count + 1)); - if (!tmp) - { - free(pd); - return EINA_FALSE; - } - rp->part->other.desc = tmp; - rp->part->other.desc[rp->part->other.desc_count++] = pd; + tmp = realloc(rp->part->other.desc, + sizeof (Edje_Part_Description_Common *) * (rp->part->other.desc_count + 1)); + if (!tmp) + { + free(pd); + return EINA_FALSE; + } + rp->part->other.desc = tmp; + rp->part->other.desc[rp->part->other.desc_count++] = pd; } memset(pd, 0, sizeof (*pd)); @@ -5266,128 +5289,132 @@ edje_edit_state_add(Evas_Object *obj, const char *part, const char *name, double if (rp->part->type == EDJE_PART_TYPE_TEXT || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK) { - Edje_Part_Description_Text *text; + Edje_Part_Description_Text *text; - text = (Edje_Part_Description_Text*) pd; + text = (Edje_Part_Description_Text *)pd; - memset(&text->text, 0, sizeof (text->text)); + memset(&text->text, 0, sizeof (text->text)); - text->text.color3.r = 0; - text->text.color3.g = 0; - text->text.color3.b = 0; - text->text.color3.a = 128; - text->text.align.x = 0.5; - text->text.align.y = 0.5; - text->text.id_source = -1; - text->text.id_text_source = -1; + text->text.color3.r = 0; + text->text.color3.g = 0; + text->text.color3.b = 0; + text->text.color3.a = 128; + text->text.align.x = 0.5; + text->text.align.y = 0.5; + text->text.id_source = -1; + text->text.id_text_source = -1; } else if (rp->part->type == EDJE_PART_TYPE_IMAGE) { - Edje_Part_Description_Image *img; + Edje_Part_Description_Image *img; - img = (Edje_Part_Description_Image*) pd; + img = (Edje_Part_Description_Image *)pd; - memset(&img->image, 0, sizeof (img->image)); + memset(&img->image, 0, sizeof (img->image)); - img->image.id = -1; - img->image.fill.smooth = 1; - img->image.fill.pos_rel_x = 0.0; - img->image.fill.pos_abs_x = 0; - img->image.fill.rel_x = 1.0; - img->image.fill.abs_x = 0; - img->image.fill.pos_rel_y = 0.0; - img->image.fill.pos_abs_y = 0; - img->image.fill.rel_y = 1.0; - img->image.fill.abs_y = 0; - img->image.fill.angle = 0; - img->image.fill.spread = 0; - img->image.fill.type = EDJE_FILL_TYPE_SCALE; + img->image.id = -1; + img->image.fill.smooth = 1; + img->image.fill.pos_rel_x = 0.0; + img->image.fill.pos_abs_x = 0; + img->image.fill.rel_x = 1.0; + img->image.fill.abs_x = 0; + img->image.fill.pos_rel_y = 0.0; + img->image.fill.pos_abs_y = 0; + img->image.fill.rel_y = 1.0; + img->image.fill.abs_y = 0; + img->image.fill.angle = 0; + img->image.fill.spread = 0; + img->image.fill.type = EDJE_FILL_TYPE_SCALE; } else if (rp->part->type == EDJE_PART_TYPE_PROXY) { - Edje_Part_Description_Proxy *pro; + Edje_Part_Description_Proxy *pro; - pro = (Edje_Part_Description_Proxy*) pd; + pro = (Edje_Part_Description_Proxy *)pd; - memset(&pro->proxy, 0, sizeof (pro->proxy)); + memset(&pro->proxy, 0, sizeof (pro->proxy)); - pro->proxy.id = -1; - pro->proxy.source_visible = EINA_TRUE; - pro->proxy.source_clip = EINA_TRUE; - pro->proxy.fill.smooth = 1; - pro->proxy.fill.pos_rel_x = 0.0; - pro->proxy.fill.pos_abs_x = 0; - pro->proxy.fill.rel_x = 1.0; - pro->proxy.fill.abs_x = 0; - pro->proxy.fill.pos_rel_y = 0.0; - pro->proxy.fill.pos_abs_y = 0; - pro->proxy.fill.rel_y = 1.0; - pro->proxy.fill.abs_y = 0; - pro->proxy.fill.angle = 0; - pro->proxy.fill.spread = 0; - pro->proxy.fill.type = EDJE_FILL_TYPE_SCALE; + pro->proxy.id = -1; + pro->proxy.source_visible = EINA_TRUE; + pro->proxy.source_clip = EINA_TRUE; + pro->proxy.fill.smooth = 1; + pro->proxy.fill.pos_rel_x = 0.0; + pro->proxy.fill.pos_abs_x = 0; + pro->proxy.fill.rel_x = 1.0; + pro->proxy.fill.abs_x = 0; + pro->proxy.fill.pos_rel_y = 0.0; + pro->proxy.fill.pos_abs_y = 0; + pro->proxy.fill.rel_y = 1.0; + pro->proxy.fill.abs_y = 0; + pro->proxy.fill.angle = 0; + pro->proxy.fill.spread = 0; + pro->proxy.fill.type = EDJE_FILL_TYPE_SCALE; } else if (rp->part->type == EDJE_PART_TYPE_EXTERNAL) { - Edje_Part_Description_External *external; - Edje_External_Param_Info *pi; + Edje_Part_Description_External *external; + Edje_External_Param_Info *pi; - external = (Edje_Part_Description_External*) pd; + external = (Edje_Part_Description_External *)pd; - external->external_params = NULL; + external->external_params = NULL; - if (rp->part->source) - { - pi = (Edje_External_Param_Info *)edje_external_param_info_get(rp->part->source); - while (pi && pi->name) - { - Edje_External_Param *p; - p = _alloc(sizeof(Edje_External_Param)); - /* error checking.. meh */ - p->name = eina_stringshare_add(pi->name); - p->type = pi->type; - switch(p->type) - { - case EDJE_EXTERNAL_PARAM_TYPE_INT: - case EDJE_EXTERNAL_PARAM_TYPE_BOOL: - if (pi->info.i.def != EDJE_EXTERNAL_INT_UNSET) - p->i = pi->info.i.def; - break; - case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: - if (pi->info.d.def != EDJE_EXTERNAL_DOUBLE_UNSET) - p->d = pi->info.d.def; - break; - case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: - if (pi->info.c.def) - p->s = eina_stringshare_add(pi->info.c.def); - break; - case EDJE_EXTERNAL_PARAM_TYPE_STRING: - if (pi->info.s.def) - p->s = eina_stringshare_add(pi->info.s.def); - break; - default: - ERR("unknown external parameter type '%d'", p->type); - } - external->external_params = eina_list_append(external->external_params, p); - pi++; - } - if (external->external_params && rp->typedata.swallow) - rp->param1.external_params = _edje_external_params_parse(rp->typedata.swallow->swallowed_object, external->external_params); - } + if (rp->part->source) + { + pi = (Edje_External_Param_Info *)edje_external_param_info_get(rp->part->source); + while (pi && pi->name) + { + Edje_External_Param *p; + p = _alloc(sizeof(Edje_External_Param)); + /* error checking.. meh */ + p->name = eina_stringshare_add(pi->name); + p->type = pi->type; + switch (p->type) + { + case EDJE_EXTERNAL_PARAM_TYPE_INT: + case EDJE_EXTERNAL_PARAM_TYPE_BOOL: + if (pi->info.i.def != EDJE_EXTERNAL_INT_UNSET) + p->i = pi->info.i.def; + break; + + case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: + if (pi->info.d.def != EDJE_EXTERNAL_DOUBLE_UNSET) + p->d = pi->info.d.def; + break; + + case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: + if (pi->info.c.def) + p->s = eina_stringshare_add(pi->info.c.def); + break; + + case EDJE_EXTERNAL_PARAM_TYPE_STRING: + if (pi->info.s.def) + p->s = eina_stringshare_add(pi->info.s.def); + break; + + default: + ERR("unknown external parameter type '%d'", p->type); + } + external->external_params = eina_list_append(external->external_params, p); + pi++; + } + if (external->external_params && rp->typedata.swallow) + rp->param1.external_params = _edje_external_params_parse(rp->typedata.swallow->swallowed_object, external->external_params); + } } else if (rp->part->type == EDJE_PART_TYPE_BOX) { - Edje_Part_Description_Box *box; + Edje_Part_Description_Box *box; - box = (Edje_Part_Description_Box*) pd; - memset(&box->box, 0, sizeof (box->box)); + box = (Edje_Part_Description_Box *)pd; + memset(&box->box, 0, sizeof (box->box)); } else if (rp->part->type == EDJE_PART_TYPE_TABLE) { - Edje_Part_Description_Table *table; + Edje_Part_Description_Table *table; - table = (Edje_Part_Description_Table*) pd; - memset(&table->table, 0, sizeof (table->table)); + table = (Edje_Part_Description_Table *)pd; + memset(&table->table, 0, sizeof (table->table)); } return EINA_TRUE; @@ -5420,27 +5447,26 @@ _edje_edit_part_state_copy(Evas_Object *obj, const char *part, const char *part_ pdto = _edje_part_description_find_byname(eed, part_to, to, val_to); if (!pdto) { - Edje_Part_Description_Common **tmp; + Edje_Part_Description_Common **tmp; - pdto = _edje_edit_state_alloc(rpto->part->type, ed); - if (!pdto) return EINA_FALSE; - /* No need to check for default desc, at this point it must exist */ + pdto = _edje_edit_state_alloc(rpto->part->type, ed); + if (!pdto) return EINA_FALSE; + /* No need to check for default desc, at this point it must exist */ - tmp = realloc(rpto->part->other.desc, - sizeof (Edje_Part_Description_Common *) * (rpto->part->other.desc_count + 1)); - if (!tmp) - { - free(pdto); - return EINA_FALSE; - } - rpto->part->other.desc = tmp; - rpto->part->other.desc[rpto->part->other.desc_count++] = pdto; + tmp = realloc(rpto->part->other.desc, + sizeof (Edje_Part_Description_Common *) * (rpto->part->other.desc_count + 1)); + if (!tmp) + { + free(pdto); + return EINA_FALSE; + } + rpto->part->other.desc = tmp; + rpto->part->other.desc[rpto->part->other.desc_count++] = pdto; } - -#define PD_STRING_COPY(To, From, _x) \ - if (From->_x) \ - To->_x = (char *)eina_stringshare_add(From->_x); +#define PD_STRING_COPY(To, From, _x) \ + if (From->_x) \ + To->_x = (char *)eina_stringshare_add(From->_x); /* Copy all value */ *pdto = *pdfrom; @@ -5453,114 +5479,122 @@ _edje_edit_part_state_copy(Evas_Object *obj, const char *part, const char *part_ switch (rp->part->type) { case EDJE_PART_TYPE_PROXY: - { - Edje_Part_Description_Proxy *pro_to = (Edje_Part_Description_Proxy*) pdto; - Edje_Part_Description_Proxy *pro_from = (Edje_Part_Description_Proxy*) pdfrom; + { + Edje_Part_Description_Proxy *pro_to = (Edje_Part_Description_Proxy *)pdto; + Edje_Part_Description_Proxy *pro_from = (Edje_Part_Description_Proxy *)pdfrom; - pro_to->proxy = pro_from->proxy; + pro_to->proxy = pro_from->proxy; + + break; + } - break; - } case EDJE_PART_TYPE_IMAGE: - { - Edje_Part_Description_Image *img_to = (Edje_Part_Description_Image*) pdto; - Edje_Part_Description_Image *img_from = (Edje_Part_Description_Image*) pdfrom; - unsigned int i; + { + Edje_Part_Description_Image *img_to = (Edje_Part_Description_Image *)pdto; + Edje_Part_Description_Image *img_from = (Edje_Part_Description_Image *)pdfrom; + unsigned int i; - img_to->image = img_from->image; + img_to->image = img_from->image; - img_to->image.tweens_count = img_from->image.tweens_count; - img_to->image.tweens = calloc(img_to->image.tweens_count, - sizeof (Edje_Part_Image_Id*)); - if (!img_to->image.tweens) - break; + img_to->image.tweens_count = img_from->image.tweens_count; + img_to->image.tweens = calloc(img_to->image.tweens_count, + sizeof (Edje_Part_Image_Id *)); + if (!img_to->image.tweens) + break; - for (i = 0; i < img_to->image.tweens_count; ++i) - { - Edje_Part_Image_Id *new_i; - new_i = _alloc(sizeof(Edje_Part_Image_Id)); - if (!new_i) continue ; + for (i = 0; i < img_to->image.tweens_count; ++i) + { + Edje_Part_Image_Id *new_i; + new_i = _alloc(sizeof(Edje_Part_Image_Id)); + if (!new_i) continue; - *new_i = *img_from->image.tweens[i]; + *new_i = *img_from->image.tweens[i]; + + img_to->image.tweens[i] = new_i; + } + break; + } - img_to->image.tweens[i] = new_i; - } - break; - } case EDJE_PART_TYPE_TEXT: case EDJE_PART_TYPE_TEXTBLOCK: - { - Edje_Part_Description_Text *text_to = (Edje_Part_Description_Text*) pdto; - Edje_Part_Description_Text *text_from = (Edje_Part_Description_Text*) pdfrom; + { + Edje_Part_Description_Text *text_to = (Edje_Part_Description_Text *)pdto; + Edje_Part_Description_Text *text_from = (Edje_Part_Description_Text *)pdfrom; - text_to->text = text_from->text; + text_to->text = text_from->text; + + /* Update pointers. */ + PD_STRING_COPY(text_to, text_from, text.text.str); + PD_STRING_COPY(text_to, text_from, text.text_class); + PD_STRING_COPY(text_to, text_from, text.style.str); + PD_STRING_COPY(text_to, text_from, text.font.str); + PD_STRING_COPY(text_to, text_from, text.repch.str); + break; + } - /* Update pointers. */ - PD_STRING_COPY(text_to, text_from, text.text.str); - PD_STRING_COPY(text_to, text_from, text.text_class); - PD_STRING_COPY(text_to, text_from, text.style.str); - PD_STRING_COPY(text_to, text_from, text.font.str); - PD_STRING_COPY(text_to, text_from, text.repch.str); - break; - } case EDJE_PART_TYPE_BOX: - { - Edje_Part_Description_Box *box_to = (Edje_Part_Description_Box*) pdto; - Edje_Part_Description_Box *box_from = (Edje_Part_Description_Box*) pdfrom; + { + Edje_Part_Description_Box *box_to = (Edje_Part_Description_Box *)pdto; + Edje_Part_Description_Box *box_from = (Edje_Part_Description_Box *)pdfrom; - box_to->box = box_from->box; + box_to->box = box_from->box; + + PD_STRING_COPY(box_to, box_from, box.layout); + PD_STRING_COPY(box_to, box_from, box.alt_layout); + break; + } - PD_STRING_COPY(box_to, box_from, box.layout); - PD_STRING_COPY(box_to, box_from, box.alt_layout); - break; - } case EDJE_PART_TYPE_TABLE: - { - Edje_Part_Description_Table *table_to = (Edje_Part_Description_Table*) pdto; - Edje_Part_Description_Table *table_from = (Edje_Part_Description_Table*) pdfrom; + { + Edje_Part_Description_Table *table_to = (Edje_Part_Description_Table *)pdto; + Edje_Part_Description_Table *table_from = (Edje_Part_Description_Table *)pdfrom; + + table_to->table = table_from->table; + break; + } - table_to->table = table_from->table; - break; - } case EDJE_PART_TYPE_EXTERNAL: - { - Edje_Part_Description_External *ext_to = (Edje_Part_Description_External*) pdto; - Edje_Part_Description_External *ext_from = (Edje_Part_Description_External*) pdfrom; - Eina_List *l; + { + Edje_Part_Description_External *ext_to = (Edje_Part_Description_External *)pdto; + Edje_Part_Description_External *ext_from = (Edje_Part_Description_External *)pdfrom; + Eina_List *l; - /* XXX: optimize this, most likely we don't need to remove and add */ - EINA_LIST_FREE(ext_to->external_params, p) - { - _edje_if_string_free(ed, &p->name); - if (p->s) - _edje_if_string_free(ed, &p->s); - free(p); - } - EINA_LIST_FOREACH(ext_from->external_params, l, p) - { - Edje_External_Param *new_p; - new_p = _alloc(sizeof(Edje_External_Param)); - new_p->name = eina_stringshare_add(p->name); - new_p->type = p->type; - switch (p->type) - { - case EDJE_EXTERNAL_PARAM_TYPE_INT: - new_p->i = p->i; - break; - case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: - new_p->d = p->d; - break; - case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: - case EDJE_EXTERNAL_PARAM_TYPE_STRING: - new_p->s = eina_stringshare_add(p->s); - break; - default: - break; - } - ext_to->external_params = eina_list_append(ext_to->external_params, new_p); - } - break; - } + /* XXX: optimize this, most likely we don't need to remove and add */ + EINA_LIST_FREE(ext_to->external_params, p) + { + _edje_if_string_free(ed, &p->name); + if (p->s) + _edje_if_string_free(ed, &p->s); + free(p); + } + EINA_LIST_FOREACH(ext_from->external_params, l, p) + { + Edje_External_Param *new_p; + new_p = _alloc(sizeof(Edje_External_Param)); + new_p->name = eina_stringshare_add(p->name); + new_p->type = p->type; + switch (p->type) + { + case EDJE_EXTERNAL_PARAM_TYPE_INT: + new_p->i = p->i; + break; + + case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: + new_p->d = p->d; + break; + + case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: + case EDJE_EXTERNAL_PARAM_TYPE_STRING: + new_p->s = eina_stringshare_add(p->s); + break; + + default: + break; + } + ext_to->external_params = eina_list_append(ext_to->external_params, new_p); + } + break; + } } #undef PD_STRING_COPY @@ -5574,20 +5608,20 @@ edje_edit_state_copy(Evas_Object *obj, const char *part, const char *from, doubl return _edje_edit_part_state_copy(obj, part, part, from, val_from, to, val_to); } -#define FUNC_STATE_RELATIVE_DOUBLE(Sub, Value) \ - EAPI double \ - edje_edit_state_##Sub##_relative_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \ - { \ - GET_PD_OR_RETURN(0); \ - return TO_DOUBLE(pd->Sub.relative_##Value); \ - } \ - EAPI Eina_Bool \ - edje_edit_state_##Sub##_relative_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \ - { \ - GET_PD_OR_RETURN(EINA_FALSE); \ - pd->Sub.relative_##Value = FROM_DOUBLE(v); \ - edje_object_calc_force(obj); \ - return EINA_TRUE; \ +#define FUNC_STATE_RELATIVE_DOUBLE(Sub, Value) \ + EAPI double \ + edje_edit_state_##Sub##_relative_##Value##_get(Evas_Object * obj, const char *part, const char *state, double value) \ + { \ + GET_PD_OR_RETURN(0); \ + return TO_DOUBLE(pd->Sub.relative_##Value); \ + } \ + EAPI Eina_Bool \ + edje_edit_state_##Sub##_relative_##Value##_set(Evas_Object * obj, const char *part, const char *state, double value, double v) \ + { \ + GET_PD_OR_RETURN(EINA_FALSE); \ + pd->Sub.relative_##Value = FROM_DOUBLE(v); \ + edje_object_calc_force(obj); \ + return EINA_TRUE; \ } FUNC_STATE_RELATIVE_DOUBLE(rel1, x); @@ -5595,20 +5629,20 @@ FUNC_STATE_RELATIVE_DOUBLE(rel1, y); FUNC_STATE_RELATIVE_DOUBLE(rel2, x); FUNC_STATE_RELATIVE_DOUBLE(rel2, y); -#define FUNC_STATE_OFFSET_INT(Sub, Value) \ - EAPI int \ - edje_edit_state_##Sub##_offset_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \ - { \ - GET_PD_OR_RETURN(0); \ - return pd->Sub.offset_##Value; \ - } \ - EAPI Eina_Bool \ - edje_edit_state_##Sub##_offset_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, int v) \ - { \ - GET_PD_OR_RETURN(EINA_FALSE); \ - pd->Sub.offset_##Value = v; \ - edje_object_calc_force(obj); \ - return EINA_TRUE; \ +#define FUNC_STATE_OFFSET_INT(Sub, Value) \ + EAPI int \ + edje_edit_state_##Sub##_offset_##Value##_get(Evas_Object * obj, const char *part, const char *state, double value) \ + { \ + GET_PD_OR_RETURN(0); \ + return pd->Sub.offset_##Value; \ + } \ + EAPI Eina_Bool \ + edje_edit_state_##Sub##_offset_##Value##_set(Evas_Object * obj, const char *part, const char *state, double value, int v) \ + { \ + GET_PD_OR_RETURN(EINA_FALSE); \ + pd->Sub.offset_##Value = v; \ + edje_object_calc_force(obj); \ + return EINA_TRUE; \ } FUNC_STATE_OFFSET_INT(rel1, x); @@ -5616,34 +5650,34 @@ FUNC_STATE_OFFSET_INT(rel1, y); FUNC_STATE_OFFSET_INT(rel2, x); FUNC_STATE_OFFSET_INT(rel2, y); -#define FUNC_STATE_REL(Sub, Value) \ - EAPI const char * \ - edje_edit_state_##Sub##_to_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \ - { \ - Edje_Real_Part *rel; \ - GET_PD_OR_RETURN(NULL); \ - if (pd->Sub.id_##Value == -1) return NULL; \ - rel = ed->table_parts[pd->Sub.id_##Value % ed->table_parts_size]; \ - if (rel->part->name) return eina_stringshare_add(rel->part->name); \ - return NULL; \ - } \ - EAPI Eina_Bool \ - edje_edit_state_##Sub##_to_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, const char *to) \ - { \ - Edje_Real_Part *relp; \ - GET_PD_OR_RETURN(EINA_FALSE); \ - if ((to) && (strcmp(to, ""))) \ - { \ - relp = _edje_real_part_get(ed, to); \ - if (!relp) return EINA_FALSE; \ - pd->Sub.id_##Value = relp->part->id; \ - return EINA_TRUE; \ - } \ - else \ - { \ - pd->Sub.id_##Value = -1; \ - return EINA_TRUE; \ - } \ +#define FUNC_STATE_REL(Sub, Value) \ + EAPI const char * \ + edje_edit_state_##Sub##_to_##Value##_get(Evas_Object * obj, const char *part, const char *state, double value) \ + { \ + Edje_Real_Part *rel; \ + GET_PD_OR_RETURN(NULL); \ + if (pd->Sub.id_##Value == -1) return NULL; \ + rel = ed->table_parts[pd->Sub.id_##Value % ed->table_parts_size]; \ + if (rel->part->name) return eina_stringshare_add(rel->part->name); \ + return NULL; \ + } \ + EAPI Eina_Bool \ + edje_edit_state_##Sub##_to_##Value##_set(Evas_Object * obj, const char *part, const char *state, double value, const char *to) \ + { \ + Edje_Real_Part *relp; \ + GET_PD_OR_RETURN(EINA_FALSE); \ + if ((to) && (strcmp(to, ""))) \ + { \ + relp = _edje_real_part_get(ed, to); \ + if (!relp) return EINA_FALSE; \ + pd->Sub.id_##Value = relp->part->id; \ + return EINA_TRUE; \ + } \ + else \ + { \ + pd->Sub.id_##Value = -1; \ + return EINA_TRUE; \ + } \ } //note after this call edje_edit_part_selected_state_set() to update !! need to fix this //_edje_part_description_apply(ed, rp, pd->state.name, pd->state.value, "state", 0.1); //Why segfault?? @@ -5655,35 +5689,35 @@ FUNC_STATE_REL(rel2, x); FUNC_STATE_REL(rel2, y); //colors -#define FUNC_COLOR(Code) \ - EAPI void \ - edje_edit_state_##Code##_get(Evas_Object *obj, const char *part, const char *state, double value, int *r, int *g, int *b, int *a) \ - { \ - GET_PD_OR_RETURN(); \ - \ - if (r) *r = pd->Code.r; \ - if (g) *g = pd->Code.g; \ - if (b) *b = pd->Code.b; \ - if (a) *a = pd->Code.a; \ - } \ - EAPI Eina_Bool \ - edje_edit_state_##Code##_set(Evas_Object *obj, const char *part, const char *state, double value, int r, int g, int b, int a) \ - { \ - if ((!obj) || (!part) || (!state)) \ - return EINA_FALSE; \ - GET_PD_OR_RETURN(EINA_FALSE); \ - \ - if (r > -1 && r < 256) pd->Code.r = r; \ - else return EINA_FALSE; \ - if (g > -1 && g < 256) pd->Code.g = g; \ - else return EINA_FALSE; \ - if (b > -1 && b < 256) pd->Code.b = b; \ - else return EINA_FALSE; \ - if (a > -1 && a < 256) pd->Code.a = a; \ - else return EINA_FALSE; \ - \ - edje_object_calc_force(obj); \ - return EINA_TRUE; \ +#define FUNC_COLOR(Code) \ + EAPI void \ + edje_edit_state_##Code##_get(Evas_Object * obj, const char *part, const char *state, double value, int *r, int *g, int *b, int *a) \ + { \ + GET_PD_OR_RETURN(); \ + \ + if (r) *r = pd->Code.r; \ + if (g) *g = pd->Code.g; \ + if (b) *b = pd->Code.b; \ + if (a) *a = pd->Code.a; \ + } \ + EAPI Eina_Bool \ + edje_edit_state_##Code##_set(Evas_Object * obj, const char *part, const char *state, double value, int r, int g, int b, int a) \ + { \ + if ((!obj) || (!part) || (!state)) \ + return EINA_FALSE; \ + GET_PD_OR_RETURN(EINA_FALSE); \ + \ + if (r > -1 && r < 256) pd->Code.r = r; \ + else return EINA_FALSE; \ + if (g > -1 && g < 256) pd->Code.g = g; \ + else return EINA_FALSE; \ + if (b > -1 && b < 256) pd->Code.b = b; \ + else return EINA_FALSE; \ + if (a > -1 && a < 256) pd->Code.a = a; \ + else return EINA_FALSE; \ + \ + edje_object_calc_force(obj); \ + return EINA_TRUE; \ } FUNC_COLOR(color); @@ -5706,7 +5740,7 @@ edje_edit_state_color3_get(Evas_Object *obj, const char *part, const char *state return; } - txt = (Edje_Part_Description_Text*) pd; + txt = (Edje_Part_Description_Text *)pd; if (r) *r = txt->text.color3.r; if (g) *g = txt->text.color3.g; @@ -5727,7 +5761,7 @@ edje_edit_state_color3_set(Evas_Object *obj, const char *part, const char *state (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return EINA_FALSE; - txt = (Edje_Part_Description_Text*) pd; + txt = (Edje_Part_Description_Text *)pd; if (r > -1 && r < 256) txt->text.color3.r = r; else return EINA_FALSE; @@ -5742,57 +5776,57 @@ edje_edit_state_color3_set(Evas_Object *obj, const char *part, const char *state return EINA_TRUE; } -#define FUNC_STATE_DOUBLE(Class, Value) \ - EAPI double \ - edje_edit_state_##Class##_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \ - { \ - GET_PD_OR_RETURN(0); \ - return TO_DOUBLE(pd->Class.Value); \ - } \ - EAPI Eina_Bool \ - edje_edit_state_##Class##_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \ - { \ - GET_PD_OR_RETURN(EINA_FALSE); \ - pd->Class.Value = FROM_DOUBLE(v); \ - edje_object_calc_force(obj); \ - return EINA_TRUE; \ +#define FUNC_STATE_DOUBLE(Class, Value) \ + EAPI double \ + edje_edit_state_##Class##_##Value##_get(Evas_Object * obj, const char *part, const char *state, double value) \ + { \ + GET_PD_OR_RETURN(0); \ + return TO_DOUBLE(pd->Class.Value); \ + } \ + EAPI Eina_Bool \ + edje_edit_state_##Class##_##Value##_set(Evas_Object * obj, const char *part, const char *state, double value, double v) \ + { \ + GET_PD_OR_RETURN(EINA_FALSE); \ + pd->Class.Value = FROM_DOUBLE(v); \ + edje_object_calc_force(obj); \ + return EINA_TRUE; \ } -#define FUNC_STATE_INT(Class, Value, Min) \ - EAPI int \ - edje_edit_state_##Class##_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \ - { \ - GET_PD_OR_RETURN(0); \ - return pd->Class.Value; \ - } \ - EAPI Eina_Bool \ - edje_edit_state_##Class##_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, int v) \ - { \ - if ((!obj) || (!part) || (!state)) \ - return EINA_FALSE; \ - if (v < Min) return EINA_FALSE; \ - GET_PD_OR_RETURN(EINA_FALSE); \ - pd->Class.Value = v; \ - edje_object_calc_force(obj); \ - return EINA_TRUE; \ +#define FUNC_STATE_INT(Class, Value, Min) \ + EAPI int \ + edje_edit_state_##Class##_##Value##_get(Evas_Object * obj, const char *part, const char *state, double value) \ + { \ + GET_PD_OR_RETURN(0); \ + return pd->Class.Value; \ + } \ + EAPI Eina_Bool \ + edje_edit_state_##Class##_##Value##_set(Evas_Object * obj, const char *part, const char *state, double value, int v) \ + { \ + if ((!obj) || (!part) || (!state)) \ + return EINA_FALSE; \ + if (v < Min) return EINA_FALSE; \ + GET_PD_OR_RETURN(EINA_FALSE); \ + pd->Class.Value = v; \ + edje_object_calc_force(obj); \ + return EINA_TRUE; \ } -#define FUNC_STATE_BOOL(Class, Value) \ - EAPI Eina_Bool \ - edje_edit_state_##Class##_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \ - { \ - GET_PD_OR_RETURN(0); \ - return pd->Class.Value; \ - } \ - EAPI Eina_Bool \ - edje_edit_state_##Class##_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool v) \ - { \ - if ((!obj) || (!part) || (!state)) \ - return EINA_FALSE; \ - GET_PD_OR_RETURN(EINA_FALSE); \ - pd->Class.Value = v; \ - edje_object_calc_force(obj); \ - return EINA_TRUE; \ +#define FUNC_STATE_BOOL(Class, Value) \ + EAPI Eina_Bool \ + edje_edit_state_##Class##_##Value##_get(Evas_Object * obj, const char *part, const char *state, double value) \ + { \ + GET_PD_OR_RETURN(0); \ + return pd->Class.Value; \ + } \ + EAPI Eina_Bool \ + edje_edit_state_##Class##_##Value##_set(Evas_Object * obj, const char *part, const char *state, double value, Eina_Bool v) \ + { \ + if ((!obj) || (!part) || (!state)) \ + return EINA_FALSE; \ + GET_PD_OR_RETURN(EINA_FALSE); \ + pd->Class.Value = v; \ + edje_object_calc_force(obj); \ + return EINA_TRUE; \ } FUNC_STATE_DOUBLE(align, x); @@ -5816,17 +5850,18 @@ edje_edit_state_fill_smooth_get(Evas_Object *obj, const char *part, const char * switch (rp->part->type) { case EDJE_PART_TYPE_IMAGE: - { - Edje_Part_Description_Image *img; - img = (Edje_Part_Description_Image*) pd; - return img->image.fill.smooth; - } + { + Edje_Part_Description_Image *img; + img = (Edje_Part_Description_Image *)pd; + return img->image.fill.smooth; + } + case EDJE_PART_TYPE_PROXY: - { - Edje_Part_Description_Proxy *pro; - pro = (Edje_Part_Description_Proxy*) pd; - return pro->proxy.fill.smooth; - } + { + Edje_Part_Description_Proxy *pro; + pro = (Edje_Part_Description_Proxy *)pd; + return pro->proxy.fill.smooth; + } } return EINA_FALSE; @@ -5840,19 +5875,20 @@ edje_edit_state_fill_smooth_set(Evas_Object *obj, const char *part, const char * switch (rp->part->type) { case EDJE_PART_TYPE_IMAGE: - { - Edje_Part_Description_Image *img; - img = (Edje_Part_Description_Image*) pd; - img->image.fill.smooth = smooth; - return EINA_TRUE; - } + { + Edje_Part_Description_Image *img; + img = (Edje_Part_Description_Image *)pd; + img->image.fill.smooth = smooth; + return EINA_TRUE; + } + case EDJE_PART_TYPE_PROXY: - { - Edje_Part_Description_Proxy *pro; - pro = (Edje_Part_Description_Proxy*) pd; - pro->proxy.fill.smooth = smooth; - return EINA_TRUE; - } + { + Edje_Part_Description_Proxy *pro; + pro = (Edje_Part_Description_Proxy *)pd; + pro->proxy.fill.smooth = smooth; + return EINA_TRUE; + } } return EINA_FALSE; @@ -5868,19 +5904,20 @@ edje_edit_state_fill_type_set(Evas_Object *obj, const char *part, const char *st switch (rp->part->type) { case EDJE_PART_TYPE_IMAGE: - { - Edje_Part_Description_Image *img; - img = (Edje_Part_Description_Image*) pd; - img->image.fill.type = fill_type; - return EINA_TRUE; - } + { + Edje_Part_Description_Image *img; + img = (Edje_Part_Description_Image *)pd; + img->image.fill.type = fill_type; + return EINA_TRUE; + } + case EDJE_PART_TYPE_PROXY: - { - Edje_Part_Description_Proxy *pro; - pro = (Edje_Part_Description_Proxy*) pd; - pro->proxy.fill.type = fill_type; - return EINA_TRUE; - } + { + Edje_Part_Description_Proxy *pro; + pro = (Edje_Part_Description_Proxy *)pd; + pro->proxy.fill.type = fill_type; + return EINA_TRUE; + } } return EINA_FALSE; @@ -5894,143 +5931,144 @@ edje_edit_state_fill_type_get(Evas_Object *obj, const char *part, const char *st switch (rp->part->type) { case EDJE_PART_TYPE_IMAGE: - { - Edje_Part_Description_Image *img; - img = (Edje_Part_Description_Image*) pd; - return img->image.fill.type; - } + { + Edje_Part_Description_Image *img; + img = (Edje_Part_Description_Image *)pd; + return img->image.fill.type; + } + case EDJE_PART_TYPE_PROXY: - { - Edje_Part_Description_Proxy *pro; - pro = (Edje_Part_Description_Proxy*) pd; - return pro->proxy.fill.type; - } + { + Edje_Part_Description_Proxy *pro; + pro = (Edje_Part_Description_Proxy *)pd; + return pro->proxy.fill.type; + } } return EDJE_FILL_TYPE_LAST; } -#define FUNC_STATE_DOUBLE_FILL(Class, Type, Value) \ - EAPI double \ - edje_edit_state_fill_##Type##_relative_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \ - { \ - GET_PD_OR_RETURN(0); \ - \ - switch (rp->part->type) \ - { \ - case EDJE_PART_TYPE_IMAGE: \ - { \ - Edje_Part_Description_Image *img; \ - \ - img = (Edje_Part_Description_Image*) pd; \ - \ - return TO_DOUBLE(img->image.fill.Class##rel_##Value); \ - } \ - case EDJE_PART_TYPE_PROXY: \ - { \ - Edje_Part_Description_Proxy *pro; \ - \ - pro = (Edje_Part_Description_Proxy*) pd; \ - \ - return TO_DOUBLE(pro->proxy.fill.Class##rel_##Value); \ - } \ - } \ - \ - return 0; \ - } \ - EAPI Eina_Bool \ - edje_edit_state_fill_##Type##_relative_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \ - { \ - GET_PD_OR_RETURN(EINA_FALSE); \ - \ - switch (rp->part->type) \ - { \ - case EDJE_PART_TYPE_IMAGE: \ - { \ - Edje_Part_Description_Image *img; \ - \ - img = (Edje_Part_Description_Image*) pd; \ - \ - img->image.fill.Class##rel_##Value = FROM_DOUBLE(v); \ - \ - break; \ - } \ - case EDJE_PART_TYPE_PROXY: \ - { \ - Edje_Part_Description_Proxy *pro; \ - \ - pro = (Edje_Part_Description_Proxy*) pd; \ - \ - pro->proxy.fill.Class##rel_##Value = FROM_DOUBLE(v); \ - \ - break; \ - } \ - default: \ - return EINA_FALSE; \ - } \ - \ - edje_object_calc_force(obj); \ - return EINA_TRUE; \ +#define FUNC_STATE_DOUBLE_FILL(Class, Type, Value) \ + EAPI double \ + edje_edit_state_fill_##Type##_relative_##Value##_get(Evas_Object * obj, const char *part, const char *state, double value) \ + { \ + GET_PD_OR_RETURN(0); \ + \ + switch (rp->part->type) \ + { \ + case EDJE_PART_TYPE_IMAGE: \ + { \ + Edje_Part_Description_Image *img; \ + \ + img = (Edje_Part_Description_Image *)pd; \ + \ + return TO_DOUBLE(img->image.fill.Class##rel_##Value); \ + } \ + case EDJE_PART_TYPE_PROXY: \ + { \ + Edje_Part_Description_Proxy *pro; \ + \ + pro = (Edje_Part_Description_Proxy *)pd; \ + \ + return TO_DOUBLE(pro->proxy.fill.Class##rel_##Value); \ + } \ + } \ + \ + return 0; \ + } \ + EAPI Eina_Bool \ + edje_edit_state_fill_##Type##_relative_##Value##_set(Evas_Object * obj, const char *part, const char *state, double value, double v) \ + { \ + GET_PD_OR_RETURN(EINA_FALSE); \ + \ + switch (rp->part->type) \ + { \ + case EDJE_PART_TYPE_IMAGE: \ + { \ + Edje_Part_Description_Image *img; \ + \ + img = (Edje_Part_Description_Image *)pd; \ + \ + img->image.fill.Class##rel_##Value = FROM_DOUBLE(v); \ + \ + break; \ + } \ + case EDJE_PART_TYPE_PROXY: \ + { \ + Edje_Part_Description_Proxy *pro; \ + \ + pro = (Edje_Part_Description_Proxy *)pd; \ + \ + pro->proxy.fill.Class##rel_##Value = FROM_DOUBLE(v); \ + \ + break; \ + } \ + default: \ + return EINA_FALSE; \ + } \ + \ + edje_object_calc_force(obj); \ + return EINA_TRUE; \ } -#define FUNC_STATE_INT_FILL(Class, Type, Value) \ - EAPI int \ - edje_edit_state_fill_##Type##_offset_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \ - { \ - GET_PD_OR_RETURN(0); \ - \ - switch (rp->part->type) \ - { \ - case EDJE_PART_TYPE_IMAGE: \ - { \ - Edje_Part_Description_Image *img; \ - \ - img = (Edje_Part_Description_Image*) pd; \ - \ - return img->image.fill.Class##abs_##Value; \ - } \ - case EDJE_PART_TYPE_PROXY: \ - { \ - Edje_Part_Description_Proxy *pro; \ - \ - pro = (Edje_Part_Description_Proxy*) pd; \ - \ - return pro->proxy.fill.Class##abs_##Value; \ - } \ - } \ - return 0; \ - } \ - EAPI Eina_Bool \ - edje_edit_state_fill_##Type##_offset_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \ - { \ - GET_PD_OR_RETURN(EINA_FALSE); \ - \ - switch (rp->part->type) \ - { \ - case EDJE_PART_TYPE_IMAGE: \ - { \ - Edje_Part_Description_Image *img; \ - \ - img = (Edje_Part_Description_Image*) pd; \ - \ - img->image.fill.Class##abs_##Value = FROM_DOUBLE(v); \ - break; \ - } \ - case EDJE_PART_TYPE_PROXY: \ - { \ - Edje_Part_Description_Proxy *pro; \ - \ - pro = (Edje_Part_Description_Proxy*) pd; \ - \ - pro->proxy.fill.Class##abs_##Value = FROM_DOUBLE(v); \ - break; \ - } \ - default: \ - return EINA_FALSE; \ - } \ - \ - edje_object_calc_force(obj); \ - return EINA_TRUE; \ +#define FUNC_STATE_INT_FILL(Class, Type, Value) \ + EAPI int \ + edje_edit_state_fill_##Type##_offset_##Value##_get(Evas_Object * obj, const char *part, const char *state, double value) \ + { \ + GET_PD_OR_RETURN(0); \ + \ + switch (rp->part->type) \ + { \ + case EDJE_PART_TYPE_IMAGE: \ + { \ + Edje_Part_Description_Image *img; \ + \ + img = (Edje_Part_Description_Image *)pd; \ + \ + return img->image.fill.Class##abs_##Value; \ + } \ + case EDJE_PART_TYPE_PROXY: \ + { \ + Edje_Part_Description_Proxy *pro; \ + \ + pro = (Edje_Part_Description_Proxy *)pd; \ + \ + return pro->proxy.fill.Class##abs_##Value; \ + } \ + } \ + return 0; \ + } \ + EAPI Eina_Bool \ + edje_edit_state_fill_##Type##_offset_##Value##_set(Evas_Object * obj, const char *part, const char *state, double value, double v) \ + { \ + GET_PD_OR_RETURN(EINA_FALSE); \ + \ + switch (rp->part->type) \ + { \ + case EDJE_PART_TYPE_IMAGE: \ + { \ + Edje_Part_Description_Image *img; \ + \ + img = (Edje_Part_Description_Image *)pd; \ + \ + img->image.fill.Class##abs_##Value = FROM_DOUBLE(v); \ + break; \ + } \ + case EDJE_PART_TYPE_PROXY: \ + { \ + Edje_Part_Description_Proxy *pro; \ + \ + pro = (Edje_Part_Description_Proxy *)pd; \ + \ + pro->proxy.fill.Class##abs_##Value = FROM_DOUBLE(v); \ + break; \ + } \ + default: \ + return EINA_FALSE; \ + } \ + \ + edje_object_calc_force(obj); \ + return EINA_TRUE; \ } FUNC_STATE_DOUBLE_FILL(pos_, origin, x); @@ -6060,7 +6098,7 @@ edje_edit_state_visible_set(Evas_Object *obj, const char *part, const char *stat GET_PD_OR_RETURN(EINA_FALSE); if (visible) pd->visible = 1; - else pd->visible = 0; + else pd->visible = 0; edje_object_calc_force(obj); return EINA_TRUE; @@ -6085,7 +6123,7 @@ edje_edit_state_aspect_pref_set(Evas_Object *obj, const char *part, const char * return EINA_TRUE; } -EAPI const char* +EAPI const char * edje_edit_state_color_class_get(Evas_Object *obj, const char *part, const char *state, double value) { GET_PD_OR_RETURN(NULL); @@ -6102,10 +6140,10 @@ edje_edit_state_color_class_set(Evas_Object *obj, const char *part, const char * if ((!obj) || (!part) || (!state)) return EINA_FALSE; GET_PD_OR_RETURN(EINA_FALSE); - if (!color_class) + if (!color_class) { - pd->color_class = NULL; - return EINA_FALSE; + pd->color_class = NULL; + return EINA_FALSE; } if (!ed->file->color_classes) return EINA_FALSE; @@ -6113,25 +6151,25 @@ edje_edit_state_color_class_set(Evas_Object *obj, const char *part, const char * { if (strcmp(cc->name, color_class) == 0) { - pd->color.r = cc->r; - pd->color.g = cc->g; - pd->color.b = cc->b; - pd->color.a = cc->a; - pd->color2.r = cc->r2; - pd->color2.g = cc->g2; - pd->color2.b = cc->b2; - pd->color2.a = cc->a2; - if ((rp->type == EDJE_PART_TYPE_TEXT) || (rp->type == EDJE_PART_TYPE_TEXTBLOCK)) - { - Edje_Part_Description_Text *txt = (Edje_Part_Description_Text *)pd; - txt->text.color3.r = cc->r3; - txt->text.color3.g = cc->g3; - txt->text.color3.b = cc->b3; - txt->text.color3.a = cc->a3; - } - pd->color_class = (char *)eina_stringshare_add(color_class); - edje_object_calc_force(obj); - return EINA_TRUE; + pd->color.r = cc->r; + pd->color.g = cc->g; + pd->color.b = cc->b; + pd->color.a = cc->a; + pd->color2.r = cc->r2; + pd->color2.g = cc->g2; + pd->color2.b = cc->b2; + pd->color2.a = cc->a2; + if ((rp->type == EDJE_PART_TYPE_TEXT) || (rp->type == EDJE_PART_TYPE_TEXTBLOCK)) + { + Edje_Part_Description_Text *txt = (Edje_Part_Description_Text *)pd; + txt->text.color3.r = cc->r3; + txt->text.color3.g = cc->g3; + txt->text.color3.b = cc->b3; + txt->text.color3.a = cc->a3; + } + pd->color_class = (char *)eina_stringshare_add(color_class); + edje_object_calc_force(obj); + return EINA_TRUE; } } pd->color_class = NULL; @@ -6148,7 +6186,7 @@ edje_edit_state_external_params_list_get(Evas_Object *obj, const char *part, con if (rp->part->type != EDJE_PART_TYPE_EXTERNAL) return NULL; - external = (Edje_Part_Description_External *) pd; + external = (Edje_Part_Description_External *)pd; return external->external_params; } @@ -6168,31 +6206,34 @@ edje_edit_state_external_param_get(Evas_Object *obj, const char *part, const cha if (!param) return EINA_FALSE; - external = (Edje_Part_Description_External *) pd; + external = (Edje_Part_Description_External *)pd; EINA_LIST_FOREACH(external->external_params, l, p) - if (!strcmp(p->name, param)) - { - if (type) *type = p->type; - if (val) - switch (p->type) - { - case EDJE_EXTERNAL_PARAM_TYPE_INT: - case EDJE_EXTERNAL_PARAM_TYPE_BOOL: - *val = &p->i; - break; - case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: - *val = &p->d; - break; - case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: - case EDJE_EXTERNAL_PARAM_TYPE_STRING: - *val = (void *)p->s; - break; - default: - ERR("unknown external parameter type '%d'", p->type); - } - return EINA_TRUE; - } + if (!strcmp(p->name, param)) + { + if (type) *type = p->type; + if (val) + switch (p->type) + { + case EDJE_EXTERNAL_PARAM_TYPE_INT: + case EDJE_EXTERNAL_PARAM_TYPE_BOOL: + *val = &p->i; + break; + + case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: + *val = &p->d; + break; + + case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: + case EDJE_EXTERNAL_PARAM_TYPE_STRING: + *val = (void *)p->s; + break; + + default: + ERR("unknown external parameter type '%d'", p->type); + } + return EINA_TRUE; + } return EINA_FALSE; } @@ -6215,17 +6256,17 @@ edje_edit_state_external_param_int_get(Evas_Object *obj, const char *part, const if (!param) return EINA_FALSE; - external = (Edje_Part_Description_External *) pd; + external = (Edje_Part_Description_External *)pd; EINA_LIST_FOREACH(external->external_params, l, p) - if (!strcmp(p->name, param)) - { - if (p->type != EDJE_EXTERNAL_PARAM_TYPE_INT) - return EINA_FALSE; - if (val) - *val = p->i; - return EINA_TRUE; - } + if (!strcmp(p->name, param)) + { + if (p->type != EDJE_EXTERNAL_PARAM_TYPE_INT) + return EINA_FALSE; + if (val) + *val = p->i; + return EINA_TRUE; + } return EINA_FALSE; } @@ -6248,17 +6289,17 @@ edje_edit_state_external_param_bool_get(Evas_Object *obj, const char *part, cons if (!param) return EINA_FALSE; - external = (Edje_Part_Description_External *) pd; + external = (Edje_Part_Description_External *)pd; EINA_LIST_FOREACH(external->external_params, l, p) - if (!strcmp(p->name, param)) - { - if (p->type != EDJE_EXTERNAL_PARAM_TYPE_BOOL) - return EINA_FALSE; - if (val) - *val = p->i; - return EINA_TRUE; - } + if (!strcmp(p->name, param)) + { + if (p->type != EDJE_EXTERNAL_PARAM_TYPE_BOOL) + return EINA_FALSE; + if (val) + *val = p->i; + return EINA_TRUE; + } return EINA_FALSE; } @@ -6281,17 +6322,17 @@ edje_edit_state_external_param_double_get(Evas_Object *obj, const char *part, co if (!param) return EINA_FALSE; - external = (Edje_Part_Description_External *) pd; + external = (Edje_Part_Description_External *)pd; EINA_LIST_FOREACH(external->external_params, l, p) - if (!strcmp(p->name, param)) - { - if (p->type != EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) - return EINA_FALSE; - if (val) - *val = p->d; - return EINA_TRUE; - } + if (!strcmp(p->name, param)) + { + if (p->type != EDJE_EXTERNAL_PARAM_TYPE_DOUBLE) + return EINA_FALSE; + if (val) + *val = p->d; + return EINA_TRUE; + } return EINA_FALSE; } @@ -6314,17 +6355,17 @@ edje_edit_state_external_param_string_get(Evas_Object *obj, const char *part, co if (!param) return EINA_FALSE; - external = (Edje_Part_Description_External *) pd; + external = (Edje_Part_Description_External *)pd; EINA_LIST_FOREACH(external->external_params, l, p) - if (!strcmp(p->name, param)) - { - if (p->type != EDJE_EXTERNAL_PARAM_TYPE_STRING) - return EINA_FALSE; - if (val) - *val = p->s; - return EINA_TRUE; - } + if (!strcmp(p->name, param)) + { + if (p->type != EDJE_EXTERNAL_PARAM_TYPE_STRING) + return EINA_FALSE; + if (val) + *val = p->s; + return EINA_TRUE; + } return EINA_FALSE; } @@ -6347,17 +6388,17 @@ edje_edit_state_external_param_choice_get(Evas_Object *obj, const char *part, co if (!param) return EINA_FALSE; - external = (Edje_Part_Description_External *) pd; + external = (Edje_Part_Description_External *)pd; EINA_LIST_FOREACH(external->external_params, l, p) - if (!strcmp(p->name, param)) - { - if (p->type != EDJE_EXTERNAL_PARAM_TYPE_CHOICE) - return EINA_FALSE; - if (val) - *val = p->s; - return EINA_TRUE; - } + if (!strcmp(p->name, param)) + { + if (p->type != EDJE_EXTERNAL_PARAM_TYPE_CHOICE) + return EINA_FALSE; + if (val) + *val = p->s; + return EINA_TRUE; + } return EINA_FALSE; } @@ -6379,27 +6420,27 @@ edje_edit_state_external_param_set(Evas_Object *obj, const char *part, const cha if (!param) return EINA_FALSE; - external = (Edje_Part_Description_External *) pd; + external = (Edje_Part_Description_External *)pd; va_start(ap, type); EINA_LIST_FOREACH(external->external_params, l, p) - if (!strcmp(p->name, param)) - { - found = 1; - old_p = *p; - break; - } + if (!strcmp(p->name, param)) + { + found = 1; + old_p = *p; + break; + } if (!found) { - p = _alloc(sizeof(Edje_External_Param)); - if (!p) - { - va_end(ap); - return EINA_FALSE; - } - p->name = eina_stringshare_add(param); + p = _alloc(sizeof(Edje_External_Param)); + if (!p) + { + va_end(ap); + return EINA_FALSE; + } + p->name = eina_stringshare_add(param); } p->type = type; @@ -6411,21 +6452,24 @@ edje_edit_state_external_param_set(Evas_Object *obj, const char *part, const cha { case EDJE_EXTERNAL_PARAM_TYPE_INT: case EDJE_EXTERNAL_PARAM_TYPE_BOOL: - p->i = (int)va_arg(ap, int); - break; + p->i = (int)va_arg(ap, int); + break; + case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: - p->d = (double)va_arg(ap, double); - break; + p->d = (double)va_arg(ap, double); + break; + case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: case EDJE_EXTERNAL_PARAM_TYPE_STRING: - p->s = eina_stringshare_add((const char *)va_arg(ap, char *)); - break; + p->s = eina_stringshare_add((const char *)va_arg(ap, char *)); + break; + default: - ERR("unknown external parameter type '%d'", type); - va_end(ap); - if (!found) free(p); - else *p = old_p; - return EINA_FALSE; + ERR("unknown external parameter type '%d'", type); + va_end(ap); + if (!found) free(p); + else *p = old_p; + return EINA_FALSE; } va_end(ap); @@ -6433,36 +6477,36 @@ edje_edit_state_external_param_set(Evas_Object *obj, const char *part, const cha //FIXME: //For now, we're just setting the value if the state is the selected state. //This is a conceptual error and is incoherent with the rest of the API! - { - const char *sname; - double svalue; - sname = edje_edit_part_selected_state_get(obj, part, &svalue); - if (!strcmp(state, sname) && svalue == value) - if (!edje_object_part_external_param_set(obj, part, p)) - if ((type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) || - (type == EDJE_EXTERNAL_PARAM_TYPE_STRING)) - { - _edje_if_string_free(ed, &p->s); - if (!found) free(p); - else *p = old_p; - eina_stringshare_del(sname); - return EINA_FALSE; - } - eina_stringshare_del(sname); - } + { + const char *sname; + double svalue; + sname = edje_edit_part_selected_state_get(obj, part, &svalue); + if (!strcmp(state, sname) && svalue == value) + if (!edje_object_part_external_param_set(obj, part, p)) + if ((type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) || + (type == EDJE_EXTERNAL_PARAM_TYPE_STRING)) + { + _edje_if_string_free(ed, &p->s); + if (!found) free(p); + else *p = old_p; + eina_stringshare_del(sname); + return EINA_FALSE; + } + eina_stringshare_del(sname); + } - if (!found) - { - external->external_params = eina_list_append(external->external_params, p); - } + if (!found) + { + external->external_params = eina_list_append(external->external_params, p); + } if (rp->typedata.swallow && rp->param1.external_params) _edje_external_parsed_params_free(rp->typedata.swallow->swallowed_object, rp->param1.external_params); if (rp->typedata.swallow && external->external_params) - rp->param1.external_params = \ - _edje_external_params_parse(rp->typedata.swallow->swallowed_object, - external->external_params); + rp->param1.external_params = \ + _edje_external_params_parse(rp->typedata.swallow->swallowed_object, + external->external_params); return EINA_TRUE; } @@ -6793,8 +6837,8 @@ edje_edit_state_map_point_color_set(Evas_Object *obj, const char *part, const ch pd->map.colors_count++; pd->map.colors = - realloc(pd->map.colors, - sizeof(Edje_Map_Color*) * pd->map.colors_count); + realloc(pd->map.colors, + sizeof(Edje_Map_Color *) * pd->map.colors_count); pd->map.colors[pd->map.colors_count - 1] = color; } @@ -6845,7 +6889,7 @@ edje_edit_state_map_on_get(Evas_Object *obj, const char *part, const char *state { GET_PD_OR_RETURN(EINA_FALSE); - return pd->map.on; + return pd->map.on; } EAPI Eina_Bool @@ -6874,7 +6918,7 @@ edje_edit_state_text_get(Evas_Object *obj, const char *part, const char *state, (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return NULL; - txt = (Edje_Part_Description_Text *) pd; + txt = (Edje_Part_Description_Text *)pd; return eina_stringshare_add(edje_string_get(&txt->text.text)); } @@ -6894,7 +6938,7 @@ edje_edit_state_text_set(Evas_Object *obj, const char *part, const char *state, (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return EINA_FALSE; - txt = (Edje_Part_Description_Text *) pd; + txt = (Edje_Part_Description_Text *)pd; _edje_if_string_replace(ed, &txt->text.text.str, text); txt->text.text.id = 0; @@ -6927,7 +6971,7 @@ edje_edit_state_text_size_get(Evas_Object *obj, const char *part, const char *st (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return -1; - txt = (Edje_Part_Description_Text *) pd; + txt = (Edje_Part_Description_Text *)pd; return txt->text.size; } @@ -6944,7 +6988,7 @@ edje_edit_state_text_size_set(Evas_Object *obj, const char *part, const char *st (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return EINA_FALSE; - txt = (Edje_Part_Description_Text *) pd; + txt = (Edje_Part_Description_Text *)pd; txt->text.size = size; @@ -6952,77 +6996,77 @@ edje_edit_state_text_size_set(Evas_Object *obj, const char *part, const char *st return EINA_TRUE; } -#define FUNC_TEXT_DOUBLE(Name, Value, Min) \ - EAPI double \ - edje_edit_state_text_##Name##_get(Evas_Object *obj, const char *part, const char *state, double value) \ - { \ - Edje_Part_Description_Text *txt; \ - \ - GET_PD_OR_RETURN(0); \ - \ - if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \ - (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \ - return 0; \ - \ - txt = (Edje_Part_Description_Text *) pd; \ - return TO_DOUBLE(txt->text.Value); \ - } \ - EAPI Eina_Bool \ - edje_edit_state_text_##Name##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \ - { \ - Edje_Part_Description_Text *txt; \ - if ((!obj) || (!part) || (!state)) \ - return EINA_FALSE; \ - if ((v < Min) || (v > 1.0)) \ - return EINA_FALSE; \ - \ - GET_PD_OR_RETURN(EINA_FALSE); \ - \ - if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \ - (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \ - return EINA_FALSE; \ - \ - txt = (Edje_Part_Description_Text *) pd; \ - txt->text.Value = FROM_DOUBLE(v); \ - edje_object_calc_force(obj); \ - return EINA_TRUE; \ +#define FUNC_TEXT_DOUBLE(Name, Value, Min) \ + EAPI double \ + edje_edit_state_text_##Name##_get(Evas_Object * obj, const char *part, const char *state, double value) \ + { \ + Edje_Part_Description_Text *txt; \ + \ + GET_PD_OR_RETURN(0); \ + \ + if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \ + (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \ + return 0; \ + \ + txt = (Edje_Part_Description_Text *)pd; \ + return TO_DOUBLE(txt->text.Value); \ + } \ + EAPI Eina_Bool \ + edje_edit_state_text_##Name##_set(Evas_Object * obj, const char *part, const char *state, double value, double v) \ + { \ + Edje_Part_Description_Text *txt; \ + if ((!obj) || (!part) || (!state)) \ + return EINA_FALSE; \ + if ((v < Min) || (v > 1.0)) \ + return EINA_FALSE; \ + \ + GET_PD_OR_RETURN(EINA_FALSE); \ + \ + if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \ + (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \ + return EINA_FALSE; \ + \ + txt = (Edje_Part_Description_Text *)pd; \ + txt->text.Value = FROM_DOUBLE(v); \ + edje_object_calc_force(obj); \ + return EINA_TRUE; \ } FUNC_TEXT_DOUBLE(align_x, align.x, -1.0); FUNC_TEXT_DOUBLE(align_y, align.y, 0.0); FUNC_TEXT_DOUBLE(elipsis, ellipsis, -1.0); -#define FUNC_TEXT_BOOL(Name, Type) \ - EAPI Eina_Bool \ - edje_edit_state_text_##Name##_##Type##_get(Evas_Object *obj, const char *part, const char *state, double value) \ - { \ - Edje_Part_Description_Text *txt; \ - \ - GET_PD_OR_RETURN(EINA_FALSE); \ - \ - if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \ - (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \ - return EINA_FALSE; \ - \ - txt = (Edje_Part_Description_Text *) pd; \ - return txt->text.Name##_##Type; \ - } \ - EAPI Eina_Bool \ - edje_edit_state_text_##Name##_##Type##_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool v) \ - { \ - Edje_Part_Description_Text *txt; \ - if ((!obj) || (!part) || (!state)) \ - return EINA_FALSE; \ - GET_PD_OR_RETURN(EINA_FALSE); \ - \ - if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \ - (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \ - return EINA_FALSE; \ - \ - txt = (Edje_Part_Description_Text *) pd; \ - txt->text.Name##_##Type = v ? 1 : 0; \ - edje_object_calc_force(obj); \ - return EINA_TRUE; \ +#define FUNC_TEXT_BOOL(Name, Type) \ + EAPI Eina_Bool \ + edje_edit_state_text_##Name##_##Type##_get(Evas_Object * obj, const char *part, const char *state, double value) \ + { \ + Edje_Part_Description_Text *txt; \ + \ + GET_PD_OR_RETURN(EINA_FALSE); \ + \ + if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \ + (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \ + return EINA_FALSE; \ + \ + txt = (Edje_Part_Description_Text *)pd; \ + return txt->text.Name##_##Type; \ + } \ + EAPI Eina_Bool \ + edje_edit_state_text_##Name##_##Type##_set(Evas_Object * obj, const char *part, const char *state, double value, Eina_Bool v) \ + { \ + Edje_Part_Description_Text *txt; \ + if ((!obj) || (!part) || (!state)) \ + return EINA_FALSE; \ + GET_PD_OR_RETURN(EINA_FALSE); \ + \ + if ((rp->part->type != EDJE_PART_TYPE_TEXT) && \ + (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) \ + return EINA_FALSE; \ + \ + txt = (Edje_Part_Description_Text *)pd; \ + txt->text.Name##_##Type = v ? 1 : 0; \ + edje_object_calc_force(obj); \ + return EINA_TRUE; \ } FUNC_TEXT_BOOL(fit, x); @@ -7089,7 +7133,7 @@ edje_edit_fonts_list_get(Evas_Object *obj) } EAPI Eina_Bool -edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias) +edje_edit_font_add(Evas_Object *obj, const char *path, const char *alias) { char entry[PATH_MAX]; char *new_path; @@ -7108,13 +7152,13 @@ edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias) /* Alias */ if (alias) { - if ((new_path = strrchr(path, '/'))) new_path ++; - else new_path = (char *)path; + if ((new_path = strrchr(path, '/'))) new_path++; + else new_path = (char *)path; } else { - if ((alias = strrchr(path, '/'))) alias ++; - else alias = (char *)path; + if ((alias = strrchr(path, '/'))) alias++; + else alias = (char *)path; new_path = (char *)alias; } snprintf(entry, sizeof(entry), "edje/fonts/%s", alias); @@ -7135,8 +7179,8 @@ edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias) fnt = _alloc(sizeof(Edje_Font_Directory_Entry)); if (!fnt) { - ERR("Unable to alloc font entry part \"%s\"", alias); - return EINA_FALSE; + ERR("Unable to alloc font entry part \"%s\"", alias); + return EINA_FALSE; } fnt->file = eina_stringshare_add(new_path); fnt->entry = eina_stringshare_add(alias); @@ -7146,17 +7190,17 @@ edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias) /* Import font */ if (!_edje_edit_file_import(ed, path, entry, 1)) { - eina_hash_del(ed->file->fonts, fnt->entry, fnt); + eina_hash_del(ed->file->fonts, fnt->entry, fnt); eina_stringshare_del(fnt->file); eina_stringshare_del(fnt->entry); - return EINA_FALSE; + return EINA_FALSE; } return EINA_TRUE; } EAPI Eina_Bool -edje_edit_font_del(Evas_Object *obj, const char* alias) +edje_edit_font_del(Evas_Object *obj, const char *alias) { Edje_Font_Directory_Entry *fnt; @@ -7171,8 +7215,8 @@ edje_edit_font_del(Evas_Object *obj, const char* alias) fnt = eina_hash_find(ed->file->fonts, alias); if (!fnt) { - WRN("Unable to find font entry part \"%s\"", alias); - return EINA_FALSE; + WRN("Unable to find font entry part \"%s\"", alias); + return EINA_FALSE; } /* Erase font to edje file */ @@ -7183,10 +7227,10 @@ edje_edit_font_del(Evas_Object *obj, const char* alias) /* open the eet file */ eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE); if (!eetf) - { - ERR("Unable to open \"%s\" for writing output", ed->path); - return EINA_FALSE; - } + { + ERR("Unable to open \"%s\" for writing output", ed->path); + return EINA_FALSE; + } snprintf(entry, sizeof(entry), "edje/fonts/%s", alias); @@ -7199,10 +7243,10 @@ edje_edit_font_del(Evas_Object *obj, const char* alias) /* write the edje_file */ if (!_edje_edit_edje_file_save(eetf, ed->file)) - { - eet_close(eetf); - return EINA_FALSE; - } + { + eet_close(eetf); + return EINA_FALSE; + } eet_close(eetf); } @@ -7248,7 +7292,7 @@ edje_edit_state_font_get(Evas_Object *obj, const char *part, const char *state, (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return NULL; - txt = (Edje_Part_Description_Text*) pd; + txt = (Edje_Part_Description_Text *)pd; return eina_stringshare_add(edje_string_get(&txt->text.font)); } @@ -7264,7 +7308,7 @@ edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return EINA_FALSE; - txt = (Edje_Part_Description_Text*) pd; + txt = (Edje_Part_Description_Text *)pd; _edje_if_string_replace(ed, &txt->text.font.str, font); txt->text.font.id = 0; @@ -7308,7 +7352,7 @@ edje_edit_state_text_text_source_get(Evas_Object *obj, const char *part, const c (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)) { Edje_Part_Description_Text *txt; - txt = (Edje_Part_Description_Text *) pd; + txt = (Edje_Part_Description_Text *)pd; if (txt->text.id_text_source == -1) return NULL; rel = ed->table_parts[txt->text.id_text_source % ed->table_parts_size]; if (rel->part->name) return eina_stringshare_add(rel->part->name); @@ -7335,8 +7379,8 @@ edje_edit_state_text_text_source_set(Evas_Object *obj, const char *part, const c { spd = _edje_part_description_find_byname(eed, source, state, value); if (!spd) return EINA_FALSE; - txt = (Edje_Part_Description_Text *) pd; - source_txt = (Edje_Part_Description_Text *) spd; + txt = (Edje_Part_Description_Text *)pd; + source_txt = (Edje_Part_Description_Text *)spd; id_text_source = _edje_part_id_find(ed, source); txt->text.id_text_source = id_text_source; @@ -7347,7 +7391,7 @@ edje_edit_state_text_text_source_set(Evas_Object *obj, const char *part, const c } else { - txt = (Edje_Part_Description_Text *) pd; + txt = (Edje_Part_Description_Text *)pd; txt->text.id_text_source = -1; txt->text.text.str = eina_stringshare_add(NULL); } @@ -7366,8 +7410,8 @@ edje_edit_state_text_source_get(Evas_Object *obj, const char *part, const char * if ((rp->part->type == EDJE_PART_TYPE_TEXT) || (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)) { - Edje_Part_Description_Text *txt; - txt = (Edje_Part_Description_Text *) pd; + Edje_Part_Description_Text *txt; + txt = (Edje_Part_Description_Text *)pd; if (txt->text.id_source == -1) return NULL; rel = ed->table_parts[txt->text.id_source % ed->table_parts_size]; if (rel->part->name) return eina_stringshare_add(rel->part->name); @@ -7393,14 +7437,14 @@ edje_edit_state_text_source_set(Evas_Object *obj, const char *part, const char * { spd = _edje_part_description_find_byname(eed, source, state, value); if (!spd) return EINA_FALSE; - txt = (Edje_Part_Description_Text *) pd; + txt = (Edje_Part_Description_Text *)pd; id_source = _edje_part_id_find(ed, source); txt->text.id_source = id_source; } else { - txt = (Edje_Part_Description_Text *) pd; + txt = (Edje_Part_Description_Text *)pd; txt->text.id_source = -1; txt->text.text.str = eina_stringshare_add(NULL); } @@ -7409,7 +7453,7 @@ edje_edit_state_text_source_set(Evas_Object *obj, const char *part, const char * return EINA_TRUE; } -EAPI const char* +EAPI const char * edje_edit_state_text_class_get(Evas_Object *obj, const char *part, const char *state, double value) { Edje_Part_Description_Text *txt; @@ -7418,7 +7462,7 @@ edje_edit_state_text_class_get(Evas_Object *obj, const char *part, const char *s if ((rp->part->type != EDJE_PART_TYPE_TEXT) && (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return NULL; - txt = (Edje_Part_Description_Text *) pd; + txt = (Edje_Part_Description_Text *)pd; return eina_stringshare_add(txt->text.text_class); } @@ -7433,9 +7477,9 @@ edje_edit_state_text_class_set(Evas_Object *obj, const char *part, const char *s if ((rp->part->type != EDJE_PART_TYPE_TEXT) && (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return EINA_FALSE; - txt = (Edje_Part_Description_Text *) pd; + txt = (Edje_Part_Description_Text *)pd; - txt->text.text_class = (char *) eina_stringshare_add(text_class); + txt->text.text_class = (char *)eina_stringshare_add(text_class); return EINA_TRUE; } @@ -7449,7 +7493,7 @@ edje_edit_state_text_repch_get(Evas_Object *obj, const char *part, const char *s (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return NULL; - txt = (Edje_Part_Description_Text*) pd; + txt = (Edje_Part_Description_Text *)pd; return eina_stringshare_add(edje_string_get(&txt->text.repch)); } @@ -7465,7 +7509,7 @@ edje_edit_state_text_repch_set(Evas_Object *obj, const char *part, const char *s (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return EINA_FALSE; - txt = (Edje_Part_Description_Text*) pd; + txt = (Edje_Part_Description_Text *)pd; _edje_if_string_replace(ed, &txt->text.repch.str, repch); txt->text.repch.id = 0; @@ -7482,7 +7526,7 @@ edje_edit_state_text_size_range_min_max_get(Evas_Object *obj, const char *part, (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return EINA_FALSE; - txt = (Edje_Part_Description_Text *) pd; + txt = (Edje_Part_Description_Text *)pd; if (min) *min = txt->text.size_range_min; if (max) *max = txt->text.size_range_max; @@ -7498,7 +7542,7 @@ edje_edit_state_text_size_range_min_max_set(Evas_Object *obj, const char *part, (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return EINA_FALSE; - txt = (Edje_Part_Description_Text *) pd; + txt = (Edje_Part_Description_Text *)pd; txt->text.size_range_min = min; txt->text.size_range_max = max; @@ -7513,7 +7557,7 @@ edje_edit_state_proxy_source_set(Evas_Object *obj, const char *part, const char if (rp->part->type != EDJE_PART_TYPE_PROXY) return EINA_FALSE; - Edje_Part_Description_Proxy *proxy_part = (Edje_Part_Description_Proxy*) pd; + Edje_Part_Description_Proxy *proxy_part = (Edje_Part_Description_Proxy *)pd; if (source_name) { @@ -7534,8 +7578,8 @@ edje_edit_state_proxy_source_get(Evas_Object *obj, const char *part, const char if (rp->part->type != EDJE_PART_TYPE_PROXY) return NULL; - Edje_Part_Description_Proxy *proxy_part = (Edje_Part_Description_Proxy*) pd; - const char * source_name; + Edje_Part_Description_Proxy *proxy_part = (Edje_Part_Description_Proxy *)pd; + const char *source_name; source_name = _edje_part_name_find(ed, proxy_part->proxy.id); return eina_stringshare_add(source_name); @@ -7559,13 +7603,13 @@ edje_edit_images_list_get(Evas_Object *obj) //printf("GET IMAGES LIST for %s\n", ed->file->path); for (i = 0; i < ed->file->image_dir->entries_count; ++i) images = eina_list_append(images, - eina_stringshare_add(ed->file->image_dir->entries[i].entry)); + eina_stringshare_add(ed->file->image_dir->entries[i].entry)); return images; } EAPI Eina_Bool -edje_edit_image_add(Evas_Object *obj, const char* path) +edje_edit_image_add(Evas_Object *obj, const char *path) { Edje_Image_Directory_Entry *de; unsigned int i; @@ -7581,8 +7625,8 @@ edje_edit_image_add(Evas_Object *obj, const char* path) /* Create Image_Directory if not exist */ if (!ed->file->image_dir) { - ed->file->image_dir = _alloc(sizeof(Edje_Image_Directory)); - if (!ed->file->image_dir) return EINA_FALSE; + ed->file->image_dir = _alloc(sizeof(Edje_Image_Directory)); + if (!ed->file->image_dir) return EINA_FALSE; } /* Image name */ @@ -7592,28 +7636,28 @@ edje_edit_image_add(Evas_Object *obj, const char* path) /* Loop trough image directory to find if image exist */ for (i = 0; i < ed->file->image_dir->entries_count; ++i) { - de = ed->file->image_dir->entries + i; + de = ed->file->image_dir->entries + i; - if (!de->entry) - free_id = i; - else if (!strcmp(name, de->entry)) - return EINA_FALSE; + if (!de->entry) + free_id = i; + else if (!strcmp(name, de->entry)) + return EINA_FALSE; } if (free_id == -1) { - Edje_Image_Directory_Entry *tmp; - unsigned int count; + Edje_Image_Directory_Entry *tmp; + unsigned int count; - count = ed->file->image_dir->entries_count + 1; + count = ed->file->image_dir->entries_count + 1; - tmp = realloc(ed->file->image_dir->entries, - sizeof (Edje_Image_Directory_Entry) * count); - if (!tmp) return EINA_FALSE; + tmp = realloc(ed->file->image_dir->entries, + sizeof (Edje_Image_Directory_Entry) * count); + if (!tmp) return EINA_FALSE; - ed->file->image_dir->entries = tmp; - free_id = ed->file->image_dir->entries_count; - ed->file->image_dir->entries_count = count; + ed->file->image_dir->entries = tmp; + free_id = ed->file->image_dir->entries_count; + ed->file->image_dir->entries_count = count; } /* Set Image Entry */ @@ -7626,9 +7670,9 @@ edje_edit_image_add(Evas_Object *obj, const char* path) /* Import image */ if (!_edje_import_image_file(ed, path, free_id)) { - eina_stringshare_del(de->entry); - de->entry = NULL; - return EINA_FALSE; + eina_stringshare_del(de->entry); + de->entry = NULL; + return EINA_FALSE; } return EINA_TRUE; @@ -7649,35 +7693,35 @@ edje_edit_image_replace(Evas_Object *obj, const char *name, const char *new_name image_id = edje_edit_image_id_get(obj, name); new_image_id = edje_edit_image_id_get(obj, new_name); if ((image_id < 0) || (new_image_id < 0)) - return EINA_FALSE; + return EINA_FALSE; it = eina_hash_iterator_data_new(ed->file->collection); EINA_ITERATOR_FOREACH(it, pce) - { - for (i = 0; i < pce->ref->parts_count; i++) - { - part = pce->ref->parts[i]; - if (part->type == EDJE_PART_TYPE_IMAGE) - { - part_desc_image = (Edje_Part_Description_Image *)part->default_desc; - if (part_desc_image->image.id == image_id) + { + for (i = 0; i < pce->ref->parts_count; i++) + { + part = pce->ref->parts[i]; + if (part->type == EDJE_PART_TYPE_IMAGE) + { + part_desc_image = (Edje_Part_Description_Image *)part->default_desc; + if (part_desc_image->image.id == image_id) part_desc_image->image.id = new_image_id; - for (k = 0; k < part_desc_image->image.tweens_count; k++) + for (k = 0; k < part_desc_image->image.tweens_count; k++) if (part_desc_image->image.tweens[k]->id == image_id) - part_desc_image->image.id = new_image_id; - for (j = 0; j < part->other.desc_count; j++) + part_desc_image->image.id = new_image_id; + for (j = 0; j < part->other.desc_count; j++) { part_desc_image = (Edje_Part_Description_Image *)part->other.desc[j]; if (part_desc_image->image.id == image_id) - part_desc_image->image.id = new_image_id; + part_desc_image->image.id = new_image_id; for (k = 0; k < part_desc_image->image.tweens_count; k++) - if (part_desc_image->image.tweens[k]->id == image_id) - part_desc_image->image.id = new_image_id; + if (part_desc_image->image.tweens[k]->id == image_id) + part_desc_image->image.id = new_image_id; } - } - } - } + } + } + } eina_iterator_free(it); return EINA_TRUE; @@ -7691,8 +7735,8 @@ edje_edit_image_rename(Evas_Object *obj, const char *name, const char *new_name) GET_ED_OR_RETURN(EINA_FALSE); // Check if image with 'new_name' already exists - if (edje_edit_image_id_get(obj, new_name) >= 0) - return EINA_FALSE; + if (edje_edit_image_id_get(obj, new_name) >= 0) + return EINA_FALSE; for (i = 0; i < ed->file->image_dir->entries_count; ++i) { @@ -7707,7 +7751,7 @@ edje_edit_image_rename(Evas_Object *obj, const char *name, const char *new_name) return EINA_TRUE; } -EAPI Eina_List* +EAPI Eina_List * edje_edit_image_usage_list_get(Evas_Object *obj, const char *name, Eina_Bool first_only) { Eina_List *result = NULL; @@ -7723,7 +7767,7 @@ edje_edit_image_usage_list_get(Evas_Object *obj, const char *name, Eina_Bool fir image_id = edje_edit_image_id_get(obj, name); if (image_id < 0) - return NULL; + return NULL; if (edje_edit_image_compression_type_get(obj, name) == EDJE_EDIT_IMAGE_COMP_USER) @@ -7731,54 +7775,54 @@ edje_edit_image_usage_list_get(Evas_Object *obj, const char *name, Eina_Bool fir it = eina_hash_iterator_data_new(ed->file->collection); - #define ITEM_ADD() \ - item = (Edje_Part_Image_Use *) calloc(1, sizeof(Edje_Part_Image_Use)); \ - item->group = eina_stringshare_add(pce->entry); \ - item->part = eina_stringshare_add(part->name); \ - item->state.name = eina_stringshare_add(part_desc_image->common.state.name); \ - item->state.value = part_desc_image->common.state.value; \ - result = eina_list_append(result, item); + #define ITEM_ADD() \ + item = (Edje_Part_Image_Use *)calloc(1, sizeof(Edje_Part_Image_Use)); \ + item->group = eina_stringshare_add(pce->entry); \ + item->part = eina_stringshare_add(part->name); \ + item->state.name = eina_stringshare_add(part_desc_image->common.state.name); \ + item->state.value = part_desc_image->common.state.value; \ + result = eina_list_append(result, item); - #define FIND_IN_PART_DESCRIPTION() \ - if (part_desc_image->image.id == image_id) \ - { \ - ITEM_ADD(); \ - if (first_only) \ - goto end; \ - else \ - continue; \ - } \ - for (k = 0; k < part_desc_image->image.tweens_count; k++) \ - { \ - if (part_desc_image->image.tweens[k]->id == image_id) \ - { \ - ITEM_ADD(); \ - if (first_only) \ - goto end; \ - else \ - continue; \ - } \ - } + #define FIND_IN_PART_DESCRIPTION() \ + if (part_desc_image->image.id == image_id) \ + { \ + ITEM_ADD(); \ + if (first_only) \ + goto end; \ + else \ + continue; \ + } \ + for (k = 0; k < part_desc_image->image.tweens_count; k++) \ + { \ + if (part_desc_image->image.tweens[k]->id == image_id) \ + { \ + ITEM_ADD(); \ + if (first_only) \ + goto end; \ + else \ + continue; \ + } \ + } EINA_ITERATOR_FOREACH(it, pce) - { - if (!pce->ref) continue; - for (i = 0; i < pce->ref->parts_count; i++) - { - if (!pce->ref->parts) continue; - part = pce->ref->parts[i]; - if (part->type == EDJE_PART_TYPE_IMAGE) - { - part_desc_image = (Edje_Part_Description_Image *)part->default_desc; - FIND_IN_PART_DESCRIPTION(); - for (j = 0; j < part->other.desc_count; j++) + { + if (!pce->ref) continue; + for (i = 0; i < pce->ref->parts_count; i++) + { + if (!pce->ref->parts) continue; + part = pce->ref->parts[i]; + if (part->type == EDJE_PART_TYPE_IMAGE) + { + part_desc_image = (Edje_Part_Description_Image *)part->default_desc; + FIND_IN_PART_DESCRIPTION(); + for (j = 0; j < part->other.desc_count; j++) { part_desc_image = (Edje_Part_Description_Image *)part->other.desc[j]; FIND_IN_PART_DESCRIPTION(); } - } - } - } + } + } + } #undef ITEM_ADD #undef FIND_IN_PART_DESCRIPTION end: @@ -7792,16 +7836,16 @@ edje_edit_image_usage_list_free(Eina_List *list) { Edje_Part_Image_Use *item; EINA_LIST_FREE(list, item) - { - eina_stringshare_del(item->group); - eina_stringshare_del(item->part); - eina_stringshare_del(item->state.name); - free(item); - } + { + eina_stringshare_del(item->group); + eina_stringshare_del(item->part); + eina_stringshare_del(item->state.name); + free(item); + } } EAPI Eina_Bool -edje_edit_image_del(Evas_Object *obj, const char* name) +edje_edit_image_del(Evas_Object *obj, const char *name) { Edje_Image_Directory_Entry *de, *de_last; unsigned int i, j, k; @@ -7827,17 +7871,17 @@ edje_edit_image_del(Evas_Object *obj, const char* name) /* Create Image_Directory if not exist */ if (!ed->file->image_dir) - goto invalid_image; + goto invalid_image; for (i = 0; i < ed->file->image_dir->entries_count; ++i) { de = ed->file->image_dir->entries + i; if ((de->entry) && (!strcmp(name, de->entry))) - break; + break; } if (i == ed->file->image_dir->entries_count) - goto invalid_image; + goto invalid_image; de_last = ed->file->image_dir->entries + ed->file->image_dir->entries_count - 1; @@ -7883,32 +7927,32 @@ edje_edit_image_del(Evas_Object *obj, const char* name) de->entry = de_last->entry; it = eina_hash_iterator_data_new(ed->file->collection); EINA_ITERATOR_FOREACH(it, pce) - { - if (!pce->ref) continue; - for (i = 0; i < pce->ref->parts_count; i++) - { - if (!pce->ref->parts) continue; - part = pce->ref->parts[i]; - if (part->type == EDJE_PART_TYPE_IMAGE) - { - part_desc_image = (Edje_Part_Description_Image *)part->default_desc; - if (part_desc_image->image.id == de_last->id) + { + if (!pce->ref) continue; + for (i = 0; i < pce->ref->parts_count; i++) + { + if (!pce->ref->parts) continue; + part = pce->ref->parts[i]; + if (part->type == EDJE_PART_TYPE_IMAGE) + { + part_desc_image = (Edje_Part_Description_Image *)part->default_desc; + if (part_desc_image->image.id == de_last->id) part_desc_image->image.id = de->id; - for (k = 0; k < part_desc_image->image.tweens_count; k++) + for (k = 0; k < part_desc_image->image.tweens_count; k++) if (part_desc_image->image.id == de_last->id) - part_desc_image->image.id = de->id; + part_desc_image->image.id = de->id; - for (j = 0; j < part->other.desc_count; j++) + for (j = 0; j < part->other.desc_count; j++) { part_desc_image = (Edje_Part_Description_Image *)part->other.desc[j]; if (part_desc_image->image.id == de_last->id) - part_desc_image->image.id = de->id; + part_desc_image->image.id = de->id; for (k = 0; k < part_desc_image->image.tweens_count; k++) - if (part_desc_image->image.id == de_last->id) - part_desc_image->image.id = de->id; + if (part_desc_image->image.id == de_last->id) + part_desc_image->image.id = de->id; } - } - } + } + } } eina_iterator_free(it); } @@ -7947,13 +7991,13 @@ edje_edit_image_data_add(Evas_Object *obj, const char *name, int id) /* Create Image_Directory if not exist */ if (!ed->file->image_dir) { - ed->file->image_dir = _alloc(sizeof(Edje_Image_Directory)); - if (!ed->file->image_dir) return EINA_FALSE; + ed->file->image_dir = _alloc(sizeof(Edje_Image_Directory)); + if (!ed->file->image_dir) return EINA_FALSE; } /* Loop trough image directory to find if image exist */ - if (id < 0) id = - id - 1; - if ((unsigned int) id >= ed->file->image_dir->entries_count) return EINA_FALSE; + if (id < 0) id = -id - 1; + if ((unsigned int)id >= ed->file->image_dir->entries_count) return EINA_FALSE; de = ed->file->image_dir->entries + id; _edje_if_string_replace(ed, &de->entry, name); @@ -7984,28 +8028,32 @@ edje_edit_image_compression_type_get(Evas_Object *obj, const char *image) for (i = 0; i < ed->file->image_dir->entries_count; ++i) { - de = ed->file->image_dir->entries + i; + de = ed->file->image_dir->entries + i; - if (de->entry - && !strcmp(image, de->entry)) - break; + if (de->entry + && !strcmp(image, de->entry)) + break; } if (i == ed->file->image_dir->entries_count) return -1; - switch(de->source_type) + switch (de->source_type) { case EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT: if (de->source_param == 0) // RAW return EDJE_EDIT_IMAGE_COMP_RAW; else // COMP return EDJE_EDIT_IMAGE_COMP_COMP; + case EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY: // LOSSY return EDJE_EDIT_IMAGE_COMP_LOSSY; + case EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC1: // LOSSY_ETC1 return EDJE_EDIT_IMAGE_COMP_LOSSY_ETC1; + case EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC2: // LOSSY_ETC2 return EDJE_EDIT_IMAGE_COMP_LOSSY_ETC2; + case EDJE_IMAGE_SOURCE_TYPE_EXTERNAL: // USER return EDJE_EDIT_IMAGE_COMP_USER; } @@ -8033,7 +8081,7 @@ edje_edit_image_compression_type_set(Evas_Object *obj, const char *image, Edje_E if (i == ed->file->image_dir->entries_count) return EINA_FALSE; - switch(ic) + switch (ic) { case EDJE_EDIT_IMAGE_COMP_RAW: // RAW if (de->source_param == 0) @@ -8043,6 +8091,7 @@ edje_edit_image_compression_type_set(Evas_Object *obj, const char *image, Edje_E } else return EINA_FALSE; + case EDJE_EDIT_IMAGE_COMP_COMP: // COMP if (de->source_param == 1) { @@ -8051,26 +8100,30 @@ edje_edit_image_compression_type_set(Evas_Object *obj, const char *image, Edje_E } else return EINA_FALSE; + case EDJE_EDIT_IMAGE_COMP_LOSSY: // LOSSY - { - de->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY; - return EINA_TRUE; - } + { + de->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY; + return EINA_TRUE; + } + case EDJE_EDIT_IMAGE_COMP_LOSSY_ETC1: // LOSSY_ETC1 - { - de->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC1; - return EINA_TRUE; - } + { + de->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC1; + return EINA_TRUE; + } + case EDJE_EDIT_IMAGE_COMP_LOSSY_ETC2: // LOSSY_ETC2 - { - de->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC2; - return EINA_TRUE; - } + { + de->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC2; + return EINA_TRUE; + } + case EDJE_EDIT_IMAGE_COMP_USER: // USER - { - de->source_type = EDJE_IMAGE_SOURCE_TYPE_EXTERNAL; - return EINA_TRUE; - } + { + de->source_type = EDJE_IMAGE_SOURCE_TYPE_EXTERNAL; + return EINA_TRUE; + } } return EINA_FALSE; } @@ -8086,10 +8139,10 @@ edje_edit_image_compression_rate_get(Evas_Object *obj, const char *image) // Gets the Image Entry for (i = 0; i < ed->file->image_dir->entries_count; ++i) { - de = ed->file->image_dir->entries + i; - if (de->entry - && !strcmp(de->entry, image)) - break; + de = ed->file->image_dir->entries + i; + if (de->entry + && !strcmp(de->entry, image)) + break; } if (i == ed->file->image_dir->entries_count) return -1; @@ -8112,7 +8165,7 @@ edje_edit_state_image_get(Evas_Object *obj, const char *part, const char *state, if (rp->part->type != EDJE_PART_TYPE_IMAGE) return NULL; - img = (Edje_Part_Description_Image *) pd; + img = (Edje_Part_Description_Image *)pd; image = _edje_image_name_find(eed, img->image.id); if (!image) return NULL; @@ -8138,7 +8191,7 @@ edje_edit_state_image_set(Evas_Object *obj, const char *part, const char *state, id = _edje_image_id_find(eed, image); - img = (Edje_Part_Description_Image *) pd; + img = (Edje_Part_Description_Image *)pd; if (id > -1) img->image.id = id; else return EINA_FALSE; @@ -8160,13 +8213,13 @@ edje_edit_state_tweens_list_get(Evas_Object *obj, const char *part, const char * if (rp->part->type != EDJE_PART_TYPE_IMAGE) return NULL; - img = (Edje_Part_Description_Image *) pd; + img = (Edje_Part_Description_Image *)pd; for (i = 0; i < img->image.tweens_count; ++i) { - name = _edje_image_name_find(eed, img->image.tweens[i]->id); - //printf(" t: %s\n", name); - tweens = eina_list_append(tweens, eina_stringshare_add(name)); + name = _edje_image_name_find(eed, img->image.tweens[i]->id); + //printf(" t: %s\n", name); + tweens = eina_list_append(tweens, eina_stringshare_add(name)); } return tweens; @@ -8193,15 +8246,15 @@ edje_edit_state_tween_add(Evas_Object *obj, const char *part, const char *state, if (!i) return EINA_FALSE; i->id = id; - img = (Edje_Part_Description_Image *) pd; + img = (Edje_Part_Description_Image *)pd; /* add to tween list */ tmp = realloc(img->image.tweens, sizeof(Edje_Part_Image_Id *) * (img->image.tweens_count + 1)); if (!tmp) { - free(i); - return EINA_FALSE; + free(i); + return EINA_FALSE; } tmp[img->image.tweens_count++] = i; @@ -8222,7 +8275,7 @@ edje_edit_state_tween_del(Evas_Object *obj, const char *part, const char *state, if (rp->part->type != EDJE_PART_TYPE_IMAGE) return EINA_FALSE; - img = (Edje_Part_Description_Image *) pd; + img = (Edje_Part_Description_Image *)pd; if (!img->image.tweens_count) return EINA_FALSE; @@ -8231,15 +8284,15 @@ edje_edit_state_tween_del(Evas_Object *obj, const char *part, const char *state, for (i = 0; i < img->image.tweens_count; ++i) { - if (img->image.tweens[i]->id == search) - { - img->image.tweens_count--; - free(img->image.tweens[i]); - memmove(img->image.tweens + i, - img->image.tweens + i + 1, - sizeof (Edje_Part_Description_Image*) * (img->image.tweens_count - i)); - return EINA_TRUE; - } + if (img->image.tweens[i]->id == search) + { + img->image.tweens_count--; + free(img->image.tweens[i]); + memmove(img->image.tweens + i, + img->image.tweens + i + 1, + sizeof (Edje_Part_Description_Image *) * (img->image.tweens_count - i)); + return EINA_TRUE; + } } return EINA_FALSE; } @@ -8260,7 +8313,7 @@ edje_edit_state_image_border_get(Evas_Object *obj, const char *part, const char return; } - img = (Edje_Part_Description_Image *) pd; + img = (Edje_Part_Description_Image *)pd; //printf("GET IMAGE_BORDER of state '%s'\n", state); @@ -8286,7 +8339,7 @@ edje_edit_state_image_border_set(Evas_Object *obj, const char *part, const char if (rp->part->type != EDJE_PART_TYPE_IMAGE) return EINA_FALSE; - img = (Edje_Part_Description_Image *) pd; + img = (Edje_Part_Description_Image *)pd; img->image.border.l = l; img->image.border.r = r; @@ -8307,7 +8360,7 @@ edje_edit_state_image_border_fill_get(Evas_Object *obj, const char *part, const if (rp->part->type != EDJE_PART_TYPE_IMAGE) return 0; - img = (Edje_Part_Description_Image *) pd; + img = (Edje_Part_Description_Image *)pd; if (img->image.border.no_fill == 2) return 2; else return !img->image.border.no_fill; @@ -8331,7 +8384,7 @@ edje_edit_state_image_border_fill_set(Evas_Object *obj, const char *part, const if (rp->part->type != EDJE_PART_TYPE_IMAGE) return EINA_FALSE; - img = (Edje_Part_Description_Image *) pd; + img = (Edje_Part_Description_Image *)pd; if (fill == 2) img->image.border.no_fill = 2; else img->image.border.no_fill = !fill; @@ -8340,7 +8393,6 @@ edje_edit_state_image_border_fill_set(Evas_Object *obj, const char *part, const return EINA_TRUE; } - /******************/ /* PROGRAMS API */ /******************/ @@ -8371,9 +8423,9 @@ _edje_program_get_byname(Evas_Object *obj, const char *prog_name) for (i = 0; i < ed->collection->patterns.table_programs_size; i++) { - epr = ed->collection->patterns.table_programs[i]; - if ((epr->name) && (strcmp(epr->name, prog_name) == 0)) - return epr; + epr = ed->collection->patterns.table_programs[i]; + if ((epr->name) && (strcmp(epr->name, prog_name) == 0)) + return epr; } return NULL; } @@ -8390,13 +8442,13 @@ edje_edit_programs_list_get(Evas_Object *obj) for (i = 0; i < ed->collection->patterns.table_programs_size; i++) { - Edje_Program *epr; + Edje_Program *epr; - epr = ed->collection->patterns.table_programs[i]; + epr = ed->collection->patterns.table_programs[i]; /* XXX: bad, we miss programs this way, but since you can't access * them in any way without a name, better ignore them. */ if (!epr->name) continue; - progs = eina_list_append(progs, eina_stringshare_add(epr->name)); + progs = eina_list_append(progs, eina_stringshare_add(epr->name)); } return progs; @@ -8424,7 +8476,7 @@ edje_edit_program_add(Evas_Object *obj, const char *name) /* By default, source and signal are empty, so they fill in nocmp category */ ed->collection->programs.nocmp = realloc(ed->collection->programs.nocmp, - sizeof (Edje_Program*) * (ed->collection->programs.nocmp_count + 1)); + sizeof (Edje_Program *) * (ed->collection->programs.nocmp_count + 1)); ed->collection->programs.nocmp[ed->collection->programs.nocmp_count++] = epr; //Init Edje_Program @@ -8454,7 +8506,7 @@ edje_edit_program_add(Evas_Object *obj, const char *name) //Update table_programs ed->collection->patterns.table_programs_size++; ed->collection->patterns.table_programs = realloc(ed->collection->patterns.table_programs, - sizeof(Edje_Program *) * ed->collection->patterns.table_programs_size); + sizeof(Edje_Program *) * ed->collection->patterns.table_programs_size); ed->collection->patterns.table_programs[epr->id % ed->collection->patterns.table_programs_size] = epr; //Update patterns @@ -8488,11 +8540,11 @@ edje_edit_program_del(Evas_Object *obj, const char *prog) /* fix table program */ if (epr->id != ed->collection->patterns.table_programs_size - 1) { - /* If the removed program is not the last in the list/table, - * put the last one in its place and update references to it later */ - ed->collection->patterns.table_programs[epr->id] = ed->collection->patterns.table_programs[ed->collection->patterns.table_programs_size - 1]; - old_id = ed->collection->patterns.table_programs_size - 1; - ed->collection->patterns.table_programs[epr->id]->id = epr->id; + /* If the removed program is not the last in the list/table, + * put the last one in its place and update references to it later */ + ed->collection->patterns.table_programs[epr->id] = ed->collection->patterns.table_programs[ed->collection->patterns.table_programs_size - 1]; + old_id = ed->collection->patterns.table_programs_size - 1; + ed->collection->patterns.table_programs[epr->id]->id = epr->id; } ps = eina_hash_find(eed->program_scripts, &id); @@ -8545,40 +8597,40 @@ edje_edit_program_del(Evas_Object *obj, const char *prog) ed->collection->patterns.table_programs_size--; ed->collection->patterns.table_programs = realloc(ed->collection->patterns.table_programs, - sizeof(Edje_Program *) * ed->collection->patterns.table_programs_size); + sizeof(Edje_Program *) * ed->collection->patterns.table_programs_size); //We also update all other programs that point to old_id and id for (i = 0; i < ed->collection->patterns.table_programs_size; i++) { - p = ed->collection->patterns.table_programs[i]; + p = ed->collection->patterns.table_programs[i]; - /* check in afters */ - EINA_LIST_FOREACH_SAFE(p->after, l, l_next, pa) - { - if (pa->id == old_id) - pa->id = id; - else if (pa->id == id) + /* check in afters */ + EINA_LIST_FOREACH_SAFE(p->after, l, l_next, pa) + { + if (pa->id == old_id) + pa->id = id; + else if (pa->id == id) { p->after = eina_list_remove_list(p->after, l); free(pa); } - } - /* check in targets */ - if (p->action == EDJE_ACTION_TYPE_ACTION_STOP) - { - Edje_Program_Target *pt; + } + /* check in targets */ + if (p->action == EDJE_ACTION_TYPE_ACTION_STOP) + { + Edje_Program_Target *pt; - EINA_LIST_FOREACH_SAFE(p->targets, l, l_next, pt) - { - if (pt->id == old_id) - pt->id = id; - else if (pt->id == id) + EINA_LIST_FOREACH_SAFE(p->targets, l, l_next, pt) + { + if (pt->id == old_id) + pt->id = id; + else if (pt->id == id) { p->targets = eina_list_remove_list(p->targets, l); free(pt); } - } - } + } + } } _edje_edit_flag_script_dirty(eed, EINA_TRUE); @@ -8657,7 +8709,7 @@ edje_edit_program_transition_state_set(Evas_Object *obj, const char *prog, doubl } EAPI Eina_Bool -edje_edit_program_name_set(Evas_Object *obj, const char *prog, const char* new_name) +edje_edit_program_name_set(Evas_Object *obj, const char *prog, const char *new_name) { GET_EED_OR_RETURN(EINA_FALSE); GET_ED_OR_RETURN(EINA_FALSE); @@ -9029,25 +9081,25 @@ edje_edit_program_transition_set(Evas_Object *obj, const char *prog, Edje_Tween_ return EINA_TRUE; } -#define FUNC_PROGRAM_TRANSITION_VALUE(Num) \ - EAPI double \ - edje_edit_program_transition_value##Num##_get(Evas_Object *obj, const char *prog) \ - { \ - eina_error_set(0); \ - \ - GET_EPR_OR_RETURN(-1); \ - \ - return TO_DOUBLE(epr->tween.v##Num); \ - } \ - EAPI Eina_Bool \ - edje_edit_program_transition_value##Num##_set(Evas_Object *obj, const char *prog, double value) \ - { \ - eina_error_set(0); \ - \ - GET_EPR_OR_RETURN(EINA_FALSE); \ - \ - epr->tween.v##Num = FROM_DOUBLE(value); \ - return EINA_TRUE; \ +#define FUNC_PROGRAM_TRANSITION_VALUE(Num) \ + EAPI double \ + edje_edit_program_transition_value##Num##_get(Evas_Object * obj, const char *prog) \ + { \ + eina_error_set(0); \ + \ + GET_EPR_OR_RETURN(-1); \ + \ + return TO_DOUBLE(epr->tween.v##Num); \ + } \ + EAPI Eina_Bool \ + edje_edit_program_transition_value##Num##_set(Evas_Object * obj, const char *prog, double value) \ + { \ + eina_error_set(0); \ + \ + GET_EPR_OR_RETURN(EINA_FALSE); \ + \ + epr->tween.v##Num = FROM_DOUBLE(value); \ + return EINA_TRUE; \ } FUNC_PROGRAM_TRANSITION_VALUE(1) @@ -9143,17 +9195,17 @@ edje_edit_program_action_set(Evas_Object *obj, const char *prog, Edje_Action_Typ case EDJE_ACTION_TYPE_PHYSICS_STOP: case EDJE_ACTION_TYPE_PHYSICS_ROT_SET: #endif - /*This actions have part as a target so targets list can be leaved untouched + /*This actions have part as a target so targets list can be leaved untouched if it was not list of programs (EDJE_ACTION_TYPE_ACTION_STOP) */ - if (epr->action == EDJE_ACTION_TYPE_ACTION_STOP) - edje_edit_program_targets_clear(obj, prog); - break; + if (epr->action == EDJE_ACTION_TYPE_ACTION_STOP) + edje_edit_program_targets_clear(obj, prog); + break; case EDJE_ACTION_TYPE_ACTION_STOP: - /*this action needs programs as targets*/ + /*this action needs programs as targets*/ default: - /*other actions do not need targets so we need to delete them all */ - edje_edit_program_targets_clear(obj, prog); + /*other actions do not need targets so we need to delete them all */ + edje_edit_program_targets_clear(obj, prog); } epr->action = action; @@ -9171,26 +9223,26 @@ _edje_program_targets_get(Evas_Object *obj, Edje_Program *epr) //printf("GET TARGETS for program: %s [count: %d]\n", prog, eina_list_count(epr->targets)); EINA_LIST_FOREACH(epr->targets, l, t) { - if (epr->action == EDJE_ACTION_TYPE_STATE_SET) - { - /* the target is a part */ - Edje_Real_Part *p = NULL; + if (epr->action == EDJE_ACTION_TYPE_STATE_SET) + { + /* the target is a part */ + Edje_Real_Part *p = NULL; - p = ed->table_parts[t->id % ed->table_parts_size]; - if (p && p->part && p->part->name) - targets = eina_list_append(targets, - eina_stringshare_add(p->part->name)); - } - else if (epr->action == EDJE_ACTION_TYPE_ACTION_STOP) - { - /* the target is a program */ - Edje_Program *p; + p = ed->table_parts[t->id % ed->table_parts_size]; + if (p && p->part && p->part->name) + targets = eina_list_append(targets, + eina_stringshare_add(p->part->name)); + } + else if (epr->action == EDJE_ACTION_TYPE_ACTION_STOP) + { + /* the target is a program */ + Edje_Program *p; - p = ed->collection->patterns.table_programs[t->id % ed->collection->patterns.table_programs_size]; - if (p && p->name) - targets = eina_list_append(targets, - eina_stringshare_add(p->name)); - } + p = ed->collection->patterns.table_programs[t->id % ed->collection->patterns.table_programs_size]; + if (p && p->name) + targets = eina_list_append(targets, + eina_stringshare_add(p->name)); + } } return targets; } @@ -9203,7 +9255,6 @@ edje_edit_program_targets_get(Evas_Object *obj, const char *prog) return _edje_program_targets_get(obj, epr); } - EAPI Eina_Bool edje_edit_program_targets_clear(Evas_Object *obj, const char *prog) { @@ -9211,11 +9262,11 @@ edje_edit_program_targets_clear(Evas_Object *obj, const char *prog) while (epr->targets) { - Edje_Program_Target *prt; + Edje_Program_Target *prt; - prt = eina_list_data_get(epr->targets); - epr->targets = eina_list_remove_list(epr->targets, epr->targets); - free(prt); + prt = eina_list_data_get(epr->targets); + epr->targets = eina_list_remove_list(epr->targets, epr->targets); + free(prt); } return EINA_TRUE; @@ -9246,21 +9297,21 @@ edje_edit_program_target_add(Evas_Object *obj, const char *prog, const char *tar case EDJE_ACTION_TYPE_PHYSICS_STOP: case EDJE_ACTION_TYPE_PHYSICS_ROT_SET: #endif - /* the target is a part */ - rp = _edje_real_part_get(ed, target); - if (!rp) return EINA_FALSE; - id = rp->part->id; - break; + /* the target is a part */ + rp = _edje_real_part_get(ed, target); + if (!rp) return EINA_FALSE; + id = rp->part->id; + break; case EDJE_ACTION_TYPE_ACTION_STOP: - /* the target is a program */ - tar = _edje_program_get_byname(obj, target); - if (!tar) return EINA_FALSE; - id = tar->id; - break; + /* the target is a program */ + tar = _edje_program_get_byname(obj, target); + if (!tar) return EINA_FALSE; + id = tar->id; + break; default: - return EINA_FALSE; + return EINA_FALSE; } t = _alloc(sizeof(Edje_Program_Target)); @@ -9298,24 +9349,25 @@ edje_edit_program_target_del(Evas_Object *obj, const char *prog, const char *tar case EDJE_ACTION_TYPE_PHYSICS_STOP: case EDJE_ACTION_TYPE_PHYSICS_ROT_SET: #endif - /* the target is a part */ - rp = _edje_real_part_get(ed, target); - if (!rp) return EINA_FALSE; - id = rp->part->id; - break; + /* the target is a part */ + rp = _edje_real_part_get(ed, target); + if (!rp) return EINA_FALSE; + id = rp->part->id; + break; case EDJE_ACTION_TYPE_ACTION_STOP: - /* the target is a program */ - tar = _edje_program_get_byname(obj, target); - if (!tar) return EINA_FALSE; - id = tar->id; - break; + /* the target is a program */ + tar = _edje_program_get_byname(obj, target); + if (!tar) return EINA_FALSE; + id = tar->id; + break; + default: - return EINA_FALSE; + return EINA_FALSE; } EINA_LIST_FOREACH(epr->targets, l, t) - if (t->id == id) - break; + if (t->id == id) + break; epr->targets = eina_list_remove_list(epr->targets, l); free(t); @@ -9330,17 +9382,17 @@ _edje_program_afters_get(Evas_Object *obj, Edje_Program *epr) GET_ED_OR_RETURN(NULL); - // printf("GET AFTERS for program: %s [count: %d]\n", prog, eina_list_count(epr->after)); + // printf("GET AFTERS for program: %s [count: %d]\n", prog, eina_list_count(epr->after)); EINA_LIST_FOREACH(epr->after, l, a) { - Edje_Program *p = NULL; + Edje_Program *p = NULL; - p = ed->collection->patterns.table_programs[a->id % ed->collection->patterns.table_programs_size]; - if (p && p->name) - { - //printf(" a: %d name: %s\n", a->id, p->name); - afters = eina_list_append(afters, eina_stringshare_add(p->name)); - } + p = ed->collection->patterns.table_programs[a->id % ed->collection->patterns.table_programs_size]; + if (p && p->name) + { + //printf(" a: %d name: %s\n", a->id, p->name); + afters = eina_list_append(afters, eina_stringshare_add(p->name)); + } } return afters; } @@ -9360,11 +9412,11 @@ edje_edit_program_afters_clear(Evas_Object *obj, const char *prog) while (epr->after) { - Edje_Program_After *pa; + Edje_Program_After *pa; - pa = eina_list_data_get(epr->after); - epr->after = eina_list_remove_list(epr->after, epr->after); - free(pa); + pa = eina_list_data_get(epr->after); + epr->after = eina_list_remove_list(epr->after, epr->after); + free(pa); } return EINA_TRUE; @@ -9404,11 +9456,11 @@ edje_edit_program_after_del(Evas_Object *obj, const char *prog, const char *afte if (!af) return EINA_FALSE; EINA_LIST_FOREACH(epr->after, l, a) - if (a->id == af->id) - { - epr->after = eina_list_remove_list(epr->after, l); - break; - } + if (a->id == af->id) + { + epr->after = eina_list_remove_list(epr->after, l); + break; + } return EINA_TRUE; } @@ -9430,7 +9482,7 @@ edje_edit_program_api_description_get(Evas_Object *obj, const char *prog) } EAPI Eina_Bool -edje_edit_program_api_name_set(Evas_Object *obj, const char *prog, const char* name) +edje_edit_program_api_name_set(Evas_Object *obj, const char *prog, const char *name) { GET_ED_OR_RETURN(EINA_FALSE); GET_EPR_OR_RETURN(EINA_FALSE); @@ -9709,11 +9761,11 @@ _edje_edit_script_process(Edje_Edit *eed, const char *progname, char *code) Edje_Edit_Script_Error *se; se = malloc(sizeof(Edje_Edit_Script_Error)); se->program_name = progname ? - eina_stringshare_add(progname) : NULL; + eina_stringshare_add(progname) : NULL; se->line = line; se->error_str = eina_stringshare_printf( - "Referenced %s '%s' could not be found in object.", - what, name); + "Referenced %s '%s' could not be found in object.", + what, name); eed->errors = eina_list_append(eed->errors, se); success = EINA_FALSE; } @@ -9782,10 +9834,10 @@ _edje_edit_embryo_rebuild(Edje_Edit *eed) free(se); } - pfx = eina_prefix_new(NULL, /* argv[0] value (optional) */ - edje_init, /* an optional symbol to check path of */ - "EDJE", /* env var prefix to use (XXX_PREFIX, XXX_BIN_DIR etc. */ - "edje", /* dir to add after "share" (PREFIX/share/DIRNAME) */ + pfx = eina_prefix_new(NULL, /* argv[0] value (optional) */ + edje_init, /* an optional symbol to check path of */ + "EDJE", /* env var prefix to use (XXX_PREFIX, XXX_BIN_DIR etc. */ + "edje", /* dir to add after "share" (PREFIX/share/DIRNAME) */ "include/edje.inc", /* a magic file to check for in PREFIX/share/DIRNAME for success */ PACKAGE_BIN_DIR, /* package bin dir @ compile time */ PACKAGE_LIB_DIR, /* package lib dir @ compile time */ @@ -9800,18 +9852,18 @@ _edje_edit_embryo_rebuild(Edje_Edit *eed) #if defined(HAVE_GETUID) && defined(HAVE_GETEUID) if (getuid() == geteuid()) #endif - { - if (getenv("EFL_RUN_IN_TREE")) - { - snprintf(embryo_cc_path, sizeof(embryo_cc_path), - "%s/src/bin/embryo/embryo_cc" BIN_EXT, - PACKAGE_BUILD_DIR); - snprintf(inc_path, sizeof(inc_path), - "%s/data/edje/include", PACKAGE_BUILD_DIR); - if (!ecore_file_exists(embryo_cc_path)) - embryo_cc_path[0] = '\0'; - } - } + { + if (getenv("EFL_RUN_IN_TREE")) + { + snprintf(embryo_cc_path, sizeof(embryo_cc_path), + "%s/src/bin/embryo/embryo_cc" BIN_EXT, + PACKAGE_BUILD_DIR); + snprintf(inc_path, sizeof(inc_path), + "%s/data/edje/include", PACKAGE_BUILD_DIR); + if (!ecore_file_exists(embryo_cc_path)) + embryo_cc_path[0] = '\0'; + } + } if (embryo_cc_path[0] == '\0') { @@ -9828,7 +9880,7 @@ _edje_edit_embryo_rebuild(Edje_Edit *eed) fd = eina_file_mkstemp("edje_edit.sma-tmp-XXXXXX", &tmp_in); if (fd < 0) - return EINA_FALSE; /* FIXME: report something */ + return EINA_FALSE; /* FIXME: report something */ f = fdopen(fd, "w"); if (!f) @@ -9908,7 +9960,7 @@ _edje_edit_embryo_rebuild(Edje_Edit *eed) } snprintf(buf, sizeof(buf), "%s -i %s -o %s %s", - embryo_cc_path, inc_path, tmp_out, tmp_in); + embryo_cc_path, inc_path, tmp_out, tmp_in); ret = system(buf); if ((ret < 0) || (ret > 1)) @@ -9946,8 +9998,8 @@ _edje_edit_embryo_rebuild(Edje_Edit *eed) } } else - eed->bytecode = NULL; /* correctness mostly, I don't see why we - would get a 0 sized program */ + eed->bytecode = NULL; /* correctness mostly, I don't see why we + would get a 0 sized program */ eed->bytecode_size = size; eed->bytecode_dirty = EINA_TRUE; @@ -10006,17 +10058,17 @@ edje_edit_script_error_list_get(Evas_Object *obj) #define I7 " " #define BUF_APPEND(STR) \ - ret &= eina_strbuf_append(buf, STR) + ret &= eina_strbuf_append(buf, STR) #define BUF_APPENDF(FMT, ...) \ - ret &= eina_strbuf_append_printf(buf, FMT, ##__VA_ARGS__) + ret &= eina_strbuf_append_printf(buf, FMT, ##__VA_ARGS__) -#define COLLECT_RESOURCE(condition_data, list) \ - if (condition_data) \ - { \ - if (!eina_list_data_find(list, condition_data)) \ - list = eina_list_append(list, condition_data); \ - } +#define COLLECT_RESOURCE(condition_data, list) \ + if (condition_data) \ + { \ + if (!eina_list_data_find(list, condition_data)) \ + list = eina_list_append(list, condition_data); \ + } static const char *types[] = {"NONE", "RECT", "TEXT", "IMAGE", "SWALLOW", "TEXTBLOCK", "GRADIENT", "GROUP", "BOX", "TABLE", "EXTERNAL", "PROXY", "SPACER"}; static const char *effects[] = {"NONE", "PLAIN", "OUTLINE", "SOFT_OUTLINE", "SHADOW", "SOFT_SHADOW", "OUTLINE_SHADOW", "OUTLINE_SOFT_SHADOW", "FAR_SHADOW", "FAR_SOFT_SHADOW", "GLOW"}; @@ -10026,13 +10078,13 @@ static const char *entry_mode[] = {"NONE", "PLAIN", "EDITABLE", "PASSWORD"}; static const char *aspect_mode[] = {"NONE", "NEITHER", "HORIZONTAL", "VERTICAL", "BOTH"}; static Eina_Bool -_edje_generate_source_of_group(Edje *ed, Edje_Part_Collection_Directory_Entry *pce, Eina_Strbuf *buf); + _edje_generate_source_of_group(Edje *ed, Edje_Part_Collection_Directory_Entry *pce, Eina_Strbuf *buf); - static Eina_Bool -_edje_generate_source_of_style(Edje * ed, const char *name, Eina_Strbuf *buf); +static Eina_Bool + _edje_generate_source_of_style(Edje *ed, const char *name, Eina_Strbuf *buf); - static Eina_Bool -_edje_generate_source_of_colorclass(Edje * ed, const char *name, Eina_Strbuf *buf); +static Eina_Bool + _edje_generate_source_of_colorclass(Edje *ed, const char *name, Eina_Strbuf *buf); static Eina_Strbuf * _edje_generate_image_source(Evas_Object *obj, const char *entry) @@ -10072,7 +10124,6 @@ error: return NULL; } - EAPI const char * edje_edit_source_generate(Evas_Object *obj) { @@ -10134,7 +10185,7 @@ edje_edit_source_generate(Evas_Object *obj) if (part_desc_text->text.font.str) { Edje_Font_Directory_Entry *fnt; - fnt = eina_hash_find(ed->file->fonts, part_desc_text->text.font.str); + fnt = eina_hash_find(ed->file->fonts, part_desc_text->text.font.str); COLLECT_RESOURCE(fnt, fonts); } for (j = 0; j < part->other.desc_count; j++) @@ -10144,7 +10195,7 @@ edje_edit_source_generate(Evas_Object *obj) if (part_desc_text->text.font.str) { Edje_Font_Directory_Entry *fnt; - fnt = eina_hash_find(ed->file->fonts, part_desc_text->text.font.str); + fnt = eina_hash_find(ed->file->fonts, part_desc_text->text.font.str); COLLECT_RESOURCE(fnt, fonts); } } @@ -10161,26 +10212,25 @@ edje_edit_source_generate(Evas_Object *obj) for (j = 0; j < (unsigned int)ed->collection->patterns.table_programs_size; j++) - { - Edje_Program *epr; - Edje_Sound_Sample *sample; - epr = ed->collection->patterns.table_programs[j]; - if ((!epr) || (epr->action != EDJE_ACTION_TYPE_SOUND_SAMPLE)) - continue; - for(i = 0; i < (unsigned int)ed->file->sound_dir->samples_count; i++) - { - sample = &ed->file->sound_dir->samples[i]; - if (!strcmp(sample->name, epr->sample_name)) - { - COLLECT_RESOURCE(sample, sounds); - break; - } - } - } + { + Edje_Program *epr; + Edje_Sound_Sample *sample; + epr = ed->collection->patterns.table_programs[j]; + if ((!epr) || (epr->action != EDJE_ACTION_TYPE_SOUND_SAMPLE)) + continue; + for (i = 0; i < (unsigned int)ed->file->sound_dir->samples_count; i++) + { + sample = &ed->file->sound_dir->samples[i]; + if (!strcmp(sample->name, epr->sample_name)) + { + COLLECT_RESOURCE(sample, sounds); + break; + } + } + } buf = eina_strbuf_new(); - /* If data items exist, print them */ if (ed->file->data) { @@ -10192,18 +10242,18 @@ edje_edit_source_generate(Evas_Object *obj) Eina_Iterator *it = eina_hash_iterator_key_new(ed->file->data); EINA_ITERATOR_FOREACH(it, entry) { - es = eina_hash_find(ed->file->data, entry); - str = edje_string_get(es); - data_len = strlen(str); - /* In case when data ends with '\n' character, this item recognize - * as data.file. This data will not generated into the source code - * of group. */ - if (str[data_len - 1] == '\n') continue; - escaped_entry = eina_str_escape(entry); - escaped_string = eina_str_escape(str); - BUF_APPENDF(I1"item: \"%s\" \"%s\";\n", escaped_entry, escaped_string); - free(escaped_entry); - free(escaped_string); + es = eina_hash_find(ed->file->data, entry); + str = edje_string_get(es); + data_len = strlen(str); + /* In case when data ends with '\n' character, this item recognize + * as data.file. This data will not generated into the source code + * of group. */ + if (str[data_len - 1] == '\n') continue; + escaped_entry = eina_str_escape(entry); + escaped_string = eina_str_escape(str); + BUF_APPENDF(I1 "item: \"%s\" \"%s\";\n", escaped_entry, escaped_string); + free(escaped_entry); + free(escaped_string); } eina_iterator_free(it); BUF_APPEND(I0 "}\n\n"); @@ -10212,18 +10262,18 @@ edje_edit_source_generate(Evas_Object *obj) /* if images were found, print them */ if (images) { - BUF_APPEND(I0"images {\n"); + BUF_APPEND(I0 "images {\n"); EINA_LIST_FOREACH(images, l, entry) { Eina_Strbuf *gen_buf = _edje_generate_image_source(obj, entry); if (!gen_buf) continue; - BUF_APPENDF(I1"%s", eina_strbuf_string_get(gen_buf)); + BUF_APPENDF(I1 "%s", eina_strbuf_string_get(gen_buf)); eina_strbuf_free(gen_buf); } - BUF_APPEND(I0"}\n\n"); + BUF_APPEND(I0 "}\n\n"); eina_list_free(images); } /* if styles were found, print them */ @@ -10231,7 +10281,7 @@ edje_edit_source_generate(Evas_Object *obj) { BUF_APPEND(I0 "styles {\n"); EINA_LIST_FOREACH(styles, l, entry) - _edje_generate_source_of_style(ed, entry, buf); + _edje_generate_source_of_style(ed, entry, buf); BUF_APPEND(I0 "}\n\n"); eina_list_free(styles); } @@ -10243,8 +10293,8 @@ edje_edit_source_generate(Evas_Object *obj) EINA_LIST_FOREACH(fonts, l, fnt) { - BUF_APPENDF(I1"font: \"%s\" \"%s\";\n", fnt->file, - fnt->entry); + BUF_APPENDF(I1 "font: \"%s\" \"%s\";\n", fnt->file, + fnt->entry); } BUF_APPEND(I0 "}\n\n"); @@ -10253,58 +10303,62 @@ edje_edit_source_generate(Evas_Object *obj) /* if color_classes were found, print them */ if (color_classes) { - BUF_APPEND(I0 "color_classes {\n"); + BUF_APPEND(I0 "color_classes {\n"); - EINA_LIST_FOREACH(color_classes, l, entry) - _edje_generate_source_of_colorclass(ed, entry, buf); + EINA_LIST_FOREACH(color_classes, l, entry) + _edje_generate_source_of_colorclass(ed, entry, buf); - BUF_APPEND(I0 "}\n\n"); + BUF_APPEND(I0 "}\n\n"); eina_list_free(color_classes); } /* print the main code of group collections */ - BUF_APPEND(I0"collections {\n"); + BUF_APPEND(I0 "collections {\n"); /* if sounds were found, print them */ if (sounds) { Edje_Sound_Sample *uses_sample; - BUF_APPEND(I1"sounds {\n"); + BUF_APPEND(I1 "sounds {\n"); EINA_LIST_FOREACH(sounds, l, uses_sample) { - BUF_APPEND(I2"sample {\n"); - BUF_APPENDF(I3"name: \"%s\" ", uses_sample->name); + BUF_APPEND(I2 "sample {\n"); + BUF_APPENDF(I3 "name: \"%s\" ", uses_sample->name); switch (uses_sample->compression) { case EDJE_SOUND_SOURCE_TYPE_INLINE_RAW: - { - BUF_APPEND("RAW;\n"); - break; - } + { + BUF_APPEND("RAW;\n"); + break; + } + case EDJE_SOUND_SOURCE_TYPE_INLINE_COMP: - { - BUF_APPEND("COMP;\n"); - break; - } + { + BUF_APPEND("COMP;\n"); + break; + } + case EDJE_SOUND_SOURCE_TYPE_INLINE_LOSSY: - { - BUF_APPENDF("LOSSY %f;\n", uses_sample->quality); - break; - } + { + BUF_APPENDF("LOSSY %f;\n", uses_sample->quality); + break; + } + case EDJE_SOUND_SOURCE_TYPE_INLINE_AS_IS: - { - BUF_APPEND("AS_IS;\n"); - break; - } + { + BUF_APPEND("AS_IS;\n"); + break; + } + default: break; } - BUF_APPENDF(I3"source: \"%s\";\n", uses_sample->snd_src); - BUF_APPEND(I2"}\n"); + BUF_APPENDF(I3 "source: \"%s\";\n", uses_sample->snd_src); + BUF_APPEND(I2 "}\n"); } - BUF_APPEND(I1"}\n"); + BUF_APPEND(I1 "}\n"); } _edje_generate_source_of_group(ed, ce, buf); - BUF_APPEND(I0"}"); + BUF_APPEND(I0 "}"); if (!ret) { @@ -10321,8 +10375,8 @@ edje_edit_source_generate(Evas_Object *obj) #undef COLLECT_RESOURCE - static Eina_Bool -_edje_generate_source_of_colorclass(Edje * ed, const char *name, Eina_Strbuf *buf) +static Eina_Bool +_edje_generate_source_of_colorclass(Edje *ed, const char *name, Eina_Strbuf *buf) { Eina_List *l; Edje_Color_Class *cc; @@ -10331,17 +10385,17 @@ _edje_generate_source_of_colorclass(Edje * ed, const char *name, Eina_Strbuf *bu EINA_LIST_FOREACH(ed->file->color_classes, l, cc) if (!strcmp(cc->name, name)) { - BUF_APPENDF(I1 "color_class { name: \"%s\";\n", cc->name); - BUF_APPENDF(I2 "color: %d %d %d %d;\n", cc->r, cc->g, cc->b, cc->a); - BUF_APPENDF(I2 "color2: %d %d %d %d;\n", cc->r2, cc->g2, cc->b2, cc->a2); - BUF_APPENDF(I2 "color3: %d %d %d %d;\n", cc->r3, cc->g3, cc->b3, cc->a3); - BUF_APPEND(I1 "}\n"); + BUF_APPENDF(I1 "color_class { name: \"%s\";\n", cc->name); + BUF_APPENDF(I2 "color: %d %d %d %d;\n", cc->r, cc->g, cc->b, cc->a); + BUF_APPENDF(I2 "color2: %d %d %d %d;\n", cc->r2, cc->g2, cc->b2, cc->a2); + BUF_APPENDF(I2 "color3: %d %d %d %d;\n", cc->r3, cc->g3, cc->b3, cc->a3); + BUF_APPEND(I1 "}\n"); } return ret; } - static Eina_Bool -_edje_generate_source_of_style(Edje * ed, const char *name, Eina_Strbuf *buf) +static Eina_Bool +_edje_generate_source_of_style(Edje *ed, const char *name, Eina_Strbuf *buf) { Eina_List *l, *ll; Edje_Style *s; @@ -10349,54 +10403,54 @@ _edje_generate_source_of_style(Edje * ed, const char *name, Eina_Strbuf *buf) Eina_Bool ret = EINA_TRUE; int len, i; - #define ESCAPE_VAL(VAL) \ - for (i = 0, len = strlen(VAL); i < len; i++) \ - switch(VAL[i]) \ - { \ - case '\n': \ - { \ - BUF_APPENDF("%s", "\\n"); \ - break; \ - } \ - case '\t': \ - { \ - BUF_APPENDF("%s", "\\t"); \ - break; \ - } \ - case '"': \ - { \ - BUF_APPENDF("%s", "\\\""); \ - break; \ - } \ - case '\\': \ - { \ - BUF_APPENDF("%s", "\\\\"); \ - break; \ - } \ - default: BUF_APPENDF("%c", VAL[i]); \ + #define ESCAPE_VAL(VAL) \ + for (i = 0, len = strlen(VAL); i < len; i++) \ + switch (VAL[i]) \ + { \ + case '\n': \ + { \ + BUF_APPENDF("%s", "\\n"); \ + break; \ + } \ + case '\t': \ + { \ + BUF_APPENDF("%s", "\\t"); \ + break; \ + } \ + case '"': \ + { \ + BUF_APPENDF("%s", "\\\""); \ + break; \ + } \ + case '\\': \ + { \ + BUF_APPENDF("%s", "\\\\"); \ + break; \ + } \ + default: BUF_APPENDF("%c", VAL[i]); \ } EINA_LIST_FOREACH(ed->file->styles, l, s) if (!strcmp(s->name, name)) { - t = s->tags ? s->tags->data : NULL; - BUF_APPENDF(I1 "style { name:\"%s\";\n", s->name); - if (t && t->value) - { - BUF_APPEND(I2 "base: \""); - ESCAPE_VAL(t->value); - BUF_APPEND("\";\n"); - } + t = s->tags ? s->tags->data : NULL; + BUF_APPENDF(I1 "style { name:\"%s\";\n", s->name); + if (t && t->value) + { + BUF_APPEND(I2 "base: \""); + ESCAPE_VAL(t->value); + BUF_APPEND("\";\n"); + } - EINA_LIST_FOREACH(s->tags, ll, t) - if (ll->prev && t && t->value) - { - BUF_APPENDF(I2 "tag: \"%s\" \"", t->key); - ESCAPE_VAL(t->value); - BUF_APPEND("\";\n"); - } - BUF_APPEND(I1 "}\n"); - return ret; + EINA_LIST_FOREACH(s->tags, ll, t) + if (ll->prev && t && t->value) + { + BUF_APPENDF(I2 "tag: \"%s\" \"", t->key); + ESCAPE_VAL(t->value); + BUF_APPEND("\";\n"); + } + BUF_APPEND(I1 "}\n"); + return ret; } #undef ESCAPE_VAL return EINA_FALSE; @@ -10407,7 +10461,7 @@ _edje_generate_source_of_program(Evas_Object *obj, const char *program, Eina_Str { Eina_List *l, *ll; const char *s; - double db, db2,v1,v2,v3,v4; + double db, db2, v1, v2, v3, v4; char *data; Eina_Bool ret = EINA_TRUE; Eina_Bool no_transition = EINA_FALSE; @@ -10419,127 +10473,142 @@ _edje_generate_source_of_program(Evas_Object *obj, const char *program, Eina_Str epr = _edje_program_get_byname(obj, program); - BUF_APPENDF(I3"program { name: \"%s\";\n", program); + BUF_APPENDF(I3 "program { name: \"%s\";\n", program); /* Signal */ if ((s = eina_stringshare_add(epr->signal))) { - BUF_APPENDF(I4"signal: \"%s\";\n", s); - edje_edit_string_free(s); + BUF_APPENDF(I4 "signal: \"%s\";\n", s); + edje_edit_string_free(s); } /* Source */ if ((s = eina_stringshare_add(epr->source))) { - BUF_APPENDF(I4"source: \"%s\";\n", s); - edje_edit_string_free(s); + BUF_APPENDF(I4 "source: \"%s\";\n", s); + edje_edit_string_free(s); } /* Filter */ if (epr->filter.part && epr->filter.state) { - BUF_APPENDF(I4"filter: \"%s\" \"%s\";\n", + BUF_APPENDF(I4 "filter: \"%s\" \"%s\";\n", epr->filter.part, epr->filter.state); } /* Action */ switch (epr->action) { - case EDJE_ACTION_TYPE_ACTION_STOP: - BUF_APPEND(I4"action: ACTION_STOP;\n"); + case EDJE_ACTION_TYPE_ACTION_STOP: + BUF_APPEND(I4 "action: ACTION_STOP;\n"); break; - case EDJE_ACTION_TYPE_STATE_SET: + + case EDJE_ACTION_TYPE_STATE_SET: if (epr->state) { - BUF_APPENDF(I4"action: STATE_SET \"%s\" %.2f;\n", epr->state, + BUF_APPENDF(I4 "action: STATE_SET \"%s\" %.2f;\n", epr->state, edje_edit_program_value_get(obj, program)); } break; - case EDJE_ACTION_TYPE_SIGNAL_EMIT: - if (epr->state && epr->state2) - BUF_APPENDF(I4"action: SIGNAL_EMIT \"%s\" \"%s\";\n", epr->state, epr->state2); - break; - case EDJE_ACTION_TYPE_SCRIPT: - { - Program_Script *ps; - ps = eina_hash_find(eed->program_scripts, &epr->id); - if (ps && !ps->delete_me) - { - BUF_APPEND(I4"script {\n"); - BUF_APPEND(ps->code); - BUF_APPEND(I4"}\n"); - } - } + case EDJE_ACTION_TYPE_SIGNAL_EMIT: + if (epr->state && epr->state2) + BUF_APPENDF(I4 "action: SIGNAL_EMIT \"%s\" \"%s\";\n", epr->state, epr->state2); break; - case EDJE_ACTION_TYPE_SOUND_SAMPLE: - { - BUF_APPEND(I4"action: PLAY_SAMPLE "); - BUF_APPENDF("\"%s\" %.4f", epr->sample_name, epr->speed); - switch (epr->channel) + + case EDJE_ACTION_TYPE_SCRIPT: + { + Program_Script *ps; + + ps = eina_hash_find(eed->program_scripts, &epr->id); + if (ps && !ps->delete_me) + { + BUF_APPEND(I4 "script {\n"); + BUF_APPEND(ps->code); + BUF_APPEND(I4 "}\n"); + } + } + break; + + case EDJE_ACTION_TYPE_SOUND_SAMPLE: + { + BUF_APPEND(I4 "action: PLAY_SAMPLE "); + BUF_APPENDF("\"%s\" %.4f", epr->sample_name, epr->speed); + switch (epr->channel) + { + case EDJE_CHANNEL_BACKGROUND: { - case EDJE_CHANNEL_BACKGROUND: - { - BUF_APPEND(" BACKGROUND"); - break; - } - case EDJE_CHANNEL_MUSIC: - { - BUF_APPEND(" MUSIC"); - break; - } - case EDJE_CHANNEL_FOREGROUND: - { - BUF_APPEND(" FOREGROUND"); - break; - } - case EDJE_CHANNEL_INTERFACE: - { - BUF_APPEND(" INTERFACE"); - break; - } - case EDJE_CHANNEL_INPUT: - { - BUF_APPEND(" INPUT"); - break; - } - case EDJE_CHANNEL_ALERT: - { - BUF_APPEND(" ALERT"); - break; - } - default: + BUF_APPEND(" BACKGROUND"); break; } - BUF_APPENDF(";\n"); - break; - } - case EDJE_ACTION_TYPE_SOUND_TONE: - { - BUF_APPEND(I4"action: PLAY_TONE "); - BUF_APPENDF("\"%s\" %.4f;\n", epr->tone_name, epr->duration); - break; - } - case EDJE_ACTION_TYPE_DRAG_VAL_SET: - { - BUF_APPEND(I4"action: DRAG_VAL_SET "); - BUF_APPENDF("%.4f %.4f;\n", epr->value, epr->value2); - break; - } - case EDJE_ACTION_TYPE_DRAG_VAL_STEP: - { - BUF_APPEND(I4"action: DRAG_VAL_STEP "); - BUF_APPENDF("%.4f %.4f;\n", epr->value, epr->value2); - break; - } - case EDJE_ACTION_TYPE_DRAG_VAL_PAGE: - { - BUF_APPEND(I4"action: DRAG_VAL_PAGE "); - BUF_APPENDF("%.4f %.4f;\n", epr->value, epr->value2); - break; - } - default: - break; + + case EDJE_CHANNEL_MUSIC: + { + BUF_APPEND(" MUSIC"); + break; + } + + case EDJE_CHANNEL_FOREGROUND: + { + BUF_APPEND(" FOREGROUND"); + break; + } + + case EDJE_CHANNEL_INTERFACE: + { + BUF_APPEND(" INTERFACE"); + break; + } + + case EDJE_CHANNEL_INPUT: + { + BUF_APPEND(" INPUT"); + break; + } + + case EDJE_CHANNEL_ALERT: + { + BUF_APPEND(" ALERT"); + break; + } + + default: + break; + } + BUF_APPENDF(";\n"); + break; + } + + case EDJE_ACTION_TYPE_SOUND_TONE: + { + BUF_APPEND(I4 "action: PLAY_TONE "); + BUF_APPENDF("\"%s\" %.4f;\n", epr->tone_name, epr->duration); + break; + } + + case EDJE_ACTION_TYPE_DRAG_VAL_SET: + { + BUF_APPEND(I4 "action: DRAG_VAL_SET "); + BUF_APPENDF("%.4f %.4f;\n", epr->value, epr->value2); + break; + } + + case EDJE_ACTION_TYPE_DRAG_VAL_STEP: + { + BUF_APPEND(I4 "action: DRAG_VAL_STEP "); + BUF_APPENDF("%.4f %.4f;\n", epr->value, epr->value2); + break; + } + + case EDJE_ACTION_TYPE_DRAG_VAL_PAGE: + { + BUF_APPEND(I4 "action: DRAG_VAL_PAGE "); + BUF_APPENDF("%.4f %.4f;\n", epr->value, epr->value2); + break; + } + + default: + break; } /* Transition */ @@ -10549,53 +10618,64 @@ _edje_generate_source_of_program(Evas_Object *obj, const char *program, Eina_Str { case EDJE_TWEEN_MODE_LINEAR: if (db) - BUF_APPENDF(I4"transition: LINEAR %.5f", db); + BUF_APPENDF(I4 "transition: LINEAR %.5f", db); else no_transition = EINA_TRUE; break; + case EDJE_TWEEN_MODE_ACCELERATE: - BUF_APPENDF(I4"transition: ACCELERATE %.5f", db); + BUF_APPENDF(I4 "transition: ACCELERATE %.5f", db); break; + case EDJE_TWEEN_MODE_DECELERATE: - BUF_APPENDF(I4"transition: DECELERATE %.5f", db); + BUF_APPENDF(I4 "transition: DECELERATE %.5f", db); break; + case EDJE_TWEEN_MODE_SINUSOIDAL: - BUF_APPENDF(I4"transition: SINUSOIDAL %.5f", db); + BUF_APPENDF(I4 "transition: SINUSOIDAL %.5f", db); break; + case EDJE_TWEEN_MODE_ACCELERATE_FACTOR: v1 = TO_DOUBLE(epr->tween.v1); - BUF_APPENDF(I4"transition: ACCELERATE_FACTOR %.5f %.5f", db,v1); + BUF_APPENDF(I4 "transition: ACCELERATE_FACTOR %.5f %.5f", db, v1); break; + case EDJE_TWEEN_MODE_DECELERATE_FACTOR: v1 = TO_DOUBLE(epr->tween.v1); - BUF_APPENDF(I4"transition: DECELERATE_FACTOR %.5f %.5f", db,v1); + BUF_APPENDF(I4 "transition: DECELERATE_FACTOR %.5f %.5f", db, v1); break; + case EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR: v1 = TO_DOUBLE(epr->tween.v1); - BUF_APPENDF(I4"transition: SINUSOIDAL_FACTOR %.5f %.5f", db,v1); + BUF_APPENDF(I4 "transition: SINUSOIDAL_FACTOR %.5f %.5f", db, v1); break; + case EDJE_TWEEN_MODE_DIVISOR_INTERP: v1 = TO_DOUBLE(epr->tween.v1); v2 = TO_DOUBLE(epr->tween.v2); - BUF_APPENDF(I4"transition: DIVISOR_INTERP %.5f %.5f %.5f", db,v1,v2); + BUF_APPENDF(I4 "transition: DIVISOR_INTERP %.5f %.5f %.5f", db, v1, v2); break; + case EDJE_TWEEN_MODE_BOUNCE: v1 = TO_DOUBLE(epr->tween.v1); v2 = TO_DOUBLE(epr->tween.v2); - BUF_APPENDF(I4"transition: BOUNCE %.5f %.5f %.5f", db,v1,v2); + BUF_APPENDF(I4 "transition: BOUNCE %.5f %.5f %.5f", db, v1, v2); break; + case EDJE_TWEEN_MODE_SPRING: v1 = TO_DOUBLE(epr->tween.v1); v2 = TO_DOUBLE(epr->tween.v2); - BUF_APPENDF(I4"transition: SPRING %.5f %.5f %.5f", db,v1,v2); + BUF_APPENDF(I4 "transition: SPRING %.5f %.5f %.5f", db, v1, v2); break; + case EDJE_TWEEN_MODE_CUBIC_BEZIER: v1 = TO_DOUBLE(epr->tween.v1); v2 = TO_DOUBLE(epr->tween.v2); v3 = TO_DOUBLE(epr->tween.v3); v4 = TO_DOUBLE(epr->tween.v4); - BUF_APPENDF(I4"transition: CUBIC_BEZIER %.5f %.5f %.5f %.5f %.5f", db,v1,v2,v3,v4); + BUF_APPENDF(I4 "transition: CUBIC_BEZIER %.5f %.5f %.5f %.5f %.5f", db, v1, v2, v3, v4); break; + default: no_transition = EINA_TRUE; break; @@ -10612,48 +10692,48 @@ _edje_generate_source_of_program(Evas_Object *obj, const char *program, Eina_Str db = epr->in.from; db2 = epr->in.range; if (db || db2) - BUF_APPENDF(I4"in: %.5f %.5f;\n", db, db2); + BUF_APPENDF(I4 "in: %.5f %.5f;\n", db, db2); /* Targets */ if ((ll = _edje_program_targets_get(obj, epr))) { - EINA_LIST_FOREACH(ll, l, data) - BUF_APPENDF(I4"target: \"%s\";\n", data); - edje_edit_string_list_free(ll); + EINA_LIST_FOREACH(ll, l, data) + BUF_APPENDF(I4 "target: \"%s\";\n", data); + edje_edit_string_list_free(ll); } /* Afters */ if ((ll = _edje_program_afters_get(obj, epr))) { EINA_LIST_FOREACH(ll, l, data) - BUF_APPENDF(I4"after: \"%s\";\n", data); - edje_edit_string_list_free(ll); + BUF_APPENDF(I4 "after: \"%s\";\n", data); + edje_edit_string_list_free(ll); } // TODO Support script {} /* api */ - api_name = eina_stringshare_add(epr->api.name); + api_name = eina_stringshare_add(epr->api.name); api_description = eina_stringshare_add(epr->api.description); if (api_name || api_description) { - if (api_name && api_description) - { - BUF_APPENDF(I4"api: \"%s\" \"%s\";\n", api_name, api_description); - edje_edit_string_free(api_name); - edje_edit_string_free(api_description); - } - else - if (api_name) - { - BUF_APPENDF(I4"api: \"%s\" \"\";\n", api_name); - edje_edit_string_free(api_name); - } - else - { - BUF_APPENDF(I4"api: \"\" \"%s\";\n", api_description); - edje_edit_string_free(api_description); - } + if (api_name && api_description) + { + BUF_APPENDF(I4 "api: \"%s\" \"%s\";\n", api_name, api_description); + edje_edit_string_free(api_name); + edje_edit_string_free(api_description); + } + else + if (api_name) + { + BUF_APPENDF(I4 "api: \"%s\" \"\";\n", api_name); + edje_edit_string_free(api_name); + } + else + { + BUF_APPENDF(I4 "api: \"\" \"%s\";\n", api_description); + edje_edit_string_free(api_description); + } } BUF_APPEND(I3 "}\n"); @@ -10698,167 +10778,169 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s GET_PD_OR_RETURN(EINA_FALSE); - BUF_APPENDF(I4"description { state: \"%s\"", pd->state.name); + BUF_APPENDF(I4 "description { state: \"%s\"", pd->state.name); _edje_source_with_double_values_append(NULL, 1, pd->state.value, 0, buf, &ret); //TODO Support inherit if (!pd->visible) - BUF_APPEND(I5"visible: 0;\n"); + BUF_APPEND(I5 "visible: 0;\n"); if (pd->limit) - { - switch (pd->limit) - { - case EDJE_STATE_LIMIT_WIDTH: + { + switch (pd->limit) + { + case EDJE_STATE_LIMIT_WIDTH: { BUF_APPEND("limit: WIDTH;\n"); break; } - case EDJE_STATE_LIMIT_HEIGHT: + + case EDJE_STATE_LIMIT_HEIGHT: { BUF_APPEND("limit: HEIGHT;\n"); break; } - case EDJE_STATE_LIMIT_BOTH: + + case EDJE_STATE_LIMIT_BOTH: { BUF_APPEND("limit: BOTH;\n"); break; } - } - } + } + } if (pd->align.x != 0.5 || pd->align.y != 0.5) - _edje_source_with_double_values_append(I5"align", 2, + _edje_source_with_double_values_append(I5 "align", 2, TO_DOUBLE(pd->align.x), TO_DOUBLE(pd->align.y), buf, &ret); if (pd->fixed.w || pd->fixed.h) - BUF_APPENDF(I5"fixed: %d %d;\n", pd->fixed.w, pd->fixed.h); + BUF_APPENDF(I5 "fixed: %d %d;\n", pd->fixed.w, pd->fixed.h); if (pd->min.w || pd->min.h) - BUF_APPENDF(I5"min: %d %d;\n", pd->min.w, pd->min.h); + BUF_APPENDF(I5 "min: %d %d;\n", pd->min.w, pd->min.h); if (pd->max.w != -1 || pd->max.h != -1) - BUF_APPENDF(I5"max: %d %d;\n", pd->max.w, pd->max.h); + BUF_APPENDF(I5 "max: %d %d;\n", pd->max.w, pd->max.h); if ((pd->minmul.have) && (pd->minmul.w != 1 || pd->minmul.h != 1)) - _edje_source_with_double_values_append(I5"minmul", 2, + _edje_source_with_double_values_append(I5 "minmul", 2, TO_DOUBLE(pd->minmul.w), TO_DOUBLE(pd->minmul.h), buf, &ret); if (pd->step.x && pd->step.y) - BUF_APPENDF(I5"step: %d %d;\n", TO_INT(pd->step.x), TO_INT(pd->step.y)); + BUF_APPENDF(I5 "step: %d %d;\n", TO_INT(pd->step.x), TO_INT(pd->step.y)); if (pd->aspect.min || pd->aspect.max) - _edje_source_with_double_values_append(I5"aspect", 2, - TO_DOUBLE(pd->aspect.min), - TO_DOUBLE(pd->aspect.max), - buf, &ret); + _edje_source_with_double_values_append(I5 "aspect", 2, + TO_DOUBLE(pd->aspect.min), + TO_DOUBLE(pd->aspect.max), + buf, &ret); if (pd->aspect.prefer) - BUF_APPENDF(I5"aspect_preference: %s;\n", prefers[(int) pd->aspect.prefer]); + BUF_APPENDF(I5 "aspect_preference: %s;\n", prefers[(int)pd->aspect.prefer]); if (pd->color_class) - BUF_APPENDF(I5"color_class: \"%s\";\n", pd->color_class); + BUF_APPENDF(I5 "color_class: \"%s\";\n", pd->color_class); if (pd->color.r != 255 || pd->color.g != 255 || pd->color.b != 255 || pd->color.a != 255) - BUF_APPENDF(I5"color: %d %d %d %d;\n", - pd->color.r, pd->color.g, pd->color.b, pd->color.a); + BUF_APPENDF(I5 "color: %d %d %d %d;\n", + pd->color.r, pd->color.g, pd->color.b, pd->color.a); if (pd->color2.r != 0 || pd->color2.g != 0 || pd->color2.b != 0 || pd->color2.a != 255) - BUF_APPENDF(I5"color2: %d %d %d %d;\n", - pd->color2.r, pd->color2.g, pd->color2.b, pd->color2.a); + BUF_APPENDF(I5 "color2: %d %d %d %d;\n", + pd->color2.r, pd->color2.g, pd->color2.b, pd->color2.a); if (rp->part->type == EDJE_PART_TYPE_TEXT || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK) { - Edje_Part_Description_Text *txt; + Edje_Part_Description_Text *txt; - txt = (Edje_Part_Description_Text *) pd; + txt = (Edje_Part_Description_Text *)pd; - if (txt->text.color3.r != 0 || txt->text.color3.g != 0 || - txt->text.color3.b != 0 || txt->text.color3.a != 128) - BUF_APPENDF(I5"color3: %d %d %d %d;\n", - txt->text.color3.r, txt->text.color3.g, txt->text.color3.b, txt->text.color3.a); + if (txt->text.color3.r != 0 || txt->text.color3.g != 0 || + txt->text.color3.b != 0 || txt->text.color3.a != 128) + BUF_APPENDF(I5 "color3: %d %d %d %d;\n", + txt->text.color3.r, txt->text.color3.g, txt->text.color3.b, txt->text.color3.a); } if (rp->part->type == EDJE_PART_TYPE_BOX) { Edje_Part_Description_Box *box; - box = (Edje_Part_Description_Box *) pd; + box = (Edje_Part_Description_Box *)pd; if ((box->box.layout && box->box.alt_layout) || box->box.align.x != 0.5 || box->box.align.y != 0.5 || box->box.padding.x != 0 || box->box.padding.y != 0 || !box->box.min.h || !box->box.min.v) { - BUF_APPEND(I5"box {\n"); + BUF_APPEND(I5 "box {\n"); if (box->box.layout && box->box.alt_layout) - BUF_APPENDF(I6"layout: \"%s\" \"%s\";\n", box->box.layout, box->box.alt_layout); + BUF_APPENDF(I6 "layout: \"%s\" \"%s\";\n", box->box.layout, box->box.alt_layout); else if (!box->box.layout && box->box.alt_layout) - BUF_APPENDF(I6"layout: \"horizontal\" \"%s\";\n", box->box.alt_layout); + BUF_APPENDF(I6 "layout: \"horizontal\" \"%s\";\n", box->box.alt_layout); else if (box->box.layout && !box->box.alt_layout) - BUF_APPENDF(I6"layout: \"%s\";\n", box->box.layout); + BUF_APPENDF(I6 "layout: \"%s\";\n", box->box.layout); if (box->box.align.x != 0.5 || box->box.align.y != 0.5) - _edje_source_with_double_values_append(I6"align", 2, + _edje_source_with_double_values_append(I6 "align", 2, TO_DOUBLE(box->box.align.x), TO_DOUBLE(box->box.align.y), buf, &ret); if (box->box.padding.x != 0 || box->box.padding.y != 0) - BUF_APPENDF(I6"padding: %d %d;\n", box->box.padding.x, box->box.padding.y); + BUF_APPENDF(I6 "padding: %d %d;\n", box->box.padding.x, box->box.padding.y); if (box->box.min.h || box->box.min.v) - BUF_APPENDF(I6"min: %d %d;\n", box->box.min.h, box->box.min.v); + BUF_APPENDF(I6 "min: %d %d;\n", box->box.min.h, box->box.min.v); - BUF_APPEND(I5"}\n"); + BUF_APPEND(I5 "}\n"); } } - if (rp->part->type == EDJE_PART_TYPE_TABLE) { Edje_Part_Description_Table *table; - table = (Edje_Part_Description_Table*) pd; + table = (Edje_Part_Description_Table *)pd; if ((table->table.homogeneous != EDJE_OBJECT_TABLE_HOMOGENEOUS_NONE) || table->table.align.x != 0.5 || table->table.align.y != 0.5 || table->table.padding.x != 0 || table->table.padding.y != 0 || !table->table.min.h || !table->table.min.v) { - BUF_APPEND(I5"table {\n"); + BUF_APPEND(I5 "table {\n"); switch (table->table.homogeneous) { case EDJE_OBJECT_TABLE_HOMOGENEOUS_TABLE: - { - BUF_APPENDF(I6"homogeneous: TABLE;\n"); - break; - } + { + BUF_APPENDF(I6 "homogeneous: TABLE;\n"); + break; + } + case EDJE_OBJECT_TABLE_HOMOGENEOUS_ITEM: - { - BUF_APPENDF(I6"homogeneous: ITEM;\n"); - break; - } + { + BUF_APPENDF(I6 "homogeneous: ITEM;\n"); + break; + } } if (table->table.align.x != 0.5 || table->table.align.y != 0.5) - _edje_source_with_double_values_append(I6"align", 2, + _edje_source_with_double_values_append(I6 "align", 2, TO_DOUBLE(table->table.align.x), TO_DOUBLE(table->table.align.y), buf, &ret); if (table->table.padding.x != 0 || table->table.padding.y != 0) - BUF_APPENDF(I6"padding: %d %d;\n", table->table.padding.x, table->table.padding.y); + BUF_APPENDF(I6 "padding: %d %d;\n", table->table.padding.x, table->table.padding.y); if (table->table.min.h || table->table.min.v) - BUF_APPENDF(I6"min: %d %d;\n", table->table.min.h, table->table.min.v); + BUF_APPENDF(I6 "min: %d %d;\n", table->table.min.h, table->table.min.v); - BUF_APPEND(I5"}\n"); + BUF_APPEND(I5 "}\n"); } } @@ -10866,24 +10948,24 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s if (pd->rel1.relative_x || pd->rel1.relative_y || pd->rel1.offset_x || pd->rel1.offset_y || pd->rel1.id_x != -1 || pd->rel1.id_y != -1) { - BUF_APPEND(I5"rel1 {\n"); - if (pd->rel1.relative_x || pd->rel1.relative_y) - _edje_source_with_double_values_append(I6"relative", 2, - TO_DOUBLE(pd->rel1.relative_x), - TO_DOUBLE(pd->rel1.relative_y), - buf, &ret); - if (pd->rel1.offset_x || pd->rel1.offset_y) - BUF_APPENDF(I6"offset: %d %d;\n", pd->rel1.offset_x, pd->rel1.offset_y); - if (pd->rel1.id_x != -1 && pd->rel1.id_x == pd->rel1.id_y) - BUF_APPENDF(I6"to: \"%s\";\n", ed->table_parts[pd->rel1.id_x]->part->name); - else - { - if (pd->rel1.id_x != -1) - BUF_APPENDF(I6"to_x: \"%s\";\n", ed->table_parts[pd->rel1.id_x]->part->name); - if (pd->rel1.id_y != -1) - BUF_APPENDF(I6"to_y: \"%s\";\n", ed->table_parts[pd->rel1.id_y]->part->name); - } - BUF_APPEND(I5"}\n");//rel1 + BUF_APPEND(I5 "rel1 {\n"); + if (pd->rel1.relative_x || pd->rel1.relative_y) + _edje_source_with_double_values_append(I6 "relative", 2, + TO_DOUBLE(pd->rel1.relative_x), + TO_DOUBLE(pd->rel1.relative_y), + buf, &ret); + if (pd->rel1.offset_x || pd->rel1.offset_y) + BUF_APPENDF(I6 "offset: %d %d;\n", pd->rel1.offset_x, pd->rel1.offset_y); + if (pd->rel1.id_x != -1 && pd->rel1.id_x == pd->rel1.id_y) + BUF_APPENDF(I6 "to: \"%s\";\n", ed->table_parts[pd->rel1.id_x]->part->name); + else + { + if (pd->rel1.id_x != -1) + BUF_APPENDF(I6 "to_x: \"%s\";\n", ed->table_parts[pd->rel1.id_x]->part->name); + if (pd->rel1.id_y != -1) + BUF_APPENDF(I6 "to_y: \"%s\";\n", ed->table_parts[pd->rel1.id_y]->part->name); + } + BUF_APPEND(I5 "}\n"); //rel1 } //Rel2 @@ -10891,24 +10973,24 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s pd->rel2.offset_x != -1 || pd->rel2.offset_y != -1 || pd->rel2.id_x != -1 || pd->rel2.id_y != -1) { - BUF_APPEND(I5"rel2 {\n"); - if (TO_DOUBLE(pd->rel2.relative_x) != 1.0 || TO_DOUBLE(pd->rel2.relative_y) != 1.0) - _edje_source_with_double_values_append(I6"relative", 2, - TO_DOUBLE(pd->rel2.relative_x), - TO_DOUBLE(pd->rel2.relative_y), - buf, &ret); - if (pd->rel2.offset_x != -1 || pd->rel2.offset_y != -1) - BUF_APPENDF(I6"offset: %d %d;\n", pd->rel2.offset_x, pd->rel2.offset_y); - if (pd->rel2.id_x != -1 && pd->rel2.id_x == pd->rel2.id_y) - BUF_APPENDF(I6"to: \"%s\";\n", ed->table_parts[pd->rel2.id_x]->part->name); - else - { - if (pd->rel2.id_x != -1) - BUF_APPENDF(I6"to_x: \"%s\";\n", ed->table_parts[pd->rel2.id_x]->part->name); - if (pd->rel2.id_y != -1) - BUF_APPENDF(I6"to_y: \"%s\";\n", ed->table_parts[pd->rel2.id_y]->part->name); - } - BUF_APPEND(I5"}\n");//rel2 + BUF_APPEND(I5 "rel2 {\n"); + if (TO_DOUBLE(pd->rel2.relative_x) != 1.0 || TO_DOUBLE(pd->rel2.relative_y) != 1.0) + _edje_source_with_double_values_append(I6 "relative", 2, + TO_DOUBLE(pd->rel2.relative_x), + TO_DOUBLE(pd->rel2.relative_y), + buf, &ret); + if (pd->rel2.offset_x != -1 || pd->rel2.offset_y != -1) + BUF_APPENDF(I6 "offset: %d %d;\n", pd->rel2.offset_x, pd->rel2.offset_y); + if (pd->rel2.id_x != -1 && pd->rel2.id_x == pd->rel2.id_y) + BUF_APPENDF(I6 "to: \"%s\";\n", ed->table_parts[pd->rel2.id_x]->part->name); + else + { + if (pd->rel2.id_x != -1) + BUF_APPENDF(I6 "to_x: \"%s\";\n", ed->table_parts[pd->rel2.id_x]->part->name); + if (pd->rel2.id_y != -1) + BUF_APPENDF(I6 "to_y: \"%s\";\n", ed->table_parts[pd->rel2.id_y]->part->name); + } + BUF_APPEND(I5 "}\n"); //rel2 } //Map @@ -10918,23 +11000,23 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s (pd->map.colors_count != 0) || (pd->map.backcull) || (pd->map.on) || (pd->map.persp_on) || (!pd->map.smooth) || (!pd->map.alpha)) { - BUF_APPEND(I5"map {\n"); + BUF_APPEND(I5 "map {\n"); if (pd->map.id_persp != -1) - BUF_APPENDF(I6"perspective: \"%s\";\n", _edje_part_name_find(ed, pd->map.id_persp)); + BUF_APPENDF(I6 "perspective: \"%s\";\n", _edje_part_name_find(ed, pd->map.id_persp)); if (pd->map.id_light != -1) - BUF_APPENDF(I6"light: \"%s\";\n", _edje_part_name_find(ed, pd->map.id_light)); + BUF_APPENDF(I6 "light: \"%s\";\n", _edje_part_name_find(ed, pd->map.id_light)); if (pd->map.backcull) - BUF_APPEND(I6"backface_cull: 1;\n"); + BUF_APPEND(I6 "backface_cull: 1;\n"); if (pd->map.on) - BUF_APPEND(I6"on: 1;\n"); + BUF_APPEND(I6 "on: 1;\n"); if (pd->map.persp_on) - BUF_APPEND(I6"perspective_on: 1;\n"); + BUF_APPEND(I6 "perspective_on: 1;\n"); if (!pd->map.smooth) - BUF_APPEND(I6"smooth: 0;\n"); + BUF_APPEND(I6 "smooth: 0;\n"); if (!pd->map.alpha) - BUF_APPEND(I6"alpha: 0;\n"); + BUF_APPEND(I6 "alpha: 0;\n"); if (pd->map.colors_count > 0) { @@ -10942,7 +11024,7 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s { if ((pd->map.colors[i]->r != 255) || (pd->map.colors[i]->g != 255) || (pd->map.colors[i]->b != 255) || (pd->map.colors[i]->b != 255)) - BUF_APPENDF(I6"color: %d %d %d %d %d;\n", pd->map.colors[i]->idx, + BUF_APPENDF(I6 "color: %d %d %d %d %d;\n", pd->map.colors[i]->idx, pd->map.colors[i]->r, pd->map.colors[i]->g, pd->map.colors[i]->b, pd->map.colors[i]->a); } @@ -10951,285 +11033,289 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s if ((pd->map.rot.id_center != -1) || (pd->map.rot.x != 0) || (pd->map.rot.y != 0) || (pd->map.rot.z != 0)) { - BUF_APPEND(I6"rotation {\n"); + BUF_APPEND(I6 "rotation {\n"); if (pd->map.rot.id_center != -1) - BUF_APPENDF(I7"center: \"%s\";\n", _edje_part_name_find(ed, pd->map.rot.id_center)); + BUF_APPENDF(I7 "center: \"%s\";\n", _edje_part_name_find(ed, pd->map.rot.id_center)); if (TO_DOUBLE(pd->map.rot.x) != 0.0) - _edje_source_with_double_values_append(I7"x", 1, + _edje_source_with_double_values_append(I7 "x", 1, TO_DOUBLE(pd->map.rot.x), 0.0, buf, &ret); if (TO_DOUBLE(pd->map.rot.y) != 0.0) - _edje_source_with_double_values_append(I7"y", 1, + _edje_source_with_double_values_append(I7 "y", 1, TO_DOUBLE(pd->map.rot.y), 0.0, buf, &ret); if (TO_DOUBLE(pd->map.rot.z) != 0.0) - _edje_source_with_double_values_append(I7"z", 1, + _edje_source_with_double_values_append(I7 "z", 1, TO_DOUBLE(pd->map.rot.z), 0.0, buf, &ret); - BUF_APPEND(I6"}\n"); + BUF_APPEND(I6 "}\n"); } - BUF_APPEND(I5"}\n"); + BUF_APPEND(I5 "}\n"); } if ((pd->persp.zplane != 0) || (pd->persp.focal != 1000)) { - BUF_APPEND(I5"perspective {\n"); + BUF_APPEND(I5 "perspective {\n"); if (pd->persp.zplane != 0) - BUF_APPENDF(I6"zplane: %d;\n", pd->persp.zplane); + BUF_APPENDF(I6 "zplane: %d;\n", pd->persp.zplane); if (pd->persp.focal != 1000) - BUF_APPENDF(I6"focal: %d;\n", pd->persp.focal); + BUF_APPENDF(I6 "focal: %d;\n", pd->persp.focal); - BUF_APPEND(I5"}\n"); + BUF_APPEND(I5 "}\n"); } - //Image if (rp->part->type == EDJE_PART_TYPE_IMAGE) { - char *data; - const char *image_name; + char *data; + const char *image_name; - Edje_Part_Description_Image *img; + Edje_Part_Description_Image *img; - img = (Edje_Part_Description_Image *) pd; + img = (Edje_Part_Description_Image *)pd; - BUF_APPEND(I5"image {\n"); + BUF_APPEND(I5 "image {\n"); - image_name = _edje_image_name_find(eed, img->image.id); - if (image_name) - BUF_APPENDF(I6"normal: \"%s\";\n", image_name); + image_name = _edje_image_name_find(eed, img->image.id); + if (image_name) + BUF_APPENDF(I6 "normal: \"%s\";\n", image_name); - ll = edje_edit_state_tweens_list_get(obj, part, state, value); - EINA_LIST_FOREACH(ll, l, data) - BUF_APPENDF(I6"tween: \"%s\";\n", data); - edje_edit_string_list_free(ll); + ll = edje_edit_state_tweens_list_get(obj, part, state, value); + EINA_LIST_FOREACH(ll, l, data) + BUF_APPENDF(I6 "tween: \"%s\";\n", data); + edje_edit_string_list_free(ll); - if (img->image.border.l || img->image.border.r || img->image.border.t || img->image.border.b) - BUF_APPENDF(I6"border: %d %d %d %d;\n", img->image.border.l, img->image.border.r, img->image.border.t, img->image.border.b); - if (img->image.border.scale_by != 0.0) - _edje_source_with_double_values_append(I6"border_scale_by", 1, - TO_DOUBLE(img->image.border.scale_by), - 0.0, buf, &ret); - if (img->image.border.scale) - BUF_APPEND(I6"border_scale: 1;\n"); + if (img->image.border.l || img->image.border.r || img->image.border.t || img->image.border.b) + BUF_APPENDF(I6 "border: %d %d %d %d;\n", img->image.border.l, img->image.border.r, img->image.border.t, img->image.border.b); + if (img->image.border.scale_by != 0.0) + _edje_source_with_double_values_append(I6 "border_scale_by", 1, + TO_DOUBLE(img->image.border.scale_by), + 0.0, buf, &ret); + if (img->image.border.scale) + BUF_APPEND(I6 "border_scale: 1;\n"); - if (img->image.scale_hint == EVAS_IMAGE_SCALE_HINT_DYNAMIC) - BUF_APPEND(I6"scale_hint: DYNAMIC;\n"); - else if (img->image.scale_hint == EVAS_IMAGE_SCALE_HINT_STATIC) - BUF_APPEND(I6"scale_hint: STATIC;\n"); + if (img->image.scale_hint == EVAS_IMAGE_SCALE_HINT_DYNAMIC) + BUF_APPEND(I6 "scale_hint: DYNAMIC;\n"); + else if (img->image.scale_hint == EVAS_IMAGE_SCALE_HINT_STATIC) + BUF_APPEND(I6 "scale_hint: STATIC;\n"); - if (img->image.border.no_fill == 1) - BUF_APPEND(I6"middle: NONE;\n"); - else if (img->image.border.no_fill == 0) - BUF_APPEND(I6"middle: DEFAULT;\n"); - else if (img->image.border.no_fill == 2) - BUF_APPEND(I6"middle: SOLID;\n"); + if (img->image.border.no_fill == 1) + BUF_APPEND(I6 "middle: NONE;\n"); + else if (img->image.border.no_fill == 0) + BUF_APPEND(I6 "middle: DEFAULT;\n"); + else if (img->image.border.no_fill == 2) + BUF_APPEND(I6 "middle: SOLID;\n"); - BUF_APPEND(I5"}\n");//image + BUF_APPEND(I5 "}\n"); //image - //Fill + //Fill - if (!img->image.fill.smooth || img->image.fill.pos_rel_x || - img->image.fill.pos_rel_y || img->image.fill.pos_abs_x || - img->image.fill.pos_abs_y || TO_DOUBLE(img->image.fill.rel_x) != 1.0 || - TO_DOUBLE(img->image.fill.rel_y) != 1.0 || - img->image.fill.abs_x || img->image.fill.abs_y - || img->image.fill.type == EDJE_FILL_TYPE_TILE) - { - BUF_APPEND(I5"fill {\n"); - if (!img->image.fill.smooth) - BUF_APPEND(I6"smooth: 0;\n"); - //TODO Support spread + if (!img->image.fill.smooth || img->image.fill.pos_rel_x || + img->image.fill.pos_rel_y || img->image.fill.pos_abs_x || + img->image.fill.pos_abs_y || TO_DOUBLE(img->image.fill.rel_x) != 1.0 || + TO_DOUBLE(img->image.fill.rel_y) != 1.0 || + img->image.fill.abs_x || img->image.fill.abs_y + || img->image.fill.type == EDJE_FILL_TYPE_TILE) + { + BUF_APPEND(I5 "fill {\n"); + if (!img->image.fill.smooth) + BUF_APPEND(I6 "smooth: 0;\n"); + //TODO Support spread - if (img->image.fill.pos_rel_x || img->image.fill.pos_rel_y || - img->image.fill.pos_abs_x || img->image.fill.pos_abs_y) - { - BUF_APPEND(I6"origin {\n"); - if (img->image.fill.pos_rel_x || img->image.fill.pos_rel_y) - _edje_source_with_double_values_append(I7"relative", 2, - TO_DOUBLE(img->image.fill.pos_rel_x), - TO_DOUBLE(img->image.fill.pos_rel_y), - buf, &ret); - if (img->image.fill.pos_abs_x || img->image.fill.pos_abs_y) - BUF_APPENDF(I7"offset: %d %d;\n", img->image.fill.pos_abs_x, img->image.fill.pos_abs_y); - BUF_APPEND(I6"}\n"); - } + if (img->image.fill.pos_rel_x || img->image.fill.pos_rel_y || + img->image.fill.pos_abs_x || img->image.fill.pos_abs_y) + { + BUF_APPEND(I6 "origin {\n"); + if (img->image.fill.pos_rel_x || img->image.fill.pos_rel_y) + _edje_source_with_double_values_append(I7 "relative", 2, + TO_DOUBLE(img->image.fill.pos_rel_x), + TO_DOUBLE(img->image.fill.pos_rel_y), + buf, &ret); + if (img->image.fill.pos_abs_x || img->image.fill.pos_abs_y) + BUF_APPENDF(I7 "offset: %d %d;\n", img->image.fill.pos_abs_x, img->image.fill.pos_abs_y); + BUF_APPEND(I6 "}\n"); + } - if (TO_DOUBLE(img->image.fill.rel_x) != 1.0 || TO_DOUBLE(img->image.fill.rel_y) != 1.0 || - img->image.fill.abs_x || img->image.fill.abs_y) - { - BUF_APPEND(I6"size {\n"); - if (img->image.fill.rel_x != 1.0 || img->image.fill.rel_y != 1.0) - _edje_source_with_double_values_append(I7"relative", 2, - TO_DOUBLE(img->image.fill.rel_x), - TO_DOUBLE(img->image.fill.rel_y), - buf, &ret); - if (img->image.fill.abs_x || img->image.fill.abs_y) - BUF_APPENDF(I7"offset: %d %d;\n", img->image.fill.abs_x, img->image.fill.abs_y); - BUF_APPEND(I6"}\n"); - } - if (img->image.fill.type == EDJE_FILL_TYPE_TILE) - BUF_APPEND(I6"type: TILE;\n"); + if (TO_DOUBLE(img->image.fill.rel_x) != 1.0 || TO_DOUBLE(img->image.fill.rel_y) != 1.0 || + img->image.fill.abs_x || img->image.fill.abs_y) + { + BUF_APPEND(I6 "size {\n"); + if (img->image.fill.rel_x != 1.0 || img->image.fill.rel_y != 1.0) + _edje_source_with_double_values_append(I7 "relative", 2, + TO_DOUBLE(img->image.fill.rel_x), + TO_DOUBLE(img->image.fill.rel_y), + buf, &ret); + if (img->image.fill.abs_x || img->image.fill.abs_y) + BUF_APPENDF(I7 "offset: %d %d;\n", img->image.fill.abs_x, img->image.fill.abs_y); + BUF_APPEND(I6 "}\n"); + } + if (img->image.fill.type == EDJE_FILL_TYPE_TILE) + BUF_APPEND(I6 "type: TILE;\n"); - BUF_APPEND(I5"}\n"); - } + BUF_APPEND(I5 "}\n"); + } } if (rp->part->type == EDJE_PART_TYPE_PROXY) { - Edje_Part_Description_Proxy *pro; + Edje_Part_Description_Proxy *pro; - pro = (Edje_Part_Description_Proxy *) pd; + pro = (Edje_Part_Description_Proxy *)pd; if (pro->proxy.id >= 0) { - const char * source_name; + const char *source_name; source_name = _edje_part_name_find(ed, pro->proxy.id); if (source_name) - BUF_APPENDF(I5"source: \"%s\";\n", source_name); + BUF_APPENDF(I5 "source: \"%s\";\n", source_name); } - //Fill + //Fill - BUF_APPEND(I5"fill {\n"); - if (!pro->proxy.fill.smooth) - BUF_APPEND(I6"smooth: 0;\n"); + BUF_APPEND(I5 "fill {\n"); + if (!pro->proxy.fill.smooth) + BUF_APPEND(I6 "smooth: 0;\n"); //TODO Support spread - //TODO Support source + //TODO Support source - if (pro->proxy.fill.pos_rel_x || pro->proxy.fill.pos_rel_y || + if (pro->proxy.fill.pos_rel_x || pro->proxy.fill.pos_rel_y || pro->proxy.fill.pos_abs_x || pro->proxy.fill.pos_abs_y) - { - BUF_APPEND(I6"origin {\n"); - if (pro->proxy.fill.pos_rel_x || pro->proxy.fill.pos_rel_y) - _edje_source_with_double_values_append(I7"relative", 2, - TO_DOUBLE(pro->proxy.fill.pos_rel_x), - TO_DOUBLE(pro->proxy.fill.pos_rel_y), - buf, &ret); - if (pro->proxy.fill.pos_abs_x || pro->proxy.fill.pos_abs_y) - BUF_APPENDF(I7"offset: %d %d;\n", pro->proxy.fill.pos_abs_x, pro->proxy.fill.pos_abs_y); - BUF_APPEND(I6"}\n"); + { + BUF_APPEND(I6 "origin {\n"); + if (pro->proxy.fill.pos_rel_x || pro->proxy.fill.pos_rel_y) + _edje_source_with_double_values_append(I7 "relative", 2, + TO_DOUBLE(pro->proxy.fill.pos_rel_x), + TO_DOUBLE(pro->proxy.fill.pos_rel_y), + buf, &ret); + if (pro->proxy.fill.pos_abs_x || pro->proxy.fill.pos_abs_y) + BUF_APPENDF(I7 "offset: %d %d;\n", pro->proxy.fill.pos_abs_x, pro->proxy.fill.pos_abs_y); + BUF_APPEND(I6 "}\n"); } - if (TO_DOUBLE(pro->proxy.fill.rel_x) != 1.0 || TO_DOUBLE(pro->proxy.fill.rel_y) != 1.0 || + if (TO_DOUBLE(pro->proxy.fill.rel_x) != 1.0 || TO_DOUBLE(pro->proxy.fill.rel_y) != 1.0 || pro->proxy.fill.abs_x || pro->proxy.fill.abs_y) - { - BUF_APPEND(I6"size {\n"); - if (pro->proxy.fill.rel_x != 1.0 || pro->proxy.fill.rel_y != 1.0) - _edje_source_with_double_values_append(I7"relative", 2, - TO_DOUBLE(pro->proxy.fill.rel_x), - TO_DOUBLE(pro->proxy.fill.rel_y), - buf, &ret); - if (pro->proxy.fill.abs_x || pro->proxy.fill.abs_y) - BUF_APPENDF(I7"offset: %d %d;\n", pro->proxy.fill.abs_x, pro->proxy.fill.abs_y); - BUF_APPEND(I6"}\n"); + { + BUF_APPEND(I6 "size {\n"); + if (pro->proxy.fill.rel_x != 1.0 || pro->proxy.fill.rel_y != 1.0) + _edje_source_with_double_values_append(I7 "relative", 2, + TO_DOUBLE(pro->proxy.fill.rel_x), + TO_DOUBLE(pro->proxy.fill.rel_y), + buf, &ret); + if (pro->proxy.fill.abs_x || pro->proxy.fill.abs_y) + BUF_APPENDF(I7 "offset: %d %d;\n", pro->proxy.fill.abs_x, pro->proxy.fill.abs_y); + BUF_APPEND(I6 "}\n"); } - if (pro->proxy.fill.type == EDJE_FILL_TYPE_TILE) - BUF_APPEND(I6"type: TILE;\n"); + if (pro->proxy.fill.type == EDJE_FILL_TYPE_TILE) + BUF_APPEND(I6 "type: TILE;\n"); - BUF_APPEND(I5"}\n"); + BUF_APPEND(I5 "}\n"); } //Text if ((rp->part->type == EDJE_PART_TYPE_TEXT) || (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)) { - Edje_Part_Description_Text *txt; + Edje_Part_Description_Text *txt; - txt = (Edje_Part_Description_Text *) pd; + txt = (Edje_Part_Description_Text *)pd; - BUF_APPEND(I5"text {\n"); - if (edje_string_get(&txt->text.text)) - { - if (txt->text.text.id) - BUF_APPENDF(I6"text: _(\"%s\");\n", edje_string_id_get(&txt->text.text)); - else - BUF_APPENDF(I6"text: \"%s\";\n", edje_string_get(&txt->text.text)); - } - if (edje_string_get(&txt->text.font)) - { - if (txt->text.font.id) - BUF_APPENDF(I6"font: _(\"%s\");\n", edje_string_id_get(&txt->text.font)); - else - BUF_APPENDF(I6"font: \"%s\";\n", edje_string_get(&txt->text.font)); - } + BUF_APPEND(I5 "text {\n"); + if (edje_string_get(&txt->text.text)) + { + if (txt->text.text.id) + BUF_APPENDF(I6 "text: _(\"%s\");\n", edje_string_id_get(&txt->text.text)); + else + BUF_APPENDF(I6 "text: \"%s\";\n", edje_string_get(&txt->text.text)); + } + if (edje_string_get(&txt->text.font)) + { + if (txt->text.font.id) + BUF_APPENDF(I6 "font: _(\"%s\");\n", edje_string_id_get(&txt->text.font)); + else + BUF_APPENDF(I6 "font: \"%s\";\n", edje_string_get(&txt->text.font)); + } if (edje_string_id_get(&txt->text.repch)) - BUF_APPENDF(I6"repch: \"%s\";\n", edje_string_id_get(&txt->text.repch)); - if (txt->text.size) - BUF_APPENDF(I6"size: %d;\n", txt->text.size); - if (txt->text.text_class) - BUF_APPENDF(I6"text_class: \"%s\";\n", txt->text.text_class); + BUF_APPENDF(I6 "repch: \"%s\";\n", edje_string_id_get(&txt->text.repch)); + if (txt->text.size) + BUF_APPENDF(I6 "size: %d;\n", txt->text.size); + if (txt->text.text_class) + BUF_APPENDF(I6 "text_class: \"%s\";\n", txt->text.text_class); if (txt->text.size_range_min || txt->text.size_range_max) - BUF_APPENDF(I6"size_range: %d %d;\n", txt->text.size_range_min, txt->text.size_range_max); - if (txt->text.fit_x || txt->text.fit_y) - BUF_APPENDF(I6"fit: %d %d;\n", txt->text.fit_x, txt->text.fit_y); - if (txt->text.min_x || txt->text.min_y) - BUF_APPENDF(I6"min: %d %d;\n", txt->text.min_x, txt->text.min_y); - if (txt->text.max_x || txt->text.max_y) - BUF_APPENDF(I6"max: %d %d;\n", txt->text.max_x, txt->text.max_y); - if (TO_DOUBLE(txt->text.align.x) != 0.5 || TO_DOUBLE(txt->text.align.y) != 0.5) - _edje_source_with_double_values_append(I6"align", 2, - TO_DOUBLE(txt->text.align.x), - TO_DOUBLE(txt->text.align.y), - buf, &ret); + BUF_APPENDF(I6 "size_range: %d %d;\n", txt->text.size_range_min, txt->text.size_range_max); + if (txt->text.fit_x || txt->text.fit_y) + BUF_APPENDF(I6 "fit: %d %d;\n", txt->text.fit_x, txt->text.fit_y); + if (txt->text.min_x || txt->text.min_y) + BUF_APPENDF(I6 "min: %d %d;\n", txt->text.min_x, txt->text.min_y); + if (txt->text.max_x || txt->text.max_y) + BUF_APPENDF(I6 "max: %d %d;\n", txt->text.max_x, txt->text.max_y); + if (TO_DOUBLE(txt->text.align.x) != 0.5 || TO_DOUBLE(txt->text.align.y) != 0.5) + _edje_source_with_double_values_append(I6 "align", 2, + TO_DOUBLE(txt->text.align.x), + TO_DOUBLE(txt->text.align.y), + buf, &ret); if (txt->text.id_source != -1) - BUF_APPENDF(I6"source: \"%s\";\n", _edje_part_name_find(ed, txt->text.id_source)); + BUF_APPENDF(I6 "source: \"%s\";\n", _edje_part_name_find(ed, txt->text.id_source)); if (txt->text.id_text_source != -1) - BUF_APPENDF(I6"text_source: \"%s\";\n", _edje_part_name_find(ed, txt->text.id_text_source)); - if (txt->text.ellipsis) - _edje_source_with_double_values_append(I6"ellipsis", 1, - txt->text.ellipsis, - 0.0, buf, &ret); + BUF_APPENDF(I6 "text_source: \"%s\";\n", _edje_part_name_find(ed, txt->text.id_text_source)); + if (txt->text.ellipsis) + _edje_source_with_double_values_append(I6 "ellipsis", 1, + txt->text.ellipsis, + 0.0, buf, &ret); if (edje_string_id_get(&txt->text.style)) - BUF_APPENDF(I6"style: \"%s\";\n", edje_string_id_get(&txt->text.style)); + BUF_APPENDF(I6 "style: \"%s\";\n", edje_string_id_get(&txt->text.style)); //TODO Filter - BUF_APPEND(I5"}\n"); + BUF_APPEND(I5 "}\n"); } //External if (rp->part->type == EDJE_PART_TYPE_EXTERNAL) { - if ((ll = (Eina_List *)edje_edit_state_external_params_list_get(obj, part, state, value))) - { - Edje_External_Param *p; + if ((ll = (Eina_List *)edje_edit_state_external_params_list_get(obj, part, state, value))) + { + Edje_External_Param *p; - BUF_APPEND(I5"params {\n"); - EINA_LIST_FOREACH(ll, l, p) - { - switch (p->type) - { - case EDJE_EXTERNAL_PARAM_TYPE_INT: - BUF_APPENDF(I6"int: \"%s\" \"%d\";\n", p->name, p->i); - break; - case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: - BUF_APPENDF(I6"double: \"%s\" \"%g\";\n", p->name, p->d); - break; - case EDJE_EXTERNAL_PARAM_TYPE_STRING: - if (p->s) - BUF_APPENDF(I6"string: \"%s\" \"%s\";\n", p->name, - p->s); - break; - case EDJE_EXTERNAL_PARAM_TYPE_BOOL: - BUF_APPENDF(I6"bool: \"%s\" \"%d\";\n", p->name, p->i); - break; - case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: - if (p->s) - BUF_APPENDF(I6"choice: \"%s\" \"%s\";\n", p->name, - p->s); - break; - default: - break; - } - } - BUF_APPEND(I5"}\n"); - } + BUF_APPEND(I5 "params {\n"); + EINA_LIST_FOREACH(ll, l, p) + { + switch (p->type) + { + case EDJE_EXTERNAL_PARAM_TYPE_INT: + BUF_APPENDF(I6 "int: \"%s\" \"%d\";\n", p->name, p->i); + break; + + case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: + BUF_APPENDF(I6 "double: \"%s\" \"%g\";\n", p->name, p->d); + break; + + case EDJE_EXTERNAL_PARAM_TYPE_STRING: + if (p->s) + BUF_APPENDF(I6 "string: \"%s\" \"%s\";\n", p->name, + p->s); + break; + + case EDJE_EXTERNAL_PARAM_TYPE_BOOL: + BUF_APPENDF(I6 "bool: \"%s\" \"%d\";\n", p->name, p->i); + break; + + case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: + if (p->s) + BUF_APPENDF(I6 "choice: \"%s\" \"%s\";\n", p->name, + p->s); + break; + + default: + break; + } + } + BUF_APPEND(I5 "}\n"); + } } - BUF_APPEND(I4"}\n");//description + BUF_APPEND(I4 "}\n"); //description return ret; } @@ -11247,28 +11333,28 @@ _edje_generate_source_of_part(Evas_Object *obj, Edje_Part *ep, Eina_Strbuf *buf) GET_RP_OR_RETURN(EINA_FALSE); - BUF_APPENDF(I3"part { name: \"%s\";\n", part); - BUF_APPENDF(I4"type: %s;\n", types[rp->part->type]); + BUF_APPENDF(I3 "part { name: \"%s\";\n", part); + BUF_APPENDF(I4 "type: %s;\n", types[rp->part->type]); if (!rp->part->mouse_events) - BUF_APPEND(I4"mouse_events: 0;\n"); + BUF_APPEND(I4 "mouse_events: 0;\n"); if (rp->part->repeat_events) - BUF_APPEND(I4"repeat_events: 1;\n"); + BUF_APPEND(I4 "repeat_events: 1;\n"); if (rp->part->scale) - BUF_APPEND(I4"scale: 1;\n"); + BUF_APPEND(I4 "scale: 1;\n"); if (rp->part->ignore_flags) - BUF_APPENDF(I4"ignore_flags: \"ON_HOLD\";\n"); + BUF_APPENDF(I4 "ignore_flags: \"ON_HOLD\";\n"); if (rp->part->pointer_mode == EVAS_OBJECT_POINTER_MODE_NOGRAB) - BUF_APPEND(I4"pointer_mode: NOGRAB;\n"); + BUF_APPEND(I4 "pointer_mode: NOGRAB;\n"); if (rp->part->precise_is_inside) - BUF_APPEND(I4"precise_is_inside: 1;\n"); + BUF_APPEND(I4 "precise_is_inside: 1;\n"); if (rp->part->access) - BUF_APPEND(I4"access: 1;\n"); + BUF_APPEND(I4 "access: 1;\n"); //TODO Support use_alternate_font_metrics if ((str = _edje_part_clip_to_get(ed, rp))) { - BUF_APPENDF(I4"clip_to: \"%s\";\n", str); + BUF_APPENDF(I4 "clip_to: \"%s\";\n", str); edje_edit_string_free(str); } @@ -11277,45 +11363,45 @@ _edje_generate_source_of_part(Evas_Object *obj, Edje_Part *ep, Eina_Strbuf *buf) { if ((str = eina_stringshare_add(rp->part->source))) { - BUF_APPENDF(I4"source: \"%s\";\n", str); + BUF_APPENDF(I4 "source: \"%s\";\n", str); eina_stringshare_del(str); } if (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK) { if ((str = eina_stringshare_add(rp->part->source2))) { - BUF_APPENDF(I4"source2: \"%s\";\n", str); + BUF_APPENDF(I4 "source2: \"%s\";\n", str); eina_stringshare_del(str); } if ((str = eina_stringshare_add(rp->part->source3))) { - BUF_APPENDF(I4"source3: \"%s\";\n", str); + BUF_APPENDF(I4 "source3: \"%s\";\n", str); eina_stringshare_del(str); } if ((str = eina_stringshare_add(rp->part->source4))) { - BUF_APPENDF(I4"source4: \"%s\";\n", str); + BUF_APPENDF(I4 "source4: \"%s\";\n", str); eina_stringshare_del(str); } if ((str = eina_stringshare_add(rp->part->source5))) { - BUF_APPENDF(I4"source5: \"%s\";\n", str); + BUF_APPENDF(I4 "source5: \"%s\";\n", str); eina_stringshare_del(str); } if ((str = eina_stringshare_add(rp->part->source6))) { - BUF_APPENDF(I4"source6: \"%s\";\n", str); + BUF_APPENDF(I4 "source6: \"%s\";\n", str); eina_stringshare_del(str); } - if (rp->part->entry_mode) - BUF_APPENDF(I4"entry_mode: \"%s\";\n", - entry_mode[rp->part->entry_mode]); - if (rp->part->select_mode) - BUF_APPENDF(I4"select_mode: \"EXPLICIT\";\n"); - if (rp->part->cursor_mode) - BUF_APPENDF(I4"cursor_mode: \"BEFORE\";\n"); - if (rp->part->multiline) - BUF_APPEND(I4"multiline: 1;\n"); + if (rp->part->entry_mode) + BUF_APPENDF(I4 "entry_mode: \"%s\";\n", + entry_mode[rp->part->entry_mode]); + if (rp->part->select_mode) + BUF_APPENDF(I4 "select_mode: \"EXPLICIT\";\n"); + if (rp->part->cursor_mode) + BUF_APPENDF(I4 "cursor_mode: \"BEFORE\";\n"); + if (rp->part->multiline) + BUF_APPEND(I4 "multiline: 1;\n"); } } @@ -11324,12 +11410,12 @@ _edje_generate_source_of_part(Evas_Object *obj, Edje_Part *ep, Eina_Strbuf *buf) int effect = rp->part->effect; if (effect & EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION) { - BUF_APPENDF(I4"effect: %s %s;\n", + BUF_APPENDF(I4 "effect: %s %s;\n", effects[effect & ~EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION], shadow_direction[effect >> 4]); } else - BUF_APPENDF(I4"effect: %s;\n", + BUF_APPENDF(I4 "effect: %s;\n", effects[effect]); } @@ -11340,61 +11426,61 @@ _edje_generate_source_of_part(Evas_Object *obj, Edje_Part *ep, Eina_Strbuf *buf) if (ep->items_count != 0) { if (edje_edit_part_type_get(obj, part) == EDJE_PART_TYPE_BOX) - BUF_APPEND(I4"box {\n"); + BUF_APPEND(I4 "box {\n"); else - BUF_APPEND(I4"table {\n"); - BUF_APPEND(I5"items {\n"); + BUF_APPEND(I4 "table {\n"); + BUF_APPEND(I5 "items {\n"); for (i = 0; i < ep->items_count; ++i) { item = ep->items[i]; - BUF_APPEND(I6"item {\n"); - BUF_APPENDF(I7"type: %s;\n", types[item->type]); + BUF_APPEND(I6 "item {\n"); + BUF_APPENDF(I7 "type: %s;\n", types[item->type]); if (item->name) - BUF_APPENDF(I7"name: \"%s\";\n", item->name); + BUF_APPENDF(I7 "name: \"%s\";\n", item->name); if (item->source) - BUF_APPENDF(I7"source: \"%s\";\n", item->source); + BUF_APPENDF(I7 "source: \"%s\";\n", item->source); if ((item->min.w != 0) || (item->min.h != 0)) - BUF_APPENDF(I7"min: %d %d;\n", item->min.w, item->min.h); + BUF_APPENDF(I7 "min: %d %d;\n", item->min.w, item->min.h); if ((item->max.w != -1) || (item->max.h != -1)) - BUF_APPENDF(I7"max: %d %d;\n", item->max.w, item->max.h); + BUF_APPENDF(I7 "max: %d %d;\n", item->max.w, item->max.h); if (item->aspect.mode) - BUF_APPENDF(I7"aspect_mode: \"%s\";\n", aspect_mode[item->aspect.mode]); + BUF_APPENDF(I7 "aspect_mode: \"%s\";\n", aspect_mode[item->aspect.mode]); if ((item->aspect.w != 0) || (item->aspect.h != 0)) - BUF_APPENDF(I7"aspect: %d %d;\n", item->aspect.w, item->aspect.h); + BUF_APPENDF(I7 "aspect: %d %d;\n", item->aspect.w, item->aspect.h); if ((item->prefer.w != 0) || (item->prefer.h != 0)) - BUF_APPENDF(I7"prefer: %d %d;\n", item->prefer.w, item->prefer.h); + BUF_APPENDF(I7 "prefer: %d %d;\n", item->prefer.w, item->prefer.h); if ((item->spread.w != 1) || (item->spread.h != 1)) - BUF_APPENDF(I7"spread: %d %d;\n", item->spread.w, item->spread.h); + BUF_APPENDF(I7 "spread: %d %d;\n", item->spread.w, item->spread.h); if ((item->padding.l != 0) || (item->padding.t != 0) || (item->padding.r != 0) || (item->padding.b != 0)) - BUF_APPENDF(I7"padding: %d %d %d %d;\n", + BUF_APPENDF(I7 "padding: %d %d %d %d;\n", item->padding.l, item->padding.r, item->padding.t, item->padding.b); if ((item->weight.x != 0) || (item->weight.y != 0)) - _edje_source_with_double_values_append(I7"weight", 2, + _edje_source_with_double_values_append(I7 "weight", 2, TO_DOUBLE(item->weight.x), TO_DOUBLE(item->weight.y), buf, &ret); if (TO_DOUBLE(item->align.x) != 0.5 || TO_DOUBLE(item->align.y) != 0.5) - _edje_source_with_double_values_append(I7"align", 2, + _edje_source_with_double_values_append(I7 "align", 2, TO_DOUBLE(item->align.x), TO_DOUBLE(item->align.y), buf, &ret); if (edje_edit_part_type_get(obj, part) == EDJE_PART_TYPE_TABLE) - BUF_APPENDF(I7"position: %d %d;\n", item->col, item->row); + BUF_APPENDF(I7 "position: %d %d;\n", item->col, item->row); if ((item->colspan != 1) || (item->rowspan != 1)) - BUF_APPENDF(I7"span: %d %d;\n", item->colspan, item->rowspan); + BUF_APPENDF(I7 "span: %d %d;\n", item->colspan, item->rowspan); //TODO weight //TODO options //TODO col //TODO row - BUF_APPEND(I6"}\n"); + BUF_APPEND(I6 "}\n"); } - BUF_APPEND(I5"}\n"); - BUF_APPEND(I4"}\n"); + BUF_APPEND(I5 "}\n"); + BUF_APPEND(I4 "}\n"); } } @@ -11402,77 +11488,77 @@ _edje_generate_source_of_part(Evas_Object *obj, Edje_Part *ep, Eina_Strbuf *buf) str = edje_edit_part_drag_event_get(obj, part); if (rp->part->dragable.x || rp->part->dragable.y || str) { - BUF_APPEND(I4"dragable {\n"); + BUF_APPEND(I4 "dragable {\n"); if (str) { - BUF_APPENDF(I5"events: \"%s\";\n", str); + BUF_APPENDF(I5 "events: \"%s\";\n", str); edje_edit_string_free(str); } - if (rp->part->dragable.x || rp->part->dragable.y) - { - BUF_APPENDF(I5"x: %d %d %d;\n", - rp->part->dragable.x, - rp->part->dragable.step_x, - rp->part->dragable.count_x); - BUF_APPENDF(I5"y: %d %d %d;\n", - rp->part->dragable.y, - rp->part->dragable.step_y, - rp->part->dragable.count_y); - if ((str = edje_edit_part_drag_confine_get(obj, part))) + if (rp->part->dragable.x || rp->part->dragable.y) + { + BUF_APPENDF(I5 "x: %d %d %d;\n", + rp->part->dragable.x, + rp->part->dragable.step_x, + rp->part->dragable.count_x); + BUF_APPENDF(I5 "y: %d %d %d;\n", + rp->part->dragable.y, + rp->part->dragable.step_y, + rp->part->dragable.count_y); + if ((str = edje_edit_part_drag_confine_get(obj, part))) { - BUF_APPENDF(I5"confine: \"%s\";\n", str); - edje_edit_string_free(str); + BUF_APPENDF(I5 "confine: \"%s\";\n", str); + edje_edit_string_free(str); } - if ((str = edje_edit_part_drag_threshold_get(obj, part))) + if ((str = edje_edit_part_drag_threshold_get(obj, part))) { - BUF_APPENDF(I5"threshold: \"%s\";\n", str); - edje_edit_string_free(str); + BUF_APPENDF(I5 "threshold: \"%s\";\n", str); + edje_edit_string_free(str); } - } - BUF_APPEND(I4"}\n"); + } + BUF_APPEND(I4 "}\n"); } //Descriptions ll = edje_edit_part_states_list_get(obj, part); EINA_LIST_FOREACH(ll, l, data) { - char state[512], *delim; - double value; - strncpy(state, data, sizeof(state) - 1); /* if we go over it, too bad.. the list of states may need to change to provide name and value separated */ + char state[512], *delim; + double value; + strncpy(state, data, sizeof(state) - 1); /* if we go over it, too bad.. the list of states may need to change to provide name and value separated */ delim = strchr(state, ' '); if (!delim) continue; - *delim = '\0'; - delim++; - value = strtod(delim, NULL); - ret &= _edje_generate_source_of_state(obj, part, state, value, buf); + *delim = '\0'; + delim++; + value = strtod(delim, NULL); + ret &= _edje_generate_source_of_state(obj, part, state, value, buf); } edje_edit_string_list_free(ll); api_name = eina_stringshare_add(rp->part->api.name); - api_description =eina_stringshare_add(rp->part->api.description); + api_description = eina_stringshare_add(rp->part->api.description); if (api_name || api_description) { if (api_name && api_description) - { - BUF_APPENDF(I4"api: \"%s\" \"%s\";\n", api_name, api_description); - eina_stringshare_del(api_name); - eina_stringshare_del(api_description); - } - else - if (api_name) - { - BUF_APPENDF(I4"api: \"%s\" \"\";\n", api_name); - eina_stringshare_del(api_name); - } - else - { - BUF_APPENDF(I4"api: \"\" \"%s\";\n", api_description); - eina_stringshare_del(api_description); - } + { + BUF_APPENDF(I4 "api: \"%s\" \"%s\";\n", api_name, api_description); + eina_stringshare_del(api_name); + eina_stringshare_del(api_description); + } + else + if (api_name) + { + BUF_APPENDF(I4 "api: \"%s\" \"\";\n", api_name); + eina_stringshare_del(api_name); + } + else + { + BUF_APPENDF(I4 "api: \"\" \"%s\";\n", api_description); + eina_stringshare_del(api_description); + } } - BUF_APPEND(I3"}\n");//part + BUF_APPEND(I3 "}\n"); //part return ret; } @@ -11483,48 +11569,51 @@ _edje_generate_source_of_sounds(Edje_Sound_Directory *sound_directory, Eina_Strb Eina_Bool ret = EINA_TRUE; Edje_Sound_Sample *current_sample = sound_directory->samples; Edje_Sound_Tone *current_tone = sound_directory->tones; - BUF_APPEND(I1"sounds {\n"); - + BUF_APPEND(I1 "sounds {\n"); for (i = 0; i < sound_directory->samples_count; i++, current_sample++) { - BUF_APPEND(I2"sample {\n"); - BUF_APPENDF(I3"name: \"%s\" ", current_sample->name); + BUF_APPEND(I2 "sample {\n"); + BUF_APPENDF(I3 "name: \"%s\" ", current_sample->name); switch (current_sample->compression) { case EDJE_SOUND_SOURCE_TYPE_INLINE_RAW: - { - BUF_APPEND("RAW;\n"); - break; - } + { + BUF_APPEND("RAW;\n"); + break; + } + case EDJE_SOUND_SOURCE_TYPE_INLINE_COMP: - { - BUF_APPEND("COMP;\n"); - break; - } + { + BUF_APPEND("COMP;\n"); + break; + } + case EDJE_SOUND_SOURCE_TYPE_INLINE_LOSSY: - { - BUF_APPENDF("LOSSY %f;\n", current_sample->quality); - break; - } + { + BUF_APPENDF("LOSSY %f;\n", current_sample->quality); + break; + } + case EDJE_SOUND_SOURCE_TYPE_INLINE_AS_IS: - { - BUF_APPEND("AS_IS;\n"); - break; - } + { + BUF_APPEND("AS_IS;\n"); + break; + } + default: break; } - BUF_APPENDF(I3"source: \"%s\";\n", current_sample->snd_src); - BUF_APPEND(I2"}\n"); + BUF_APPENDF(I3 "source: \"%s\";\n", current_sample->snd_src); + BUF_APPEND(I2 "}\n"); } - for (i = 0; i < sound_directory->tones_count ; i++, current_tone++) + for (i = 0; i < sound_directory->tones_count; i++, current_tone++) { - BUF_APPEND(I2"tone: "); + BUF_APPEND(I2 "tone: "); BUF_APPENDF("\"%s\" %d;\n", current_tone->name, current_tone->value); } - BUF_APPEND(I1"}\n"); + BUF_APPEND(I1 "}\n"); } static void @@ -11536,18 +11625,18 @@ _edje_limits_source_generate(const Edje *ed, Eina_Strbuf *buf, Eina_Bool *res) if (!ed->collection->limits.vertical_count && !ed->collection->limits.horizontal_count) return; - BUF_APPEND(I2"limits {\n"); + BUF_APPEND(I2 "limits {\n"); - for(i = 0; i < ed->collection->limits.vertical_count; i++) - BUF_APPENDF(I3"vertical: \"%s\" %d;\n", + for (i = 0; i < ed->collection->limits.vertical_count; i++) + BUF_APPENDF(I3 "vertical: \"%s\" %d;\n", ed->collection->limits.vertical[i]->name, ed->collection->limits.vertical[i]->value); - for(i = 0; i < ed->collection->limits.horizontal_count; i++) - BUF_APPENDF(I3"horizontal: \"%s\" %d;\n", + for (i = 0; i < ed->collection->limits.horizontal_count; i++) + BUF_APPENDF(I3 "horizontal: \"%s\" %d;\n", ed->collection->limits.horizontal[i]->name, ed->collection->limits.horizontal[i]->value); - BUF_APPEND(I2"}\n"); + BUF_APPEND(I2 "}\n"); *res = ret; } @@ -11570,7 +11659,7 @@ _edje_generate_source_of_group(Edje *ed, Edje_Part_Collection_Directory_Entry *p Eina_Iterator *it; int len; char *tmp_alias; - const char* aliased; + const char *aliased; obj = edje_edit_object_add(ed->base->evas); if (!edje_object_file_set(obj, ed->file->path, group)) return EINA_FALSE; @@ -11586,35 +11675,37 @@ _edje_generate_source_of_group(Edje *ed, Edje_Part_Collection_Directory_Entry *p pc = eed->base->collection; alias_list = edje_edit_group_aliases_get(obj, group); - BUF_APPENDF(I1"group { name: \"%s\";\n", group); + BUF_APPENDF(I1 "group { name: \"%s\";\n", group); EINA_LIST_FOREACH(alias_list, l, data) - BUF_APPENDF(I2"alias: \"%s\";\n", data); + BUF_APPENDF(I2 "alias: \"%s\";\n", data); edje_edit_string_list_free(alias_list); w = edje_edit_group_min_w_get(obj); h = edje_edit_group_min_h_get(obj); if ((w > 0) || (h > 0)) - BUF_APPENDF(I2"min: %d %d;\n", w, h); + BUF_APPENDF(I2 "min: %d %d;\n", w, h); w = edje_edit_group_max_w_get(obj); h = edje_edit_group_max_h_get(obj); if ((w > 0) || (h > 0)) - BUF_APPENDF(I2"max: %d %d;\n", w, h); + BUF_APPENDF(I2 "max: %d %d;\n", w, h); orient = edje_edit_group_orientation_get(obj); - switch(orient) + switch (orient) { - case(EDJE_ORIENTATION_LTR): - BUF_APPENDF(I2"orientation: LTR;\n"); - break; - case(EDJE_ORIENTATION_RTL): - BUF_APPENDF(I2"orientation: RTL;\n"); - break; - case(EDJE_ORIENTATION_AUTO): + case (EDJE_ORIENTATION_LTR): + BUF_APPENDF(I2 "orientation: LTR;\n"); + break; + + case (EDJE_ORIENTATION_RTL): + BUF_APPENDF(I2 "orientation: RTL;\n"); + break; + + case (EDJE_ORIENTATION_AUTO): default: - break; + break; } broadcast = edje_edit_group_broadcast_signal_get(obj); - if (!broadcast) BUF_APPENDF(I2"broadcast_signal: %d;\n", broadcast); + if (!broadcast) BUF_APPENDF(I2 "broadcast_signal: %d;\n", broadcast); /* Limits */ _edje_limits_source_generate(ed, buf, &ret); @@ -11623,7 +11714,7 @@ _edje_generate_source_of_group(Edje *ed, Edje_Part_Collection_Directory_Entry *p if (pc->data) { Eina_Hash_Tuple *tuple; - BUF_APPEND(I2"data {\n"); + BUF_APPEND(I2 "data {\n"); it = eina_hash_iterator_tuple_new(pc->data); @@ -11634,22 +11725,22 @@ _edje_generate_source_of_group(Edje *ed, Edje_Part_Collection_Directory_Entry *p } EINA_ITERATOR_FOREACH(it, tuple) - BUF_APPENDF(I3"item: \"%s\" \"%s\";\n", (char *)tuple->key, - edje_string_get(tuple->data)); + BUF_APPENDF(I3 "item: \"%s\" \"%s\";\n", (char *)tuple->key, + edje_string_get(tuple->data)); eina_iterator_free(it); - BUF_APPEND(I2"}\n"); + BUF_APPEND(I2 "}\n"); } if (eed->embryo_source) { - BUF_APPEND(I2"script {\n"); + BUF_APPEND(I2 "script {\n"); BUF_APPEND(eed->embryo_source); - BUF_APPEND(I2"}\n"); + BUF_APPEND(I2 "}\n"); } /* Parts */ - BUF_APPEND(I2"parts {\n"); + BUF_APPEND(I2 "parts {\n"); if ((pc->aliased) && (pc->alias)) { it = eina_hash_iterator_data_new(pc->alias); @@ -11657,7 +11748,7 @@ _edje_generate_source_of_group(Edje *ed, Edje_Part_Collection_Directory_Entry *p { tmp_alias = strdup(alias); aliased = _edje_find_alias(pc->aliased, tmp_alias, &len); - BUF_APPENDF(I3"alias: \"%s\" \"%s\";\n", aliased, alias); + BUF_APPENDF(I3 "alias: \"%s\" \"%s\";\n", aliased, alias); free(tmp_alias); } eina_iterator_free(it); @@ -11668,7 +11759,7 @@ _edje_generate_source_of_group(Edje *ed, Edje_Part_Collection_Directory_Entry *p ep = pc->parts[i]; ret &= _edje_generate_source_of_part(obj, ep, buf); } - BUF_APPEND(I2"}\n");//parts + BUF_APPEND(I2 "}\n"); //parts if (!ret) { @@ -11679,13 +11770,13 @@ _edje_generate_source_of_group(Edje *ed, Edje_Part_Collection_Directory_Entry *p /* Programs */ if ((ll = edje_edit_programs_list_get(obj))) { - BUF_APPEND(I2 "programs {\n"); - EINA_LIST_FOREACH(ll, l, data) - ret &= _edje_generate_source_of_program(obj, data, buf); - BUF_APPEND(I2 "}\n"); - edje_edit_string_list_free(ll); + BUF_APPEND(I2 "programs {\n"); + EINA_LIST_FOREACH(ll, l, data) + ret &= _edje_generate_source_of_program(obj, data, buf); + BUF_APPEND(I2 "}\n"); + edje_edit_string_list_free(ll); } - BUF_APPEND(I1"}\n");//group + BUF_APPEND(I1 "}\n"); //group if (!ret) { @@ -11699,7 +11790,7 @@ _edje_generate_source_of_group(Edje *ed, Edje_Part_Collection_Directory_Entry *p return ret; } -static Eina_Strbuf* +static Eina_Strbuf * _edje_generate_source(Evas_Object *obj) { Eina_Strbuf *buf; @@ -11723,25 +11814,25 @@ _edje_generate_source(Evas_Object *obj) /* Images */ if ((ll = edje_edit_images_list_get(obj))) { - BUF_APPEND(I0"images {\n"); + BUF_APPEND(I0 "images {\n"); - EINA_LIST_FOREACH(ll, l, entry) - { + EINA_LIST_FOREACH(ll, l, entry) + { Eina_Strbuf *gen_buf = _edje_generate_image_source(obj, entry); - if (!gen_buf) continue; + if (!gen_buf) continue; - BUF_APPENDF(I1"%s", eina_strbuf_string_get(gen_buf)); + BUF_APPENDF(I1 "%s", eina_strbuf_string_get(gen_buf)); eina_strbuf_free(gen_buf); } - BUF_APPEND(I0"}\n\n"); - edje_edit_string_list_free(ll); + BUF_APPEND(I0 "}\n\n"); + edje_edit_string_list_free(ll); - if (!ret) - { - ERR("Generating EDC for Images"); - eina_strbuf_free(buf); - return NULL; - } + if (!ret) + { + ERR("Generating EDC for Images"); + eina_strbuf_free(buf); + return NULL; + } } /* Fonts */ @@ -11752,13 +11843,13 @@ _edje_generate_source(Evas_Object *obj) it = eina_hash_iterator_data_new(ed->file->fonts); if (it) { - BUF_APPEND(I0"fonts {\n"); + BUF_APPEND(I0 "fonts {\n"); EINA_ITERATOR_FOREACH(it, fnt) - BUF_APPENDF(I1"font: \"%s\" \"%s\";\n", fnt->file, - fnt->entry); + BUF_APPENDF(I1 "font: \"%s\" \"%s\";\n", fnt->file, + fnt->entry); - BUF_APPEND(I0"}\n\n"); + BUF_APPEND(I0 "}\n\n"); eina_iterator_free(it); if (!ret) @@ -11773,57 +11864,57 @@ _edje_generate_source(Evas_Object *obj) /* Data */ if ((ll = edje_edit_data_list_get(obj))) { - BUF_APPEND(I0 "data {\n"); + BUF_APPEND(I0 "data {\n"); - EINA_LIST_FOREACH(ll, l, entry) + EINA_LIST_FOREACH(ll, l, entry) BUF_APPENDF(I1 "item: \"%s\" \"%s\";\n", entry, - edje_edit_data_value_get(obj, entry)); + edje_edit_data_value_get(obj, entry)); - BUF_APPEND(I0 "}\n\n"); - edje_edit_string_list_free(ll); + BUF_APPEND(I0 "}\n\n"); + edje_edit_string_list_free(ll); - if (!ret) - { - ERR("Generating EDC for Data"); - eina_strbuf_free(buf); - return NULL; - } + if (!ret) + { + ERR("Generating EDC for Data"); + eina_strbuf_free(buf); + return NULL; + } } /* Color Classes */ if ((ll = edje_edit_color_classes_list_get(obj))) { - BUF_APPEND(I0 "color_classes {\n"); + BUF_APPEND(I0 "color_classes {\n"); - EINA_LIST_FOREACH(ll, l, entry) - _edje_generate_source_of_colorclass(ed, entry, buf); + EINA_LIST_FOREACH(ll, l, entry) + _edje_generate_source_of_colorclass(ed, entry, buf); - BUF_APPEND(I0 "}\n\n"); - edje_edit_string_list_free(ll); + BUF_APPEND(I0 "}\n\n"); + edje_edit_string_list_free(ll); - if (!ret) - { - ERR("Generating EDC for Color Classes"); - eina_strbuf_free(buf); - return NULL; - } + if (!ret) + { + ERR("Generating EDC for Color Classes"); + eina_strbuf_free(buf); + return NULL; + } } /* Styles */ if ((ll = edje_edit_styles_list_get(obj))) { - BUF_APPEND(I0 "styles {\n"); - EINA_LIST_FOREACH(ll, l, entry) - _edje_generate_source_of_style(ed, entry, buf); - BUF_APPEND(I0 "}\n\n"); - edje_edit_string_list_free(ll); + BUF_APPEND(I0 "styles {\n"); + EINA_LIST_FOREACH(ll, l, entry) + _edje_generate_source_of_style(ed, entry, buf); + BUF_APPEND(I0 "}\n\n"); + edje_edit_string_list_free(ll); - if (!ret) - { - ERR("Generating EDC for Styles"); - eina_strbuf_free(buf); - return NULL; - } + if (!ret) + { + ERR("Generating EDC for Styles"); + eina_strbuf_free(buf); + return NULL; + } } /* Externals */ @@ -11831,7 +11922,7 @@ _edje_generate_source(Evas_Object *obj) { BUF_APPEND(I0 "externals {\n"); EINA_LIST_FOREACH(ll, l, entry) - BUF_APPENDF(I1 "external: \"%s\";\n", entry); + BUF_APPENDF(I1 "external: \"%s\";\n", entry); BUF_APPEND(I0 "}\n\n"); edje_edit_string_list_free(ll); @@ -11889,17 +11980,16 @@ edje_edit_full_source_generate(Evas_Object *obj) return ret; } - /*********************/ /* SAVING ROUTINES */ /*********************/ //////////////////////////////////////// -typedef struct _SrcFile SrcFile; -typedef struct _SrcFile_List SrcFile_List; +typedef struct _SrcFile SrcFile; +typedef struct _SrcFile_List SrcFile_List; struct _SrcFile { - char *name; + char *name; const char *file; }; @@ -11927,6 +12017,7 @@ source_edd(void) _srcfile_list_edd = eet_data_descriptor_stream_new(&eddc); EET_DATA_DESCRIPTOR_ADD_LIST(_srcfile_list_edd, SrcFile_List, "list", list, _srcfile_edd); } + ///////////////////////////////////////// static Eina_Bool @@ -11936,8 +12027,8 @@ _edje_edit_edje_file_save(Eet_File *eetf, Edje_File *ef) INF("** Writing Edje_File* ed->file"); if (eet_data_write(eetf, _edje_edd_edje_file, "edje/file", ef, 1) <= 0) { - ERR("Error. unable to write \"edje_file\" entry to \"%s\"", ef->path); - return EINA_FALSE; + ERR("Error. unable to write \"edje_file\" entry to \"%s\"", ef->path); + return EINA_FALSE; } return EINA_TRUE; } @@ -11967,23 +12058,23 @@ _edje_edit_source_save(Eet_File *eetf, Evas_Object *obj) source_file = _edje_generate_source(obj); if (!source_file) { - ERR("Can't create edc source"); - return EINA_FALSE; + ERR("Can't create edc source"); + return EINA_FALSE; } //open the temp file and put the contents in SrcFile sf = _alloc(sizeof(SrcFile)); if (!sf) { - ERR("Unable to create source file struct"); - ret = EINA_FALSE; + ERR("Unable to create source file struct"); + ret = EINA_FALSE; goto save_free_source; } sf->name = strdup("generated_source.edc"); if (!sf->name) { - ERR("Unable to alloc filename"); - ret = EINA_FALSE; + ERR("Unable to alloc filename"); + ret = EINA_FALSE; goto save_free_sf; } @@ -11993,26 +12084,26 @@ _edje_edit_source_save(Eet_File *eetf, Evas_Object *obj) sfl = _alloc(sizeof(SrcFile_List)); if (!sfl) { - ERR("Unable to create file list"); - ret = EINA_FALSE; + ERR("Unable to create file list"); + ret = EINA_FALSE; goto save_free_filename; } sfl->list = NULL; sfl->list = eina_list_append(sfl->list, sf); if (!sfl->list) { - ERR("Error. unable to append file in list"); - ret = EINA_FALSE; + ERR("Error. unable to append file in list"); + ret = EINA_FALSE; goto save_free_sfl; } // write the sources list to the eet file source_edd(); if (eet_data_write(eetf, _srcfile_list_edd, "edje_sources", sfl, 1) <= 0) - { - ERR("Unable to write edc source"); - ret = EINA_FALSE; - } + { + ERR("Unable to write edc source"); + ret = EINA_FALSE; + } /* Clear stuff */ eina_list_free(sfl->list); @@ -12046,9 +12137,9 @@ _edje_edit_internal_save(Evas_Object *obj, int current_only, Eina_Bool generate_ eetf = eet_open(ef->path, EET_FILE_MODE_READ_WRITE); if (!eetf) { - ERR("Error. unable to open \"%s\" for writing output", - ef->path); - return EINA_FALSE; + ERR("Error. unable to open \"%s\" for writing output", + ef->path); + return EINA_FALSE; } /* Set compiler name */ @@ -12057,58 +12148,58 @@ _edje_edit_internal_save(Evas_Object *obj, int current_only, Eina_Bool generate_ if (!_edje_edit_edje_file_save(eetf, ef)) { - eet_close(eetf); - return EINA_FALSE; + eet_close(eetf); + return EINA_FALSE; } if (current_only) { - if (ed->collection) - { - INF("** Writing Edje_Part_Collection* ed->collection " - "[id: %d]", ed->collection->id); - if (!_edje_edit_collection_save(eetf, ed->collection)) - { - eet_close(eetf); - return EINA_FALSE; - } - } + if (ed->collection) + { + INF("** Writing Edje_Part_Collection* ed->collection " + "[id: %d]", ed->collection->id); + if (!_edje_edit_collection_save(eetf, ed->collection)) + { + eet_close(eetf); + return EINA_FALSE; + } + } } else { - Eina_List *l; - Edje_Part_Collection *edc; - Edje_Part_Collection_Directory_Entry *ce; + Eina_List *l; + Edje_Part_Collection *edc; + Edje_Part_Collection_Directory_Entry *ce; Eina_Iterator *it; - INF("** Writing all collections"); + INF("** Writing all collections"); - it = eina_hash_iterator_data_new(ef->collection); + it = eina_hash_iterator_data_new(ef->collection); while (eina_iterator_next(it, (void **)&ce)) - { - if (ce->ref) - { - INF("** Writing hash Edje_Part_Collection* ed->collection " - "[id: %d]", ce->id); - if(!_edje_edit_collection_save(eetf, ce->ref)) - { - eet_close(eetf); - return EINA_FALSE; - } - } - } - eina_iterator_free(it); + { + if (ce->ref) + { + INF("** Writing hash Edje_Part_Collection* ed->collection " + "[id: %d]", ce->id); + if (!_edje_edit_collection_save(eetf, ce->ref)) + { + eet_close(eetf); + return EINA_FALSE; + } + } + } + eina_iterator_free(it); - EINA_LIST_FOREACH(ef->collection_cache, l, edc) - { - INF("** Writing cache Edje_Part_Collection* ed->collection " - "[id: %d]", edc->id); - if(!_edje_edit_collection_save(eetf, edc)) - { - eet_close(eetf); - return EINA_FALSE; - } - } + EINA_LIST_FOREACH(ef->collection_cache, l, edc) + { + INF("** Writing cache Edje_Part_Collection* ed->collection " + "[id: %d]", edc->id); + if (!_edje_edit_collection_save(eetf, edc)) + { + eet_close(eetf); + return EINA_FALSE; + } + } } if ((eed->bytecode_dirty || eed->script_need_recompile) && ed->collection) @@ -12159,7 +12250,7 @@ _edje_edit_internal_save(Evas_Object *obj, int current_only, Eina_Bool generate_ eina_iterator_free(it); EINA_LIST_FREE(deathnote, ps) - eina_hash_del(eed->program_scripts, &ps->id, ps); + eina_hash_del(eed->program_scripts, &ps->id, ps); } if (generate_source) @@ -12167,16 +12258,16 @@ _edje_edit_internal_save(Evas_Object *obj, int current_only, Eina_Bool generate_ { eet_close(eetf); return EINA_FALSE; - } + } eet_close(eetf); /* Update mtime */ { - struct stat st; - if (stat(ed->path, &st) != 0) - return EINA_FALSE; - ef->mtime = st.st_mtime; + struct stat st; + if (stat(ed->path, &st) != 0) + return EINA_FALSE; + ef->mtime = st.st_mtime; } INF("*********** Saving DONE ******************"); @@ -12184,7 +12275,7 @@ _edje_edit_internal_save(Evas_Object *obj, int current_only, Eina_Bool generate_ } EAPI Eina_Bool -edje_edit_clean_save_as(Evas_Object *obj, const char* new_file_name) +edje_edit_clean_save_as(Evas_Object *obj, const char *new_file_name) { Eet_File *ef, *ef_out; GET_ED_OR_RETURN(EINA_FALSE); @@ -12226,7 +12317,7 @@ edje_edit_clean_save_as(Evas_Object *obj, const char* new_file_name) char **ent; int i; int size = 0; - const void * data; + const void *data; ent = eet_list(ef, "*", &count); if (ent) @@ -12314,12 +12405,12 @@ edje_edit_without_source_save(Evas_Object *obj, Eina_Bool current_group) } source_edd(); if (eet_data_write(eetf, _srcfile_list_edd, "edje_sources", sfl, 1) <= 0) - { - ERR("Unable to clean edc source from edj file"); - free(sfl); - eet_close(eetf); - return EINA_FALSE; - } + { + ERR("Unable to clean edc source from edj file"); + free(sfl); + eet_close(eetf); + return EINA_FALSE; + } free(sfl); eet_close(eetf); @@ -12329,15 +12420,15 @@ edje_edit_without_source_save(Evas_Object *obj, Eina_Bool current_group) EAPI void edje_edit_print_internal_status(Evas_Object *obj) { -/* +/* Edje_Program *epr; unsigned int i; int j; -*/ + */ Eina_Strbuf *source_file; GET_EED_OR_RETURN(); - source_file =_edje_generate_source(obj); + source_file = _edje_generate_source(obj); if (source_file) eina_strbuf_free(source_file); /* INF("****** CHECKIN' INTERNAL STRUCTS STATUS *********"); @@ -12349,17 +12440,17 @@ edje_edit_print_internal_status(Evas_Object *obj) ed->collection->parts_count); for (i = 0; i < ed->collection->parts_count; ++i) { - Edje_Real_Part *rp; - Edje_Part *p; + Edje_Real_Part *rp; + Edje_Part *p; - p = ed->collection->parts[i]; + p = ed->collection->parts[i]; - rp = ed->table_parts[p->id % ed->table_parts_size]; - printf("part[%d]: '%s' ", p->id, p->name); - if (p == rp->part) - printf("OK!\n"); - else - printf("WRONG (table[%d]->name = '%s')\n", p->id, rp->part->name); + rp = ed->table_parts[p->id % ed->table_parts_size]; + printf("part[%d]: '%s' ", p->id, p->name); + if (p == rp->part) + printf("OK!\n"); + else + printf("WRONG (table[%d]->name = '%s')\n", p->id, rp->part->name); } INF("Programs [table:%d list:%d,%d,%d,%d,%d]", ed->table_programs_size, @@ -12370,8 +12461,8 @@ edje_edit_print_internal_status(Evas_Object *obj) ed->collection->programs.nocmp_count); for(j = 0; j < ed->table_programs_size; ++j) { - epr = ed->table_programs[i % ed->table_programs_size]; - printf("program[%d]: '%s'\n", epr->id, epr->name); + epr = ed->table_programs[i % ed->table_programs_size]; + printf("program[%d]: '%s'\n", epr->id, epr->name); } INF("****************** END ************************"); diff --git a/src/lib/edje/edje_embryo.c b/src/lib/edje/edje_embryo.c index 72480a8d89..f3a740057b 100644 --- a/src/lib/edje/edje_embryo.c +++ b/src/lib/edje/edje_embryo.c @@ -284,7 +284,7 @@ _edje_embryo_fn_get_str(Embryo_Program *ep, Embryo_Cell *params) s = (char *)_edje_var_str_get(ed, (int)params[1]); if (s) { - if ((int) strlen(s) < params[3]) + if ((int)strlen(s) < params[3]) { SETSTR(s, params[2]); } @@ -347,7 +347,7 @@ _edje_embryo_fn_count(Embryo_Program *ep, Embryo_Cell *params) CHKPARAM(1); - return (Embryo_Cell)_edje_var_list_count_get(ed, (int) params[1]); + return (Embryo_Cell)_edje_var_list_count_get(ed, (int)params[1]); } /* remove(id, n) */ @@ -358,7 +358,7 @@ _edje_embryo_fn_remove(Embryo_Program *ep, Embryo_Cell *params) CHKPARAM(2); - _edje_var_list_remove_nth(ed, (int) params[1], (int) params[2]); + _edje_var_list_remove_nth(ed, (int)params[1], (int)params[2]); return 0; } @@ -371,7 +371,7 @@ _edje_embryo_fn_append_int(Embryo_Program *ep, Embryo_Cell *params) CHKPARAM(2); - _edje_var_list_int_append(ed, (int) params[1], (int) params[2]); + _edje_var_list_int_append(ed, (int)params[1], (int)params[2]); return 0; } @@ -384,7 +384,7 @@ _edje_embryo_fn_prepend_int(Embryo_Program *ep, Embryo_Cell *params) CHKPARAM(2); - _edje_var_list_int_prepend(ed, (int) params[1], (int) params[2]); + _edje_var_list_int_prepend(ed, (int)params[1], (int)params[2]); return 0; } @@ -397,8 +397,8 @@ _edje_embryo_fn_insert_int(Embryo_Program *ep, Embryo_Cell *params) CHKPARAM(3); - _edje_var_list_int_insert(ed, (int) params[1], (int) params[2], - (int) params[3]); + _edje_var_list_int_insert(ed, (int)params[1], (int)params[2], + (int)params[3]); return 0; } @@ -411,8 +411,8 @@ _edje_embryo_fn_replace_int(Embryo_Program *ep, Embryo_Cell *params) CHKPARAM(3); - _edje_var_list_nth_int_set(ed, (int) params[1], (int) params[2], - (int) params[3]); + _edje_var_list_nth_int_set(ed, (int)params[1], (int)params[2], + (int)params[3]); return 0; } @@ -425,8 +425,8 @@ _edje_embryo_fn_fetch_int(Embryo_Program *ep, Embryo_Cell *params) CHKPARAM(2); - return _edje_var_list_nth_int_get(ed, (int) params[1], - (int) params[2]); + return _edje_var_list_nth_int_get(ed, (int)params[1], + (int)params[2]); } /* append_str(id, str[]) */ @@ -440,7 +440,7 @@ _edje_embryo_fn_append_str(Embryo_Program *ep, Embryo_Cell *params) GETSTR(s, params[2]); if (s) - _edje_var_list_str_append(ed, (int) params[1], s); + _edje_var_list_str_append(ed, (int)params[1], s); return 0; } @@ -456,7 +456,7 @@ _edje_embryo_fn_prepend_str(Embryo_Program *ep, Embryo_Cell *params) GETSTR(s, params[2]); if (s) - _edje_var_list_str_prepend(ed, (int) params[1], s); + _edje_var_list_str_prepend(ed, (int)params[1], s); return 0; } @@ -472,7 +472,7 @@ _edje_embryo_fn_insert_str(Embryo_Program *ep, Embryo_Cell *params) GETSTR(s, params[3]); if (s) - _edje_var_list_str_insert(ed, (int) params[1], (int) params[2], s); + _edje_var_list_str_insert(ed, (int)params[1], (int)params[2], s); return 0; } @@ -488,12 +488,11 @@ _edje_embryo_fn_replace_str(Embryo_Program *ep, Embryo_Cell *params) GETSTR(s, params[3]); if (s) - _edje_var_list_nth_str_set(ed, (int) params[1], (int) params[2], s); + _edje_var_list_nth_str_set(ed, (int)params[1], (int)params[2], s); return 0; } - /* fetch_str(id, pos, dst[], maxlen) */ static Embryo_Cell _edje_embryo_fn_fetch_str(Embryo_Program *ep, Embryo_Cell *params) @@ -503,11 +502,11 @@ _edje_embryo_fn_fetch_str(Embryo_Program *ep, Embryo_Cell *params) CHKPARAM(4); - s = (char *) _edje_var_list_nth_str_get(ed, (int) params[1], - (int) params[2]); + s = (char *)_edje_var_list_nth_str_get(ed, (int)params[1], + (int)params[2]); if (s) { - if ((int) strlen(s) < params[4]) + if ((int)strlen(s) < params[4]) { SETSTR(s, params[3]); } @@ -539,7 +538,7 @@ _edje_embryo_fn_append_float(Embryo_Program *ep, Embryo_Cell *params) CHKPARAM(2); f = EMBRYO_CELL_TO_FLOAT(params[2]); - _edje_var_list_float_append(ed, (int) params[1], f); + _edje_var_list_float_append(ed, (int)params[1], f); return 0; } @@ -554,7 +553,7 @@ _edje_embryo_fn_prepend_float(Embryo_Program *ep, Embryo_Cell *params) CHKPARAM(2); f = EMBRYO_CELL_TO_FLOAT(params[2]); - _edje_var_list_float_prepend(ed, (int) params[1], f); + _edje_var_list_float_prepend(ed, (int)params[1], f); return 0; } @@ -569,7 +568,7 @@ _edje_embryo_fn_insert_float(Embryo_Program *ep, Embryo_Cell *params) CHKPARAM(3); f = EMBRYO_CELL_TO_FLOAT(params[3]); - _edje_var_list_float_insert(ed, (int) params[1], (int) params[2], f); + _edje_var_list_float_insert(ed, (int)params[1], (int)params[2], f); return 0; } @@ -582,7 +581,7 @@ _edje_embryo_fn_replace_float(Embryo_Program *ep, Embryo_Cell *params) CHKPARAM(3); - _edje_var_list_nth_float_set(ed, (int) params[1], (int) params[2], + _edje_var_list_nth_float_set(ed, (int)params[1], (int)params[2], EMBRYO_CELL_TO_FLOAT(params[3])); return 0; @@ -597,7 +596,7 @@ _edje_embryo_fn_fetch_float(Embryo_Program *ep, Embryo_Cell *params) CHKPARAM(2); - f = _edje_var_list_nth_float_get(ed, (int) params[1], (int) params[2]); + f = _edje_var_list_nth_float_get(ed, (int)params[1], (int)params[2]); return EMBRYO_FLOAT_TO_CELL(f); } @@ -701,7 +700,7 @@ _edje_embryo_fn_get_anim_pos_map(Embryo_Program *ep, Embryo_Cell *params) v1 = EMBRYO_CELL_TO_FLOAT(params[3]); v2 = EMBRYO_CELL_TO_FLOAT(params[4]); - switch(tween) + switch (tween) { case ECORE_POS_MAP_LINEAR: case ECORE_POS_MAP_ACCELERATE: @@ -709,23 +708,28 @@ _edje_embryo_fn_get_anim_pos_map(Embryo_Program *ep, Embryo_Cell *params) case ECORE_POS_MAP_SINUSOIDAL: pos = ecore_animator_pos_map(pos, tween, 0, 0); break; + case ECORE_POS_MAP_ACCELERATE_FACTOR: pos = ecore_animator_pos_map(pos, ECORE_POS_MAP_ACCELERATE_FACTOR, v1, 0); break; + case ECORE_POS_MAP_DECELERATE_FACTOR: pos = ecore_animator_pos_map(pos, ECORE_POS_MAP_DECELERATE_FACTOR, v1, 0); break; + case ECORE_POS_MAP_SINUSOIDAL_FACTOR: pos = ecore_animator_pos_map(pos, ECORE_POS_MAP_SINUSOIDAL_FACTOR, v1, 0); break; + case ECORE_POS_MAP_DIVISOR_INTERP: case ECORE_POS_MAP_BOUNCE: case ECORE_POS_MAP_SPRING: pos = ecore_animator_pos_map(pos, tween, v1, v2); break; + default: break; } @@ -739,7 +743,7 @@ _edje_embryo_fn_get_anim_pos_map(Embryo_Program *ep, Embryo_Cell *params) static Embryo_Cell _edje_embryo_fn_set_min_size(Embryo_Program *ep, Embryo_Cell *params) { - Edje *ed; + Edje *ed; float f = 0.0; double w = 0.0, h = 0.0; @@ -974,13 +978,13 @@ _edje_embryo_fn_play_sample(Embryo_Program *ep, Embryo_Cell *params) float speed = 1.0; int channel = 0; - if (params[0] < (int) (sizeof(Embryo_Cell) * 2)) + if (params[0] < (int)(sizeof(Embryo_Cell) * 2)) return 0; ed = embryo_program_data_get(ep); GETSTR(sample_name, params[1]); if ((!sample_name)) return 0; speed = EMBRYO_CELL_TO_FLOAT(params[2]); - if (params[0] == (int) (sizeof(Embryo_Cell) * 3)) + if (params[0] == (int)(sizeof(Embryo_Cell) * 3)) GETINT(channel, params[3]); _edje_multisense_internal_sound_sample_play(ed, sample_name, (double)speed, channel); @@ -995,13 +999,13 @@ _edje_embryo_fn_play_tone(Embryo_Program *ep, Embryo_Cell *params) float duration = 0.1; int channel = 0; - if (params[0] < (int) (sizeof(Embryo_Cell) * 2)) + if (params[0] < (int)(sizeof(Embryo_Cell) * 2)) return 0; ed = embryo_program_data_get(ep); GETSTR(tone_name, params[1]); if ((!tone_name)) return 0; duration = EMBRYO_CELL_TO_FLOAT(params[2]); - if (params[0] == (int) (sizeof(Embryo_Cell) * 3)) + if (params[0] == (int)(sizeof(Embryo_Cell) * 3)) GETINT(channel, params[3]); _edje_multisense_internal_sound_tone_play(ed, tone_name, (double)duration, channel); @@ -1015,13 +1019,13 @@ _edje_embryo_fn_play_vibration(Embryo_Program *ep, Embryo_Cell *params) char *sample_name = NULL; int repeat = 10; - if (params[0] < (int) (sizeof(Embryo_Cell) * 2)) return 0; + if (params[0] < (int)(sizeof(Embryo_Cell) * 2)) return 0; ed = embryo_program_data_get(ep); GETSTR(sample_name, params[1]); if ((!sample_name)) return 0; - if (params[0] == (int) (sizeof(Embryo_Cell) * 2)) - GETINT(repeat, params[2]); + if (params[0] == (int)(sizeof(Embryo_Cell) * 2)) + GETINT(repeat, params[2]); _edje_multisense_internal_vibration_sample_play(ed, sample_name, repeat); @@ -1159,13 +1163,13 @@ _edje_embryo_fn_set_state_anim(Embryo_Program *ep, Embryo_Cell *params) GETFLOAT_T(v2, params[7]); GETFLOAT_T(v3, params[8]); GETFLOAT_T(v4, params[9]); - } + } } rp = ed->table_parts[part_id % ed->table_parts_size]; if (!rp) return 0; _edje_part_description_apply(ed, rp, NULL, 0.0, state, value); _edje_part_pos_set(ed, rp, anim_type, FROM_DOUBLE(tween), v1, v2, - v3, v4); + v3, v4); _edje_recalc(ed); return 0; } @@ -1190,7 +1194,7 @@ _edje_embryo_fn_get_state(Embryo_Program *ep, Embryo_Cell *params) s = rp->chosen_description->state.name; if (s) { - if ((int) strlen(s) < params[3]) + if ((int)strlen(s) < params[3]) { SETSTR(s, params[2]); } @@ -1348,7 +1352,7 @@ _edje_embryo_fn_set_tween_state_anim(Embryo_Program *ep, Embryo_Cell *params) GETFLOAT_T(v2, params[9]); GETFLOAT_T(v3, params[10]); GETFLOAT_T(v4, params[11]); - } + } } rp = ed->table_parts[part_id % ed->table_parts_size]; if (!rp) return 0; @@ -1434,7 +1438,7 @@ _edje_embryo_fn_set_drag(Embryo_Program *ep, Embryo_Cell *params) edje_object_part_drag_value_set(ed->obj, rp->part->name, (double)EMBRYO_CELL_TO_FLOAT(params[2]), (double)EMBRYO_CELL_TO_FLOAT(params[3])); - return(0); + return 0; } /* get_drag_size(part_id, &Float:dx, &Float:dy) */ @@ -1474,7 +1478,7 @@ _edje_embryo_fn_set_drag_size(Embryo_Program *ep, Embryo_Cell *params) edje_object_part_drag_size_set(ed->obj, rp->part->name, (double)EMBRYO_CELL_TO_FLOAT(params[2]), (double)EMBRYO_CELL_TO_FLOAT(params[3])); - return(0); + return 0; } /* set_text(part_id, str[]) */ @@ -1492,10 +1496,11 @@ _edje_embryo_fn_set_text(Embryo_Program *ep, Embryo_Cell *params) if (part_id < 0) return 0; rp = ed->table_parts[part_id % ed->table_parts_size]; GETSTR(s, params[2]); - if (s){ - edje_object_part_text_set(ed->obj, rp->part->name, s); - } - return(0); + if (s) + { + edje_object_part_text_set(ed->obj, rp->part->name, s); + } + return 0; } /* get_text(part_id, dst[], maxlen) */ @@ -1515,7 +1520,7 @@ _edje_embryo_fn_get_text(Embryo_Program *ep, Embryo_Cell *params) s = (char *)edje_object_part_text_get(ed->obj, rp->part->name); if (s) { - if ((int) strlen(s) < params[3]) + if ((int)strlen(s) < params[3]) { SETSTR(s, params[2]); } @@ -1564,7 +1569,6 @@ _edje_embryo_fn_get_max_size(Embryo_Program *ep, Embryo_Cell *params) SETINT(w, params[1]); SETINT(h, params[2]); return 0; - } /* get_color_class(class[], &r, &g, &b, &a) */ @@ -1618,8 +1622,8 @@ _edje_embryo_fn_set_text_class(Embryo_Program *ep, Embryo_Cell *params) ed = embryo_program_data_get(ep); GETSTR(class, params[1]); GETSTR(font, params[2]); - if( !class || !font ) return 0; - fsize = (Evas_Font_Size) EMBRYO_CELL_TO_FLOAT(params[3]); + if ( !class || !font ) return 0; + fsize = (Evas_Font_Size)EMBRYO_CELL_TO_FLOAT(params[3]); edje_object_text_class_set(ed->obj, class, font, fsize); return 0; } @@ -1680,7 +1684,7 @@ _edje_embryo_fn_set_drag_step(Embryo_Program *ep, Embryo_Cell *params) edje_object_part_drag_step_set(ed->obj, rp->part->name, (double)EMBRYO_CELL_TO_FLOAT(params[2]), (double)EMBRYO_CELL_TO_FLOAT(params[3])); - return(0); + return 0; } /* get_drag_page(part_id, &Float:dx, &Float:&dy) */ @@ -1743,7 +1747,7 @@ _edje_embryo_fn_set_drag_page(Embryo_Program *ep, Embryo_Cell *params) edje_object_part_drag_page_set(ed->obj, rp->part->name, (double)EMBRYO_CELL_TO_FLOAT(params[2]), (double)EMBRYO_CELL_TO_FLOAT(params[3])); - return(0); + return 0; } /* send_message(Msg_Type:type, id,...); */ @@ -1755,25 +1759,85 @@ _edje_embryo_fn_send_message(Embryo_Program *ep, Embryo_Cell *params) int id, i, n; Embryo_Cell *ptr; - if (params[0] < (int) (sizeof(Embryo_Cell) * (2))) return 0; + if (params[0] < (int)(sizeof(Embryo_Cell) * (2))) return 0; ed = embryo_program_data_get(ep); type = params[1]; id = params[2]; switch (type) { case EDJE_MESSAGE_NONE: - _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, NULL); - break; + _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, NULL); + break; + case EDJE_MESSAGE_SIGNAL: - break; + break; + case EDJE_MESSAGE_STRING: + { + Embryo_Cell *cptr; + + cptr = embryo_data_address_get(ep, params[3]); + if (cptr) + { + Edje_Message_String *emsg; + int l; + char *s; + + l = embryo_data_string_length_get(ep, cptr); + s = alloca(l + 1); + s[0] = 0; + embryo_data_string_get(ep, cptr, s); + emsg = alloca(sizeof(Edje_Message_String)); + emsg->str = s; + _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, emsg); + } + } + break; + + case EDJE_MESSAGE_INT: + { + Edje_Message_Int *emsg; + + emsg = alloca(sizeof(Edje_Message_Int)); + ptr = embryo_data_address_get(ep, params[3]); + if (ptr) emsg->val = (int)*ptr; + else emsg->val = 0; + _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, emsg); + } + break; + + case EDJE_MESSAGE_FLOAT: + { + Edje_Message_Float *emsg; + float f; + + emsg = alloca(sizeof(Edje_Message_Float)); + ptr = embryo_data_address_get(ep, params[3]); + if (ptr) + { + f = EMBRYO_CELL_TO_FLOAT(*ptr); + emsg->val = (double)f; + } + else + emsg->val = 0.0; + _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, emsg); + } + break; + + case EDJE_MESSAGE_STRING_SET: + { + Edje_Message_String_Set *emsg; + + n = (params[0] / sizeof(Embryo_Cell)) + 1; + emsg = alloca(sizeof(Edje_Message_String_Set) + ((n - 3 - 1) * sizeof(char *))); + emsg->count = n - 3; + for (i = 3; i < n; i++) { Embryo_Cell *cptr; - cptr = embryo_data_address_get(ep, params[3]); + cptr = embryo_data_address_get(ep, params[i]); if (cptr) { - Edje_Message_String *emsg; int l; char *s; @@ -1781,30 +1845,98 @@ _edje_embryo_fn_send_message(Embryo_Program *ep, Embryo_Cell *params) s = alloca(l + 1); s[0] = 0; embryo_data_string_get(ep, cptr, s); - emsg = alloca(sizeof(Edje_Message_String)); - emsg->str = s; - _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, emsg); + emsg->str[i - 3] = s; } } - break; - case EDJE_MESSAGE_INT: - { - Edje_Message_Int *emsg; + _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, emsg); + } + break; - emsg = alloca(sizeof(Edje_Message_Int)); - ptr = embryo_data_address_get(ep, params[3]); + case EDJE_MESSAGE_INT_SET: + { + Edje_Message_Int_Set *emsg; + + n = (params[0] / sizeof(Embryo_Cell)) + 1; + emsg = alloca(sizeof(Edje_Message_Int_Set) + ((n - 3 - 1) * sizeof(int))); + emsg->count = n - 3; + for (i = 3; i < n; i++) + { + ptr = embryo_data_address_get(ep, params[i]); + if (ptr) emsg->val[i - 3] = (int)*ptr; + else emsg->val[i - 3] = 0; + } + _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, emsg); + } + break; + + case EDJE_MESSAGE_FLOAT_SET: + { + Edje_Message_Float_Set *emsg; + + n = (params[0] / sizeof(Embryo_Cell)) + 1; + emsg = alloca(sizeof(Edje_Message_Float_Set) + ((n - 3 - 1) * sizeof(double))); + emsg->count = n - 3; + for (i = 3; i < n; i++) + { + float f; + + ptr = embryo_data_address_get(ep, params[i]); + if (ptr) + { + f = EMBRYO_CELL_TO_FLOAT(*ptr); + emsg->val[i - 3] = (double)f; + } + else + emsg->val[i - 3] = 0.0; + } + _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, emsg); + } + break; + + case EDJE_MESSAGE_STRING_INT: + { + Edje_Message_String_Int *emsg; + Embryo_Cell *cptr; + + cptr = embryo_data_address_get(ep, params[3]); + if (cptr) + { + int l; + char *s; + + l = embryo_data_string_length_get(ep, cptr); + s = alloca(l + 1); + s[0] = 0; + embryo_data_string_get(ep, cptr, s); + emsg = alloca(sizeof(Edje_Message_String_Int)); + emsg->str = s; + ptr = embryo_data_address_get(ep, params[4]); if (ptr) emsg->val = (int)*ptr; else emsg->val = 0; _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, emsg); } - break; - case EDJE_MESSAGE_FLOAT: + } + break; + + case EDJE_MESSAGE_STRING_FLOAT: + { + Edje_Message_String_Float *emsg; + Embryo_Cell *cptr; + + cptr = embryo_data_address_get(ep, params[3]); + if (cptr) { - Edje_Message_Float *emsg; + int l; + char *s; float f; - emsg = alloca(sizeof(Edje_Message_Float)); - ptr = embryo_data_address_get(ep, params[3]); + l = embryo_data_string_length_get(ep, cptr); + s = alloca(l + 1); + s[0] = 0; + embryo_data_string_get(ep, cptr, s); + emsg = alloca(sizeof(Edje_Message_String_Float)); + emsg->str = s; + ptr = embryo_data_address_get(ep, params[4]); if (ptr) { f = EMBRYO_CELL_TO_FLOAT(*ptr); @@ -1814,196 +1946,80 @@ _edje_embryo_fn_send_message(Embryo_Program *ep, Embryo_Cell *params) emsg->val = 0.0; _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, emsg); } - break; - case EDJE_MESSAGE_STRING_SET: - { - Edje_Message_String_Set *emsg; + } + break; - n = (params[0] / sizeof(Embryo_Cell)) + 1; - emsg = alloca(sizeof(Edje_Message_String_Set) + ((n - 3 - 1) * sizeof(char *))); - emsg->count = n - 3; - for (i = 3; i < n; i++) - { - Embryo_Cell *cptr; - - cptr = embryo_data_address_get(ep, params[i]); - if (cptr) - { - int l; - char *s; - - l = embryo_data_string_length_get(ep, cptr); - s = alloca(l + 1); - s[0] = 0; - embryo_data_string_get(ep, cptr, s); - emsg->str[i - 3] = s; - } - } - _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, emsg); - } - break; - case EDJE_MESSAGE_INT_SET: - { - Edje_Message_Int_Set *emsg; - - n = (params[0] / sizeof(Embryo_Cell)) + 1; - emsg = alloca(sizeof(Edje_Message_Int_Set) + ((n - 3 - 1) * sizeof(int))); - emsg->count = n - 3; - for (i = 3; i < n; i++) - { - ptr = embryo_data_address_get(ep, params[i]); - if (ptr) emsg->val[i - 3] = (int)*ptr; - else emsg->val[i - 3] = 0; - } - _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, emsg); - } - break; - case EDJE_MESSAGE_FLOAT_SET: - { - Edje_Message_Float_Set *emsg; - - n = (params[0] / sizeof(Embryo_Cell)) + 1; - emsg = alloca(sizeof(Edje_Message_Float_Set) + ((n - 3 - 1) * sizeof(double))); - emsg->count = n - 3; - for (i = 3; i < n; i++) - { - float f; - - ptr = embryo_data_address_get(ep, params[i]); - if (ptr) - { - f = EMBRYO_CELL_TO_FLOAT(*ptr); - emsg->val[i - 3] = (double)f; - } - else - emsg->val[i - 3] = 0.0; - } - _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, emsg); - } - break; - case EDJE_MESSAGE_STRING_INT: - { - Edje_Message_String_Int *emsg; - Embryo_Cell *cptr; - - cptr = embryo_data_address_get(ep, params[3]); - if (cptr) - { - int l; - char *s; - - l = embryo_data_string_length_get(ep, cptr); - s = alloca(l + 1); - s[0] = 0; - embryo_data_string_get(ep, cptr, s); - emsg = alloca(sizeof(Edje_Message_String_Int)); - emsg->str = s; - ptr = embryo_data_address_get(ep, params[4]); - if (ptr) emsg->val = (int)*ptr; - else emsg->val = 0; - _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, emsg); - } - } - break; - case EDJE_MESSAGE_STRING_FLOAT: - { - Edje_Message_String_Float *emsg; - Embryo_Cell *cptr; - - cptr = embryo_data_address_get(ep, params[3]); - if (cptr) - { - int l; - char *s; - float f; - - l = embryo_data_string_length_get(ep, cptr); - s = alloca(l + 1); - s[0] = 0; - embryo_data_string_get(ep, cptr, s); - emsg = alloca(sizeof(Edje_Message_String_Float)); - emsg->str = s; - ptr = embryo_data_address_get(ep, params[4]); - if (ptr) - { - f = EMBRYO_CELL_TO_FLOAT(*ptr); - emsg->val = (double)f; - } - else - emsg->val = 0.0; - _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, emsg); - } - } - break; case EDJE_MESSAGE_STRING_INT_SET: + { + Edje_Message_String_Int_Set *emsg; + Embryo_Cell *cptr; + + cptr = embryo_data_address_get(ep, params[3]); + if (cptr) { - Edje_Message_String_Int_Set *emsg; - Embryo_Cell *cptr; + int l; + char *s; - cptr = embryo_data_address_get(ep, params[3]); - if (cptr) + l = embryo_data_string_length_get(ep, cptr); + s = alloca(l + 1); + s[0] = 0; + embryo_data_string_get(ep, cptr, s); + n = (params[0] / sizeof(Embryo_Cell)) + 1; + emsg = alloca(sizeof(Edje_Message_String_Int_Set) + ((n - 4 - 1) * sizeof(int))); + emsg->str = s; + emsg->count = n - 4; + for (i = 4; i < n; i++) { - int l; - char *s; - - l = embryo_data_string_length_get(ep, cptr); - s = alloca(l + 1); - s[0] = 0; - embryo_data_string_get(ep, cptr, s); - n = (params[0] / sizeof(Embryo_Cell)) + 1; - emsg = alloca(sizeof(Edje_Message_String_Int_Set) + ((n - 4 - 1) * sizeof(int))); - emsg->str = s; - emsg->count = n - 4; - for (i = 4; i < n; i++) - { - ptr = embryo_data_address_get(ep, params[i]); - if (ptr) emsg->val[i - 4] = (int)*ptr; - else emsg->val[i - 4] = 0; - } - _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, emsg); + ptr = embryo_data_address_get(ep, params[i]); + if (ptr) emsg->val[i - 4] = (int)*ptr; + else emsg->val[i - 4] = 0; } + _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, emsg); } - break; + } + break; + case EDJE_MESSAGE_STRING_FLOAT_SET: + { + Edje_Message_String_Float_Set *emsg; + Embryo_Cell *cptr; + + cptr = embryo_data_address_get(ep, params[3]); + if (cptr) { - Edje_Message_String_Float_Set *emsg; - Embryo_Cell *cptr; + int l; + char *s; - cptr = embryo_data_address_get(ep, params[3]); - if (cptr) + l = embryo_data_string_length_get(ep, cptr); + s = alloca(l + 1); + s[0] = 0; + embryo_data_string_get(ep, cptr, s); + n = (params[0] / sizeof(Embryo_Cell)) + 1; + emsg = alloca(sizeof(Edje_Message_String_Float_Set) + ((n - 4 - 1) * sizeof(double))); + emsg->str = s; + emsg->count = n - 4; + for (i = 4; i < n; i++) { - int l; - char *s; + float f; - l = embryo_data_string_length_get(ep, cptr); - s = alloca(l + 1); - s[0] = 0; - embryo_data_string_get(ep, cptr, s); - n = (params[0] / sizeof(Embryo_Cell)) + 1; - emsg = alloca(sizeof(Edje_Message_String_Float_Set) + ((n - 4 - 1) * sizeof(double))); - emsg->str = s; - emsg->count = n - 4; - for (i = 4; i < n; i++) + ptr = embryo_data_address_get(ep, params[i]); + if (ptr) { - float f; - - ptr = embryo_data_address_get(ep, params[i]); - if (ptr) - { - f = EMBRYO_CELL_TO_FLOAT(*ptr); - emsg->val[i - 4] = (double)f; - } - else - emsg->val[i - 4] = 0.0; + f = EMBRYO_CELL_TO_FLOAT(*ptr); + emsg->val[i - 4] = (double)f; } - _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, emsg); + else + emsg->val[i - 4] = 0.0; } + _edje_util_message_send(ed, EDJE_QUEUE_APP, type, id, emsg); } - break; + } + break; + default: - break; + break; } - return(0); + return 0; } /* custom_state(part_id, state[], Float:state_val = 0.0) */ @@ -2041,19 +2057,19 @@ _edje_embryo_fn_custom_state(Embryo_Program *ep, Embryo_Cell *params) switch (rp->part->type) { #define ALLOC_DESC(Short, Type, To) \ - case EDJE_PART_TYPE_##Short: To = calloc(1, sizeof (Edje_Part_Description_##Type)); break; +case EDJE_PART_TYPE_##Short: To = calloc(1, sizeof (Edje_Part_Description_##Type)); break; -#define ALLOC_COPY_DESC(Short, Type, To, Spec) \ - case EDJE_PART_TYPE_##Short: \ - { \ - Edje_Part_Description_##Type *tmp; \ - Edje_Part_Description_##Type *new; \ - tmp = (Edje_Part_Description_##Type *) parent; \ - new = calloc(1, sizeof (Edje_Part_Description_##Type)); \ - new->Spec = tmp->Spec; \ - d = &new->common; \ - break; \ - } +#define ALLOC_COPY_DESC(Short, Type, To, Spec) \ +case EDJE_PART_TYPE_##Short: \ +{ \ + Edje_Part_Description_##Type * tmp; \ + Edje_Part_Description_##Type * new; \ + tmp = (Edje_Part_Description_##Type *)parent; \ + new = calloc(1, sizeof (Edje_Part_Description_##Type)); \ + new->Spec = tmp->Spec; \ + d = &new->common; \ + break; \ +} ALLOC_DESC(RECTANGLE, Common, d); ALLOC_DESC(SPACER, Common, d); @@ -2098,12 +2114,12 @@ _edje_embryo_fn_custom_state(Embryo_Program *ep, Embryo_Cell *params) Edje_Part_Description_Image *img_desc; Edje_Part_Description_Image *parent_img_desc; - img_desc = (Edje_Part_Description_Image*) d; - parent_img_desc = (Edje_Part_Description_Image*) parent; + img_desc = (Edje_Part_Description_Image *)d; + parent_img_desc = (Edje_Part_Description_Image *)parent; img_desc->image.tweens_count = parent_img_desc->image.tweens_count; img_desc->image.tweens = calloc(img_desc->image.tweens_count, - sizeof(Edje_Part_Image_Id*)); + sizeof(Edje_Part_Image_Id *)); if (img_desc->image.tweens) { unsigned int i; @@ -2130,7 +2146,7 @@ _edje_embryo_fn_custom_state(Embryo_Program *ep, Embryo_Cell *params) { Edje_Part_Description_Text *text_desc; - text_desc = (Edje_Part_Description_Text*) d; + text_desc = (Edje_Part_Description_Text *)d; text_desc->text.text_class = DUP(text_desc->text.text_class); text_desc->text.text.str = DUP(edje_string_get(&text_desc->text.text)); @@ -2158,7 +2174,7 @@ _edje_embryo_fn_set_state_val(Embryo_Program *ep, Embryo_Cell *params) char *s; /* we need at least 3 arguments */ - if (params[0] < (int) (sizeof(Embryo_Cell) * 3)) + if (params[0] < (int)(sizeof(Embryo_Cell) * 3)) return 0; if (params[1] < 0) @@ -2174,557 +2190,616 @@ _edje_embryo_fn_set_state_val(Embryo_Program *ep, Embryo_Cell *params) switch (params[2]) { case EDJE_STATE_PARAM_ALIGNMENT: - CHKPARAM(4); + CHKPARAM(4); - GETFLOAT_T(rp->custom->description->align.x, params[3]); - GETFLOAT_T(rp->custom->description->align.y, params[4]); + GETFLOAT_T(rp->custom->description->align.x, params[3]); + GETFLOAT_T(rp->custom->description->align.y, params[4]); + + break; - break; case EDJE_STATE_PARAM_MIN: - CHKPARAM(4); + CHKPARAM(4); - GETINT(rp->custom->description->min.w, params[3]); - GETINT(rp->custom->description->min.h, params[4]); + GETINT(rp->custom->description->min.w, params[3]); + GETINT(rp->custom->description->min.h, params[4]); + + break; - break; case EDJE_STATE_PARAM_MAX: - CHKPARAM(4); + CHKPARAM(4); - GETINT(rp->custom->description->max.w, params[3]); - GETINT(rp->custom->description->max.h, params[4]); + GETINT(rp->custom->description->max.w, params[3]); + GETINT(rp->custom->description->max.h, params[4]); + + break; - break; case EDJE_STATE_PARAM_STEP: - CHKPARAM(4); + CHKPARAM(4); - GETINT(rp->custom->description->step.x, params[3]); - GETINT(rp->custom->description->step.y, params[4]); + GETINT(rp->custom->description->step.x, params[3]); + GETINT(rp->custom->description->step.y, params[4]); + + break; - break; case EDJE_STATE_PARAM_ASPECT: - CHKPARAM(4); + CHKPARAM(4); - GETFLOAT_T(rp->custom->description->aspect.min, params[3]); - GETFLOAT_T(rp->custom->description->aspect.max, params[4]); + GETFLOAT_T(rp->custom->description->aspect.min, params[3]); + GETFLOAT_T(rp->custom->description->aspect.max, params[4]); + + break; - break; case EDJE_STATE_PARAM_ASPECT_PREF: + CHKPARAM(3); + + GETINT(rp->custom->description->aspect.prefer, params[3]); + + break; + + case EDJE_STATE_PARAM_COLOR: + CHKPARAM(6); + + GETINT(rp->custom->description->color.r, params[3]); + GETINT(rp->custom->description->color.g, params[4]); + GETINT(rp->custom->description->color.b, params[5]); + GETINT(rp->custom->description->color.a, params[6]); + + break; + + case EDJE_STATE_PARAM_COLOR2: + CHKPARAM(6); + + GETINT(rp->custom->description->color2.r, params[3]); + GETINT(rp->custom->description->color2.g, params[4]); + GETINT(rp->custom->description->color2.b, params[5]); + GETINT(rp->custom->description->color2.a, params[6]); + + break; + + case EDJE_STATE_PARAM_COLOR3: + { + Edje_Part_Description_Text *text; + + if ((rp->part->type != EDJE_PART_TYPE_TEXT) && + (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) + return 0; + + CHKPARAM(6); + + text = (Edje_Part_Description_Text *)rp->custom->description; + + GETINT(text->text.color3.r, params[3]); + GETINT(text->text.color3.g, params[4]); + GETINT(text->text.color3.b, params[5]); + GETINT(text->text.color3.a, params[6]); + break; + } + + case EDJE_STATE_PARAM_COLOR_CLASS: + CHKPARAM(3); + + GETSTR(s, params[3]); + GETSTREVAS(s, rp->custom->description->color_class); + + break; + + case EDJE_STATE_PARAM_REL1: + CHKPARAM(4); + + GETFLOAT_T(rp->custom->description->rel1.relative_x, params[3]); + GETFLOAT_T(rp->custom->description->rel1.relative_y, params[4]); + + break; + + case EDJE_STATE_PARAM_REL1_TO: + CHKPARAM(4); + + GETINT(rp->custom->description->rel1.id_x, params[3]); + GETINT(rp->custom->description->rel1.id_y, params[4]); + + break; + + case EDJE_STATE_PARAM_REL1_OFFSET: + CHKPARAM(4); + + GETINT(rp->custom->description->rel1.offset_x, params[3]); + GETINT(rp->custom->description->rel1.offset_y, params[4]); + + break; + + case EDJE_STATE_PARAM_REL2: + CHKPARAM(4); + + GETFLOAT_T(rp->custom->description->rel2.relative_x, params[3]); + GETFLOAT_T(rp->custom->description->rel2.relative_y, params[4]); + + break; + + case EDJE_STATE_PARAM_REL2_TO: + CHKPARAM(4); + + GETINT(rp->custom->description->rel2.id_x, params[3]); + GETINT(rp->custom->description->rel2.id_y, params[4]); + + break; + + case EDJE_STATE_PARAM_REL2_OFFSET: + CHKPARAM(4); + + GETINT(rp->custom->description->rel2.offset_x, params[3]); + GETINT(rp->custom->description->rel2.offset_y, params[4]); + + break; + + case EDJE_STATE_PARAM_IMAGE: + { + Edje_Part_Description_Image *img; + + if ((rp->part->type != EDJE_PART_TYPE_IMAGE)) return 0; CHKPARAM(3); - GETINT(rp->custom->description->aspect.prefer, params[3]); + img = (Edje_Part_Description_Image *)rp->custom->description; + GETINT(img->image.id, params[3]); break; - case EDJE_STATE_PARAM_COLOR: + } + + case EDJE_STATE_PARAM_BORDER: + { + Edje_Part_Description_Image *img; + + if ((rp->part->type != EDJE_PART_TYPE_IMAGE)) return 0; CHKPARAM(6); - GETINT(rp->custom->description->color.r, params[3]); - GETINT(rp->custom->description->color.g, params[4]); - GETINT(rp->custom->description->color.b, params[5]); - GETINT(rp->custom->description->color.a, params[6]); + img = (Edje_Part_Description_Image *)rp->custom->description; + + GETINT(img->image.border.l, params[3]); + GETINT(img->image.border.r, params[4]); + GETINT(img->image.border.t, params[5]); + GETINT(img->image.border.b, params[6]); break; - case EDJE_STATE_PARAM_COLOR2: - CHKPARAM(6); + } - GETINT(rp->custom->description->color2.r, params[3]); - GETINT(rp->custom->description->color2.g, params[4]); - GETINT(rp->custom->description->color2.b, params[5]); - GETINT(rp->custom->description->color2.a, params[6]); + case EDJE_STATE_PARAM_FILL_SMOOTH: + { + Edje_Part_Description_Image *img; + Edje_Part_Description_Proxy *proxy; - break; - case EDJE_STATE_PARAM_COLOR3: + if ((rp->part->type != EDJE_PART_TYPE_IMAGE) && (rp->part->type != EDJE_PART_TYPE_PROXY)) return 0; + CHKPARAM(3); + + if (rp->part->type == EDJE_PART_TYPE_IMAGE) { - Edje_Part_Description_Text *text; - - if ( (rp->part->type != EDJE_PART_TYPE_TEXT) && - (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; - - CHKPARAM(6); - - text = (Edje_Part_Description_Text*) rp->custom->description; - - GETINT(text->text.color3.r, params[3]); - GETINT(text->text.color3.g, params[4]); - GETINT(text->text.color3.b, params[5]); - GETINT(text->text.color3.a, params[6]); - break; + img = (Edje_Part_Description_Image *)rp->custom->description; + GETINT(img->image.fill.smooth, params[3]); } - case EDJE_STATE_PARAM_COLOR_CLASS: + else + { + proxy = (Edje_Part_Description_Proxy *)rp->custom->description; + GETINT(proxy->proxy.fill.smooth, params[3]); + } + + break; + } + + case EDJE_STATE_PARAM_FILL_POS: + { + Edje_Part_Description_Image *img; + Edje_Part_Description_Proxy *proxy; + + if ((rp->part->type != EDJE_PART_TYPE_IMAGE) && (rp->part->type != EDJE_PART_TYPE_PROXY)) return 0; + CHKPARAM(6); + + if (rp->part->type == EDJE_PART_TYPE_IMAGE) + { + img = (Edje_Part_Description_Image *)rp->custom->description; + + GETFLOAT_T(img->image.fill.pos_rel_x, params[3]); + GETFLOAT_T(img->image.fill.pos_rel_y, params[4]); + GETINT(img->image.fill.pos_abs_x, params[5]); + GETINT(img->image.fill.pos_abs_y, params[6]); + } + else + { + proxy = (Edje_Part_Description_Proxy *)rp->custom->description; + + GETFLOAT_T(proxy->proxy.fill.pos_rel_x, params[3]); + GETFLOAT_T(proxy->proxy.fill.pos_rel_y, params[4]); + GETINT(proxy->proxy.fill.pos_abs_x, params[5]); + GETINT(proxy->proxy.fill.pos_abs_y, params[6]); + } + + break; + } + + case EDJE_STATE_PARAM_FILL_SIZE: + { + Edje_Part_Description_Image *img; + Edje_Part_Description_Proxy *proxy; + + if ((rp->part->type != EDJE_PART_TYPE_IMAGE) && (rp->part->type != EDJE_PART_TYPE_PROXY)) return 0; + CHKPARAM(6); + + if (rp->part->type == EDJE_PART_TYPE_IMAGE) + { + img = (Edje_Part_Description_Image *)rp->custom->description; + + GETFLOAT_T(img->image.fill.rel_x, params[3]); + GETFLOAT_T(img->image.fill.rel_y, params[4]); + GETINT(img->image.fill.abs_x, params[5]); + GETINT(img->image.fill.abs_y, params[6]); + } + else + { + proxy = (Edje_Part_Description_Proxy *)rp->custom->description; + + GETFLOAT_T(proxy->proxy.fill.rel_x, params[3]); + GETFLOAT_T(proxy->proxy.fill.rel_y, params[4]); + GETINT(proxy->proxy.fill.abs_x, params[5]); + GETINT(proxy->proxy.fill.abs_y, params[6]); + } + + break; + } + + case EDJE_STATE_PARAM_TEXT: + { + Edje_Part_Description_Text *text; + + if ((rp->part->type != EDJE_PART_TYPE_TEXT) && + (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) + return 0; CHKPARAM(3); GETSTR(s, params[3]); - GETSTREVAS(s, rp->custom->description->color_class); + + text = (Edje_Part_Description_Text *)rp->custom->description; + GETSTREVAS(s, text->text.text.str); break; - case EDJE_STATE_PARAM_REL1: - CHKPARAM(4); - - GETFLOAT_T(rp->custom->description->rel1.relative_x, params[3]); - GETFLOAT_T(rp->custom->description->rel1.relative_y, params[4]); - - break; - case EDJE_STATE_PARAM_REL1_TO: - CHKPARAM(4); - - GETINT(rp->custom->description->rel1.id_x, params[3]); - GETINT(rp->custom->description->rel1.id_y, params[4]); - - break; - case EDJE_STATE_PARAM_REL1_OFFSET: - CHKPARAM(4); - - GETINT(rp->custom->description->rel1.offset_x, params[3]); - GETINT(rp->custom->description->rel1.offset_y, params[4]); - - break; - case EDJE_STATE_PARAM_REL2: - CHKPARAM(4); - - GETFLOAT_T(rp->custom->description->rel2.relative_x, params[3]); - GETFLOAT_T(rp->custom->description->rel2.relative_y, params[4]); - - break; - case EDJE_STATE_PARAM_REL2_TO: - CHKPARAM(4); - - GETINT(rp->custom->description->rel2.id_x, params[3]); - GETINT(rp->custom->description->rel2.id_y, params[4]); - - break; - case EDJE_STATE_PARAM_REL2_OFFSET: - CHKPARAM(4); - - GETINT(rp->custom->description->rel2.offset_x, params[3]); - GETINT(rp->custom->description->rel2.offset_y, params[4]); - - break; - case EDJE_STATE_PARAM_IMAGE: - { - Edje_Part_Description_Image *img; - - if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0; - CHKPARAM(3); - - img = (Edje_Part_Description_Image*) rp->custom->description; - GETINT(img->image.id, params[3]); - - break; - } - case EDJE_STATE_PARAM_BORDER: - { - Edje_Part_Description_Image *img; - - if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0; - CHKPARAM(6); - - img = (Edje_Part_Description_Image*) rp->custom->description; - - GETINT(img->image.border.l, params[3]); - GETINT(img->image.border.r, params[4]); - GETINT(img->image.border.t, params[5]); - GETINT(img->image.border.b, params[6]); - - break; - } - case EDJE_STATE_PARAM_FILL_SMOOTH: - { - Edje_Part_Description_Image *img; - Edje_Part_Description_Proxy *proxy; - - if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) && (rp->part->type != EDJE_PART_TYPE_PROXY) ) return 0; - CHKPARAM(3); - - if (rp->part->type == EDJE_PART_TYPE_IMAGE) - { - img = (Edje_Part_Description_Image*) rp->custom->description; - GETINT(img->image.fill.smooth, params[3]); - } - else - { - proxy = (Edje_Part_Description_Proxy*) rp->custom->description; - GETINT(proxy->proxy.fill.smooth, params[3]); } - break; - } - case EDJE_STATE_PARAM_FILL_POS: - { - Edje_Part_Description_Image *img; - Edje_Part_Description_Proxy *proxy; - - if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) && (rp->part->type != EDJE_PART_TYPE_PROXY) ) return 0; - CHKPARAM(6); - - if (rp->part->type == EDJE_PART_TYPE_IMAGE) - { - img = (Edje_Part_Description_Image*) rp->custom->description; - - GETFLOAT_T(img->image.fill.pos_rel_x, params[3]); - GETFLOAT_T(img->image.fill.pos_rel_y, params[4]); - GETINT(img->image.fill.pos_abs_x, params[5]); - GETINT(img->image.fill.pos_abs_y, params[6]); - } - else - { - proxy = (Edje_Part_Description_Proxy*) rp->custom->description; - - GETFLOAT_T(proxy->proxy.fill.pos_rel_x, params[3]); - GETFLOAT_T(proxy->proxy.fill.pos_rel_y, params[4]); - GETINT(proxy->proxy.fill.pos_abs_x, params[5]); - GETINT(proxy->proxy.fill.pos_abs_y, params[6]); - } - - break; - } - case EDJE_STATE_PARAM_FILL_SIZE: - { - Edje_Part_Description_Image *img; - Edje_Part_Description_Proxy *proxy; - - if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) && (rp->part->type != EDJE_PART_TYPE_PROXY) ) return 0; - CHKPARAM(6); - - if (rp->part->type == EDJE_PART_TYPE_IMAGE) - { - img = (Edje_Part_Description_Image*) rp->custom->description; - - GETFLOAT_T(img->image.fill.rel_x, params[3]); - GETFLOAT_T(img->image.fill.rel_y, params[4]); - GETINT(img->image.fill.abs_x, params[5]); - GETINT(img->image.fill.abs_y, params[6]); - } - else - { - proxy = (Edje_Part_Description_Proxy*) rp->custom->description; - - GETFLOAT_T(proxy->proxy.fill.rel_x, params[3]); - GETFLOAT_T(proxy->proxy.fill.rel_y, params[4]); - GETINT(proxy->proxy.fill.abs_x, params[5]); - GETINT(proxy->proxy.fill.abs_y, params[6]); - } - - break; - } - case EDJE_STATE_PARAM_TEXT: - { - Edje_Part_Description_Text *text; - - if ( (rp->part->type != EDJE_PART_TYPE_TEXT) && - (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; - CHKPARAM(3); - - GETSTR(s, params[3]); - - text = (Edje_Part_Description_Text*) rp->custom->description; - GETSTREVAS(s, text->text.text.str); - - break; - } case EDJE_STATE_PARAM_TEXT_CLASS: - { - Edje_Part_Description_Text *text; + { + Edje_Part_Description_Text *text; - if ( (rp->part->type != EDJE_PART_TYPE_TEXT) && - (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; - CHKPARAM(3); + if ((rp->part->type != EDJE_PART_TYPE_TEXT) && + (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) + return 0; + CHKPARAM(3); - GETSTR(s, params[3]); + GETSTR(s, params[3]); - text = (Edje_Part_Description_Text*) rp->custom->description; - GETSTREVAS(s, text->text.text_class); + text = (Edje_Part_Description_Text *)rp->custom->description; + GETSTREVAS(s, text->text.text_class); + + break; + } - break; - } case EDJE_STATE_PARAM_TEXT_FONT: - { - Edje_Part_Description_Text *text; + { + Edje_Part_Description_Text *text; - if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; - CHKPARAM(3); + if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; + CHKPARAM(3); - GETSTR(s, params[3]); + GETSTR(s, params[3]); - text = (Edje_Part_Description_Text*) rp->custom->description; - GETSTREVAS(s, text->text.font.str); + text = (Edje_Part_Description_Text *)rp->custom->description; + GETSTREVAS(s, text->text.font.str); + + break; + } - break; - } case EDJE_STATE_PARAM_TEXT_STYLE: - { - Edje_Part_Description_Text *text; + { + Edje_Part_Description_Text *text; - if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return 0; - CHKPARAM(3); + if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return 0; + CHKPARAM(3); - GETSTR(s, params[3]); + GETSTR(s, params[3]); - text = (Edje_Part_Description_Text*) rp->custom->description; - GETSTREVAS(s, text->text.style.str); + text = (Edje_Part_Description_Text *)rp->custom->description; + GETSTREVAS(s, text->text.style.str); + + break; + } - break; - } case EDJE_STATE_PARAM_TEXT_SIZE: - { - Edje_Part_Description_Text *text; + { + Edje_Part_Description_Text *text; - if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; - CHKPARAM(3); + if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; + CHKPARAM(3); - text = (Edje_Part_Description_Text*) rp->custom->description; - GETINT(text->text.size, params[3]); + text = (Edje_Part_Description_Text *)rp->custom->description; + GETINT(text->text.size, params[3]); + + break; + } - break; - } case EDJE_STATE_PARAM_TEXT_FIT: - { - Edje_Part_Description_Text *text; + { + Edje_Part_Description_Text *text; - if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; - CHKPARAM(4); + if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; + CHKPARAM(4); - text = (Edje_Part_Description_Text*) rp->custom->description; + text = (Edje_Part_Description_Text *)rp->custom->description; - GETINT(text->text.fit_x, params[3]); - GETINT(text->text.fit_y, params[4]); + GETINT(text->text.fit_x, params[3]); + GETINT(text->text.fit_y, params[4]); + + break; + } - break; - } case EDJE_STATE_PARAM_TEXT_MIN: - { - Edje_Part_Description_Text *text; + { + Edje_Part_Description_Text *text; - if ( (rp->part->type != EDJE_PART_TYPE_TEXT) && - (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; - CHKPARAM(4); + if ((rp->part->type != EDJE_PART_TYPE_TEXT) && + (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) + return 0; + CHKPARAM(4); - text = (Edje_Part_Description_Text*) rp->custom->description; + text = (Edje_Part_Description_Text *)rp->custom->description; - GETINT(text->text.min_x, params[3]); - GETINT(text->text.min_y, params[4]); + GETINT(text->text.min_x, params[3]); + GETINT(text->text.min_y, params[4]); + + break; + } - break; - } case EDJE_STATE_PARAM_TEXT_MAX: - { - Edje_Part_Description_Text *text; + { + Edje_Part_Description_Text *text; - if ( (rp->part->type != EDJE_PART_TYPE_TEXT) && - (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; - CHKPARAM(4); + if ((rp->part->type != EDJE_PART_TYPE_TEXT) && + (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) + return 0; + CHKPARAM(4); - text = (Edje_Part_Description_Text*) rp->custom->description; + text = (Edje_Part_Description_Text *)rp->custom->description; - GETINT(text->text.max_x, params[3]); - GETINT(text->text.max_y, params[4]); + GETINT(text->text.max_x, params[3]); + GETINT(text->text.max_y, params[4]); + + break; + } - break; - } case EDJE_STATE_PARAM_TEXT_ALIGN: - { - Edje_Part_Description_Text *text; + { + Edje_Part_Description_Text *text; - if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; - CHKPARAM(4); + if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; + CHKPARAM(4); - text = (Edje_Part_Description_Text*) rp->custom->description; + text = (Edje_Part_Description_Text *)rp->custom->description; - GETFLOAT_T(text->text.align.x, params[3]); - GETFLOAT_T(text->text.align.y, params[4]); + GETFLOAT_T(text->text.align.x, params[3]); + GETFLOAT_T(text->text.align.y, params[4]); + + break; + } - break; - } case EDJE_STATE_PARAM_VISIBLE: - CHKPARAM(3); + CHKPARAM(3); - GETINT(rp->custom->description->visible, params[3]); + GETINT(rp->custom->description->visible, params[3]); + + break; - break; case EDJE_STATE_PARAM_MAP_ON: - CHKPARAM(3); + CHKPARAM(3); - GETINT(rp->custom->description->map.on, params[3]); + GETINT(rp->custom->description->map.on, params[3]); + + break; - break; case EDJE_STATE_PARAM_MAP_PERSP: - CHKPARAM(3); + CHKPARAM(3); - GETINT(rp->custom->description->map.id_persp, params[3]); + GETINT(rp->custom->description->map.id_persp, params[3]); + + break; - break; case EDJE_STATE_PARAM_MAP_LIGHT: - CHKPARAM(3); + CHKPARAM(3); - GETINT(rp->custom->description->map.id_light, params[3]); + GETINT(rp->custom->description->map.id_light, params[3]); + + break; - break; case EDJE_STATE_PARAM_MAP_ROT_CENTER: - CHKPARAM(3); + CHKPARAM(3); - GETINT(rp->custom->description->map.rot.id_center, params[3]); + GETINT(rp->custom->description->map.rot.id_center, params[3]); + + break; - break; case EDJE_STATE_PARAM_MAP_ROT_X: - CHKPARAM(3); + CHKPARAM(3); - GETFLOAT_T(rp->custom->description->map.rot.x, params[3]); + GETFLOAT_T(rp->custom->description->map.rot.x, params[3]); + + break; - break; case EDJE_STATE_PARAM_MAP_ROT_Y: - CHKPARAM(3); + CHKPARAM(3); - GETFLOAT_T(rp->custom->description->map.rot.y, params[3]); + GETFLOAT_T(rp->custom->description->map.rot.y, params[3]); + + break; - break; case EDJE_STATE_PARAM_MAP_ROT_Z: - CHKPARAM(3); + CHKPARAM(3); - GETFLOAT_T(rp->custom->description->map.rot.z, params[3]); + GETFLOAT_T(rp->custom->description->map.rot.z, params[3]); + + break; - break; case EDJE_STATE_PARAM_MAP_BACK_CULL: - CHKPARAM(3); + CHKPARAM(3); - GETINT(rp->custom->description->map.backcull, params[3]); + GETINT(rp->custom->description->map.backcull, params[3]); + + break; - break; case EDJE_STATE_PARAM_MAP_PERSP_ON: - CHKPARAM(3); + CHKPARAM(3); - GETINT(rp->custom->description->map.persp_on, params[3]); + GETINT(rp->custom->description->map.persp_on, params[3]); + + break; - break; case EDJE_STATE_PARAM_PERSP_ZPLANE: - CHKPARAM(3); + CHKPARAM(3); - GETINT(rp->custom->description->persp.zplane, params[3]); + GETINT(rp->custom->description->persp.zplane, params[3]); + + break; - break; case EDJE_STATE_PARAM_PERSP_FOCAL: + CHKPARAM(3); + + GETINT(rp->custom->description->persp.focal, params[3]); + + break; + + case EDJE_STATE_PARAM_PROXY_SRC_CLIP: + { + Edje_Part_Description_Proxy *proxy; + + if ((rp->part->type != EDJE_PART_TYPE_PROXY)) return 0; CHKPARAM(3); - GETINT(rp->custom->description->persp.focal, params[3]); + proxy = (Edje_Part_Description_Proxy *)rp->custom->description; + GETINT(proxy->proxy.source_clip, params[3]); break; - case EDJE_STATE_PARAM_PROXY_SRC_CLIP: - { - Edje_Part_Description_Proxy *proxy; + } - if ((rp->part->type != EDJE_PART_TYPE_PROXY)) return 0; - CHKPARAM(3); - - proxy = (Edje_Part_Description_Proxy*) rp->custom->description; - GETINT(proxy->proxy.source_clip, params[3]); - - break; - } case EDJE_STATE_PARAM_PROXY_SRC_VISIBLE: - { - Edje_Part_Description_Proxy *proxy; + { + Edje_Part_Description_Proxy *proxy; - if ((rp->part->type != EDJE_PART_TYPE_PROXY)) return 0; - CHKPARAM(3); + if ((rp->part->type != EDJE_PART_TYPE_PROXY)) return 0; + CHKPARAM(3); - proxy = (Edje_Part_Description_Proxy*) rp->custom->description; - GETINT(proxy->proxy.source_visible, params[3]); + proxy = (Edje_Part_Description_Proxy *)rp->custom->description; + GETINT(proxy->proxy.source_visible, params[3]); + + break; + } - break; - } #ifdef HAVE_EPHYSICS case EDJE_STATE_PARAM_PHYSICS_MASS: - CHKPARAM(3); + CHKPARAM(3); - GETFLOAT_T(rp->custom->description->physics.mass, params[3]); + GETFLOAT_T(rp->custom->description->physics.mass, params[3]); + + break; - break; case EDJE_STATE_PARAM_PHYSICS_RESTITUTION: - CHKPARAM(3); + CHKPARAM(3); - GETFLOAT_T(rp->custom->description->physics.restitution, params[3]); + GETFLOAT_T(rp->custom->description->physics.restitution, params[3]); + + break; - break; case EDJE_STATE_PARAM_PHYSICS_FRICTION: - CHKPARAM(3); + CHKPARAM(3); - GETFLOAT_T(rp->custom->description->physics.friction, params[3]); + GETFLOAT_T(rp->custom->description->physics.friction, params[3]); + + break; - break; case EDJE_STATE_PARAM_PHYSICS_DAMPING: - CHKPARAM(4); + CHKPARAM(4); - GETFLOAT_T(rp->custom->description->physics.damping.linear, params[3]); - GETFLOAT_T(rp->custom->description->physics.damping.angular, - params[4]); + GETFLOAT_T(rp->custom->description->physics.damping.linear, params[3]); + GETFLOAT_T(rp->custom->description->physics.damping.angular, + params[4]); + + break; - break; case EDJE_STATE_PARAM_PHYSICS_SLEEP: - CHKPARAM(4); + CHKPARAM(4); - GETFLOAT_T(rp->custom->description->physics.sleep.linear, params[3]); - GETFLOAT_T(rp->custom->description->physics.sleep.angular, params[4]); + GETFLOAT_T(rp->custom->description->physics.sleep.linear, params[3]); + GETFLOAT_T(rp->custom->description->physics.sleep.angular, params[4]); + + break; - break; case EDJE_STATE_PARAM_PHYSICS_MATERIAL: - CHKPARAM(3); + CHKPARAM(3); + + GETINT(rp->custom->description->physics.material, params[3]); + break; - GETINT(rp->custom->description->physics.material, params[3]); - break; case EDJE_STATE_PARAM_PHYSICS_DENSITY: - CHKPARAM(3); + CHKPARAM(3); + + GETFLOAT_T(rp->custom->description->physics.density, params[3]); + break; - GETFLOAT_T(rp->custom->description->physics.density, params[3]); - break; case EDJE_STATE_PARAM_PHYSICS_HARDNESS: - CHKPARAM(3); + CHKPARAM(3); + + GETFLOAT_T(rp->custom->description->physics.hardness, params[3]); + break; - GETFLOAT_T(rp->custom->description->physics.hardness, params[3]); - break; case EDJE_STATE_PARAM_PHYSICS_IGNORE_PART_POS: - CHKPARAM(3); + CHKPARAM(3); + + GETINT(rp->custom->description->physics.ignore_part_pos, params[3]); + break; - GETINT(rp->custom->description->physics.ignore_part_pos, params[3]); - break; case EDJE_STATE_PARAM_PHYSICS_LIGHT_ON: - CHKPARAM(3); + CHKPARAM(3); + + GETINT(rp->custom->description->physics.light_on, params[3]); + break; - GETINT(rp->custom->description->physics.light_on, params[3]); - break; case EDJE_STATE_PARAM_PHYSICS_MOV_FREEDOM_LIN: - CHKPARAM(5); + CHKPARAM(5); + + GETINT(rp->custom->description->physics.mov_freedom.lin.x, params[3]); + GETINT(rp->custom->description->physics.mov_freedom.lin.y, params[4]); + GETINT(rp->custom->description->physics.mov_freedom.lin.z, params[5]); + break; - GETINT(rp->custom->description->physics.mov_freedom.lin.x, params[3]); - GETINT(rp->custom->description->physics.mov_freedom.lin.y, params[4]); - GETINT(rp->custom->description->physics.mov_freedom.lin.z, params[5]); - break; case EDJE_STATE_PARAM_PHYSICS_MOV_FREEDOM_ANG: - CHKPARAM(5); + CHKPARAM(5); + + GETINT(rp->custom->description->physics.mov_freedom.ang.x, params[3]); + GETINT(rp->custom->description->physics.mov_freedom.ang.y, params[4]); + GETINT(rp->custom->description->physics.mov_freedom.ang.z, params[5]); + break; - GETINT(rp->custom->description->physics.mov_freedom.ang.x, params[3]); - GETINT(rp->custom->description->physics.mov_freedom.ang.y, params[4]); - GETINT(rp->custom->description->physics.mov_freedom.ang.z, params[5]); - break; case EDJE_STATE_PARAM_PHYSICS_BACK_CULL: - CHKPARAM(3); + CHKPARAM(3); + + GETINT(rp->custom->description->physics.backcull, params[3]); + break; - GETINT(rp->custom->description->physics.backcull, params[3]); - break; case EDJE_STATE_PARAM_PHYSICS_Z: - CHKPARAM(3); + CHKPARAM(3); + + GETINT(rp->custom->description->physics.z, params[3]); + break; - GETINT(rp->custom->description->physics.z, params[3]); - break; case EDJE_STATE_PARAM_PHYSICS_DEPTH: - CHKPARAM(3); + CHKPARAM(3); + + GETINT(rp->custom->description->physics.depth, params[3]); + break; - GETINT(rp->custom->description->physics.depth, params[3]); - break; #endif default: - break; + break; } #ifdef EDJE_CALC_CACHE @@ -2743,7 +2818,7 @@ _edje_embryo_fn_get_state_val(Embryo_Program *ep, Embryo_Cell *params) char *s; /* we need at least 3 arguments */ - if (params[0] < (int) (sizeof(Embryo_Cell) * 3)) + if (params[0] < (int)(sizeof(Embryo_Cell) * 3)) return 0; if (params[1] < 0) @@ -2759,570 +2834,629 @@ _edje_embryo_fn_get_state_val(Embryo_Program *ep, Embryo_Cell *params) switch (params[2]) { case EDJE_STATE_PARAM_ALIGNMENT: - CHKPARAM(4); + CHKPARAM(4); - SETFLOAT_T(rp->custom->description->align.x, params[3]); - SETFLOAT_T(rp->custom->description->align.y, params[4]); + SETFLOAT_T(rp->custom->description->align.x, params[3]); + SETFLOAT_T(rp->custom->description->align.y, params[4]); + + break; - break; case EDJE_STATE_PARAM_MIN: - CHKPARAM(4); + CHKPARAM(4); - SETINT(rp->custom->description->min.w, params[3]); - SETINT(rp->custom->description->min.h, params[4]); + SETINT(rp->custom->description->min.w, params[3]); + SETINT(rp->custom->description->min.h, params[4]); + + break; - break; case EDJE_STATE_PARAM_MAX: - CHKPARAM(4); + CHKPARAM(4); - SETINT(rp->custom->description->max.w, params[3]); - SETINT(rp->custom->description->max.h, params[4]); + SETINT(rp->custom->description->max.w, params[3]); + SETINT(rp->custom->description->max.h, params[4]); + + break; - break; case EDJE_STATE_PARAM_STEP: - CHKPARAM(4); + CHKPARAM(4); - SETINT(rp->custom->description->step.x, params[3]); - SETINT(rp->custom->description->step.y, params[4]); + SETINT(rp->custom->description->step.x, params[3]); + SETINT(rp->custom->description->step.y, params[4]); + + break; - break; case EDJE_STATE_PARAM_ASPECT: - CHKPARAM(4); + CHKPARAM(4); - SETFLOAT_T(rp->custom->description->aspect.min, params[3]); - SETFLOAT_T(rp->custom->description->aspect.max, params[4]); + SETFLOAT_T(rp->custom->description->aspect.min, params[3]); + SETFLOAT_T(rp->custom->description->aspect.max, params[4]); + + break; + + case EDJE_STATE_PARAM_ASPECT_PREF: + CHKPARAM(3); + + SETINT(rp->custom->description->aspect.prefer, params[3]); + + break; + + case EDJE_STATE_PARAM_COLOR: + CHKPARAM(6); + + SETINT(rp->custom->description->color.r, params[3]); + SETINT(rp->custom->description->color.g, params[4]); + SETINT(rp->custom->description->color.b, params[5]); + SETINT(rp->custom->description->color.a, params[6]); + + break; + + case EDJE_STATE_PARAM_COLOR2: + CHKPARAM(6); + + SETINT(rp->custom->description->color2.r, params[3]); + SETINT(rp->custom->description->color2.g, params[4]); + SETINT(rp->custom->description->color2.b, params[5]); + SETINT(rp->custom->description->color2.a, params[6]); + + break; + + case EDJE_STATE_PARAM_COLOR3: + { + Edje_Part_Description_Text *text; + + if (rp->part->type == EDJE_PART_TYPE_TEXT + || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK) + return 0; + + CHKPARAM(6); + + text = (Edje_Part_Description_Text *)rp->custom->description; + + SETINT(text->text.color3.r, params[3]); + SETINT(text->text.color3.g, params[4]); + SETINT(text->text.color3.b, params[5]); + SETINT(text->text.color3.a, params[6]); break; - case EDJE_STATE_PARAM_ASPECT_PREF: + } + + case EDJE_STATE_PARAM_COLOR_CLASS: + CHKPARAM(4); + + s = rp->custom->description->color_class; + SETSTRALLOCATE(s); + + break; + + case EDJE_STATE_PARAM_REL1: + CHKPARAM(4); + + SETFLOAT_T(rp->custom->description->rel1.relative_x, params[3]); + SETFLOAT_T(rp->custom->description->rel1.relative_y, params[4]); + + break; + + case EDJE_STATE_PARAM_REL1_TO: + CHKPARAM(4); + + SETINT(rp->custom->description->rel1.id_x, params[3]); + SETINT(rp->custom->description->rel1.id_y, params[4]); + + break; + + case EDJE_STATE_PARAM_REL1_OFFSET: + CHKPARAM(4); + + SETINT(rp->custom->description->rel1.offset_x, params[3]); + SETINT(rp->custom->description->rel1.offset_y, params[4]); + + break; + + case EDJE_STATE_PARAM_REL2: + CHKPARAM(4); + + SETFLOAT_T(rp->custom->description->rel2.relative_x, params[3]); + SETFLOAT_T(rp->custom->description->rel2.relative_y, params[4]); + + break; + + case EDJE_STATE_PARAM_REL2_TO: + CHKPARAM(4); + + SETINT(rp->custom->description->rel2.id_x, params[3]); + SETINT(rp->custom->description->rel2.id_y, params[4]); + + break; + + case EDJE_STATE_PARAM_REL2_OFFSET: + CHKPARAM(4); + + SETINT(rp->custom->description->rel2.offset_x, params[3]); + SETINT(rp->custom->description->rel2.offset_y, params[4]); + + break; + + case EDJE_STATE_PARAM_IMAGE: + { + Edje_Part_Description_Image *img; + + if ((rp->part->type != EDJE_PART_TYPE_IMAGE)) return 0; CHKPARAM(3); - SETINT(rp->custom->description->aspect.prefer, params[3]); + img = (Edje_Part_Description_Image *)rp->custom->description; + + SETINT(img->image.id, params[3]); break; - case EDJE_STATE_PARAM_COLOR: + } + + case EDJE_STATE_PARAM_BORDER: + { + Edje_Part_Description_Image *img; + + if ((rp->part->type != EDJE_PART_TYPE_IMAGE)) return 0; CHKPARAM(6); - SETINT(rp->custom->description->color.r, params[3]); - SETINT(rp->custom->description->color.g, params[4]); - SETINT(rp->custom->description->color.b, params[5]); - SETINT(rp->custom->description->color.a, params[6]); + img = (Edje_Part_Description_Image *)rp->custom->description; + + SETINT(img->image.border.l, params[3]); + SETINT(img->image.border.r, params[4]); + SETINT(img->image.border.t, params[5]); + SETINT(img->image.border.b, params[6]); break; - case EDJE_STATE_PARAM_COLOR2: - CHKPARAM(6); + } - SETINT(rp->custom->description->color2.r, params[3]); - SETINT(rp->custom->description->color2.g, params[4]); - SETINT(rp->custom->description->color2.b, params[5]); - SETINT(rp->custom->description->color2.a, params[6]); + case EDJE_STATE_PARAM_FILL_SMOOTH: + { + Edje_Part_Description_Image *img; + Edje_Part_Description_Proxy *proxy; - break; - case EDJE_STATE_PARAM_COLOR3: + if ((rp->part->type != EDJE_PART_TYPE_IMAGE) && (rp->part->type != EDJE_PART_TYPE_PROXY)) return 0; + CHKPARAM(3); + + if (rp->part->type == EDJE_PART_TYPE_IMAGE) { - Edje_Part_Description_Text *text; + img = (Edje_Part_Description_Image *)rp->custom->description; - if (rp->part->type == EDJE_PART_TYPE_TEXT - || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK) - return 0; - - CHKPARAM(6); - - text = (Edje_Part_Description_Text*) rp->custom->description; - - SETINT(text->text.color3.r, params[3]); - SETINT(text->text.color3.g, params[4]); - SETINT(text->text.color3.b, params[5]); - SETINT(text->text.color3.a, params[6]); - - break; + SETINT(img->image.fill.smooth, params[3]); } - case EDJE_STATE_PARAM_COLOR_CLASS: + else + { + proxy = (Edje_Part_Description_Proxy *)rp->custom->description; + + SETINT(proxy->proxy.fill.smooth, params[3]); + } + + break; + } + + case EDJE_STATE_PARAM_FILL_POS: + { + Edje_Part_Description_Image *img; + Edje_Part_Description_Proxy *proxy; + + if ((rp->part->type != EDJE_PART_TYPE_IMAGE) && (rp->part->type != EDJE_PART_TYPE_PROXY)) return 0; + CHKPARAM(6); + + if (rp->part->type == EDJE_PART_TYPE_IMAGE) + { + img = (Edje_Part_Description_Image *)rp->custom->description; + + SETFLOAT_T(img->image.fill.pos_rel_x, params[3]); + SETFLOAT_T(img->image.fill.pos_rel_y, params[4]); + SETINT(img->image.fill.pos_abs_x, params[5]); + SETINT(img->image.fill.pos_abs_y, params[6]); + } + else + { + proxy = (Edje_Part_Description_Proxy *)rp->custom->description; + + SETFLOAT_T(proxy->proxy.fill.pos_rel_x, params[3]); + SETFLOAT_T(proxy->proxy.fill.pos_rel_y, params[4]); + SETINT(proxy->proxy.fill.pos_abs_x, params[5]); + SETINT(proxy->proxy.fill.pos_abs_y, params[6]); + } + + break; + } + + case EDJE_STATE_PARAM_FILL_SIZE: + { + Edje_Part_Description_Image *img; + Edje_Part_Description_Proxy *proxy; + + if ((rp->part->type != EDJE_PART_TYPE_IMAGE) && (rp->part->type != EDJE_PART_TYPE_PROXY)) return 0; + CHKPARAM(6); + + if (rp->part->type == EDJE_PART_TYPE_IMAGE) + { + img = (Edje_Part_Description_Image *)rp->custom->description; + + SETFLOAT_T(img->image.fill.rel_x, params[3]); + SETFLOAT_T(img->image.fill.rel_y, params[4]); + SETINT(img->image.fill.abs_x, params[5]); + SETINT(img->image.fill.abs_y, params[6]); + } + else + { + proxy = (Edje_Part_Description_Proxy *)rp->custom->description; + + SETFLOAT_T(proxy->proxy.fill.rel_x, params[3]); + SETFLOAT_T(proxy->proxy.fill.rel_y, params[4]); + SETINT(proxy->proxy.fill.abs_x, params[5]); + SETINT(proxy->proxy.fill.abs_y, params[6]); + } + + break; + } + + case EDJE_STATE_PARAM_TEXT: + { + Edje_Part_Description_Text *text; + + if ((rp->part->type != EDJE_PART_TYPE_TEXT) && + (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) + return 0; + CHKPARAM(4); - s = rp->custom->description->color_class; + text = (Edje_Part_Description_Text *)rp->custom->description; + + s = (char *)text->text.text.str; SETSTRALLOCATE(s); break; - case EDJE_STATE_PARAM_REL1: - CHKPARAM(4); + } - SETFLOAT_T(rp->custom->description->rel1.relative_x, params[3]); - SETFLOAT_T(rp->custom->description->rel1.relative_y, params[4]); - - break; - case EDJE_STATE_PARAM_REL1_TO: - CHKPARAM(4); - - SETINT(rp->custom->description->rel1.id_x, params[3]); - SETINT(rp->custom->description->rel1.id_y, params[4]); - - break; - case EDJE_STATE_PARAM_REL1_OFFSET: - CHKPARAM(4); - - SETINT(rp->custom->description->rel1.offset_x, params[3]); - SETINT(rp->custom->description->rel1.offset_y, params[4]); - - break; - case EDJE_STATE_PARAM_REL2: - CHKPARAM(4); - - SETFLOAT_T(rp->custom->description->rel2.relative_x, params[3]); - SETFLOAT_T(rp->custom->description->rel2.relative_y, params[4]); - - break; - case EDJE_STATE_PARAM_REL2_TO: - CHKPARAM(4); - - SETINT(rp->custom->description->rel2.id_x, params[3]); - SETINT(rp->custom->description->rel2.id_y, params[4]); - - break; - case EDJE_STATE_PARAM_REL2_OFFSET: - CHKPARAM(4); - - SETINT(rp->custom->description->rel2.offset_x, params[3]); - SETINT(rp->custom->description->rel2.offset_y, params[4]); - - break; - case EDJE_STATE_PARAM_IMAGE: - { - Edje_Part_Description_Image *img; - - if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0; - CHKPARAM(3); - - img = (Edje_Part_Description_Image*) rp->custom->description; - - SETINT(img->image.id, params[3]); - - break; - } - case EDJE_STATE_PARAM_BORDER: - { - Edje_Part_Description_Image *img; - - if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) ) return 0; - CHKPARAM(6); - - img = (Edje_Part_Description_Image*) rp->custom->description; - - SETINT(img->image.border.l, params[3]); - SETINT(img->image.border.r, params[4]); - SETINT(img->image.border.t, params[5]); - SETINT(img->image.border.b, params[6]); - - break; - } - case EDJE_STATE_PARAM_FILL_SMOOTH: - { - Edje_Part_Description_Image *img; - Edje_Part_Description_Proxy *proxy; - - if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) && (rp->part->type != EDJE_PART_TYPE_PROXY) ) return 0; - CHKPARAM(3); - - if (rp->part->type == EDJE_PART_TYPE_IMAGE) - { - img = (Edje_Part_Description_Image*) rp->custom->description; - - SETINT(img->image.fill.smooth, params[3]); - } - else - { - proxy = (Edje_Part_Description_Proxy*) rp->custom->description; - - SETINT(proxy->proxy.fill.smooth, params[3]); - } - - break; - } - case EDJE_STATE_PARAM_FILL_POS: - { - Edje_Part_Description_Image *img; - Edje_Part_Description_Proxy *proxy; - - if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) && (rp->part->type != EDJE_PART_TYPE_PROXY) ) return 0; - CHKPARAM(6); - - if (rp->part->type == EDJE_PART_TYPE_IMAGE) - { - img = (Edje_Part_Description_Image*) rp->custom->description; - - SETFLOAT_T(img->image.fill.pos_rel_x, params[3]); - SETFLOAT_T(img->image.fill.pos_rel_y, params[4]); - SETINT(img->image.fill.pos_abs_x, params[5]); - SETINT(img->image.fill.pos_abs_y, params[6]); - } - else - { - proxy = (Edje_Part_Description_Proxy*) rp->custom->description; - - SETFLOAT_T(proxy->proxy.fill.pos_rel_x, params[3]); - SETFLOAT_T(proxy->proxy.fill.pos_rel_y, params[4]); - SETINT(proxy->proxy.fill.pos_abs_x, params[5]); - SETINT(proxy->proxy.fill.pos_abs_y, params[6]); - } - - break; - } - case EDJE_STATE_PARAM_FILL_SIZE: - { - Edje_Part_Description_Image *img; - Edje_Part_Description_Proxy *proxy; - - if ( (rp->part->type != EDJE_PART_TYPE_IMAGE) && (rp->part->type != EDJE_PART_TYPE_PROXY) ) return 0; - CHKPARAM(6); - - if (rp->part->type == EDJE_PART_TYPE_IMAGE) - { - img = (Edje_Part_Description_Image*) rp->custom->description; - - SETFLOAT_T(img->image.fill.rel_x, params[3]); - SETFLOAT_T(img->image.fill.rel_y, params[4]); - SETINT(img->image.fill.abs_x, params[5]); - SETINT(img->image.fill.abs_y, params[6]); - } - else - { - proxy = (Edje_Part_Description_Proxy*) rp->custom->description; - - SETFLOAT_T(proxy->proxy.fill.rel_x, params[3]); - SETFLOAT_T(proxy->proxy.fill.rel_y, params[4]); - SETINT(proxy->proxy.fill.abs_x, params[5]); - SETINT(proxy->proxy.fill.abs_y, params[6]); - } - - break; - } - case EDJE_STATE_PARAM_TEXT: - { - Edje_Part_Description_Text *text; - - if ((rp->part->type != EDJE_PART_TYPE_TEXT) && - (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; - - CHKPARAM(4); - - text = (Edje_Part_Description_Text*) rp->custom->description; - - s = (char *)text->text.text.str; - SETSTRALLOCATE(s); - - break; - } case EDJE_STATE_PARAM_TEXT_CLASS: - { - Edje_Part_Description_Text *text; + { + Edje_Part_Description_Text *text; - if ( (rp->part->type != EDJE_PART_TYPE_TEXT) && - (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; + if ((rp->part->type != EDJE_PART_TYPE_TEXT) && + (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) + return 0; - CHKPARAM(4); + CHKPARAM(4); - text = (Edje_Part_Description_Text*) rp->custom->description; + text = (Edje_Part_Description_Text *)rp->custom->description; - s = text->text.text_class; - SETSTRALLOCATE(s); + s = text->text.text_class; + SETSTRALLOCATE(s); + + break; + } - break; - } case EDJE_STATE_PARAM_TEXT_FONT: - { - Edje_Part_Description_Text *text; + { + Edje_Part_Description_Text *text; - if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; + if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; - CHKPARAM(4); + CHKPARAM(4); - text = (Edje_Part_Description_Text*) rp->custom->description; + text = (Edje_Part_Description_Text *)rp->custom->description; - s = (char *)text->text.font.str; - SETSTRALLOCATE(s); + s = (char *)text->text.font.str; + SETSTRALLOCATE(s); + + break; + } - break; - } case EDJE_STATE_PARAM_TEXT_STYLE: - { - Edje_Part_Description_Text *text; + { + Edje_Part_Description_Text *text; - if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return 0; + if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return 0; - CHKPARAM(4); + CHKPARAM(4); - text = (Edje_Part_Description_Text*) rp->custom->description; + text = (Edje_Part_Description_Text *)rp->custom->description; - s = (char *)text->text.style.str; - SETSTRALLOCATE(s); + s = (char *)text->text.style.str; + SETSTRALLOCATE(s); + + break; + } - break; - } case EDJE_STATE_PARAM_TEXT_SIZE: - { - Edje_Part_Description_Text *text; + { + Edje_Part_Description_Text *text; - if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; + if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; - CHKPARAM(3); + CHKPARAM(3); - text = (Edje_Part_Description_Text*) rp->custom->description; + text = (Edje_Part_Description_Text *)rp->custom->description; - SETINT(text->text.size, params[3]); + SETINT(text->text.size, params[3]); + + break; + } - break; - } case EDJE_STATE_PARAM_TEXT_FIT: - { - Edje_Part_Description_Text *text; + { + Edje_Part_Description_Text *text; - if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; - CHKPARAM(4); + if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; + CHKPARAM(4); - text = (Edje_Part_Description_Text*) rp->custom->description; + text = (Edje_Part_Description_Text *)rp->custom->description; - SETINT(text->text.fit_x, params[3]); - SETINT(text->text.fit_y, params[4]); + SETINT(text->text.fit_x, params[3]); + SETINT(text->text.fit_y, params[4]); + + break; + } - break; - } case EDJE_STATE_PARAM_TEXT_MIN: - { - Edje_Part_Description_Text *text; + { + Edje_Part_Description_Text *text; - if ( (rp->part->type != EDJE_PART_TYPE_TEXT) && - (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; + if ((rp->part->type != EDJE_PART_TYPE_TEXT) && + (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) + return 0; - CHKPARAM(4); + CHKPARAM(4); - text = (Edje_Part_Description_Text*) rp->custom->description; + text = (Edje_Part_Description_Text *)rp->custom->description; - SETINT(text->text.min_x, params[3]); - SETINT(text->text.min_y, params[4]); + SETINT(text->text.min_x, params[3]); + SETINT(text->text.min_y, params[4]); + + break; + } - break; - } case EDJE_STATE_PARAM_TEXT_MAX: - { - Edje_Part_Description_Text *text; + { + Edje_Part_Description_Text *text; - if ( (rp->part->type != EDJE_PART_TYPE_TEXT) && - (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; + if ((rp->part->type != EDJE_PART_TYPE_TEXT) && + (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) + return 0; - CHKPARAM(4); + CHKPARAM(4); - text = (Edje_Part_Description_Text*) rp->custom->description; + text = (Edje_Part_Description_Text *)rp->custom->description; - SETINT(text->text.max_x, params[3]); - SETINT(text->text.max_y, params[4]); + SETINT(text->text.max_x, params[3]); + SETINT(text->text.max_y, params[4]); + + break; + } - break; - } case EDJE_STATE_PARAM_TEXT_ALIGN: - { - Edje_Part_Description_Text *text; + { + Edje_Part_Description_Text *text; - if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; + if ((rp->part->type != EDJE_PART_TYPE_TEXT)) return 0; - CHKPARAM(4); + CHKPARAM(4); - text = (Edje_Part_Description_Text*) rp->custom->description; + text = (Edje_Part_Description_Text *)rp->custom->description; - SETFLOAT_T(text->text.align.x, params[3]); - SETFLOAT_T(text->text.align.y, params[4]); + SETFLOAT_T(text->text.align.x, params[3]); + SETFLOAT_T(text->text.align.y, params[4]); + + break; + } - break; - } case EDJE_STATE_PARAM_VISIBLE: - CHKPARAM(3); + CHKPARAM(3); - SETINT(rp->custom->description->visible, params[3]); + SETINT(rp->custom->description->visible, params[3]); + + break; - break; case EDJE_STATE_PARAM_MAP_ON: - CHKPARAM(3); + CHKPARAM(3); - SETINT(rp->custom->description->map.on, params[3]); + SETINT(rp->custom->description->map.on, params[3]); + + break; - break; case EDJE_STATE_PARAM_MAP_PERSP: - CHKPARAM(3); + CHKPARAM(3); - SETINT(rp->custom->description->map.id_persp, params[3]); + SETINT(rp->custom->description->map.id_persp, params[3]); + + break; - break; case EDJE_STATE_PARAM_MAP_LIGHT: - CHKPARAM(3); + CHKPARAM(3); - SETINT(rp->custom->description->map.id_light, params[3]); + SETINT(rp->custom->description->map.id_light, params[3]); + + break; - break; case EDJE_STATE_PARAM_MAP_ROT_CENTER: - CHKPARAM(3); + CHKPARAM(3); - SETINT(rp->custom->description->map.rot.id_center, params[3]); + SETINT(rp->custom->description->map.rot.id_center, params[3]); + + break; - break; case EDJE_STATE_PARAM_MAP_ROT_X: - CHKPARAM(3); + CHKPARAM(3); - SETFLOAT_T(rp->custom->description->map.rot.x, params[3]); + SETFLOAT_T(rp->custom->description->map.rot.x, params[3]); + + break; - break; case EDJE_STATE_PARAM_MAP_ROT_Y: - CHKPARAM(3); + CHKPARAM(3); - SETFLOAT_T(rp->custom->description->map.rot.y, params[3]); + SETFLOAT_T(rp->custom->description->map.rot.y, params[3]); + + break; - break; case EDJE_STATE_PARAM_MAP_ROT_Z: - CHKPARAM(3); + CHKPARAM(3); - SETFLOAT_T(rp->custom->description->map.rot.z, params[3]); + SETFLOAT_T(rp->custom->description->map.rot.z, params[3]); + + break; - break; case EDJE_STATE_PARAM_MAP_BACK_CULL: - CHKPARAM(3); + CHKPARAM(3); - SETINT(rp->custom->description->map.backcull, params[3]); + SETINT(rp->custom->description->map.backcull, params[3]); + + break; - break; case EDJE_STATE_PARAM_MAP_PERSP_ON: - CHKPARAM(3); + CHKPARAM(3); - SETINT(rp->custom->description->map.persp_on, params[3]); + SETINT(rp->custom->description->map.persp_on, params[3]); + + break; - break; case EDJE_STATE_PARAM_PERSP_ZPLANE: - CHKPARAM(3); + CHKPARAM(3); - SETINT(rp->custom->description->persp.zplane, params[3]); + SETINT(rp->custom->description->persp.zplane, params[3]); + + break; - break; case EDJE_STATE_PARAM_PERSP_FOCAL: + CHKPARAM(3); + + SETINT(rp->custom->description->persp.focal, params[3]); + + break; + + case EDJE_STATE_PARAM_PROXY_SRC_CLIP: + { + Edje_Part_Description_Proxy *proxy; + + if ((rp->part->type != EDJE_PART_TYPE_PROXY)) return 0; CHKPARAM(3); - SETINT(rp->custom->description->persp.focal, params[3]); + proxy = (Edje_Part_Description_Proxy *)rp->custom->description; + SETINT(proxy->proxy.source_clip, params[3]); break; - case EDJE_STATE_PARAM_PROXY_SRC_CLIP: - { - Edje_Part_Description_Proxy *proxy; + } - if ((rp->part->type != EDJE_PART_TYPE_PROXY)) return 0; - CHKPARAM(3); - - proxy = (Edje_Part_Description_Proxy*) rp->custom->description; - SETINT(proxy->proxy.source_clip, params[3]); - - break; - } case EDJE_STATE_PARAM_PROXY_SRC_VISIBLE: - { - Edje_Part_Description_Proxy *proxy; + { + Edje_Part_Description_Proxy *proxy; - if ((rp->part->type != EDJE_PART_TYPE_PROXY)) return 0; - CHKPARAM(3); + if ((rp->part->type != EDJE_PART_TYPE_PROXY)) return 0; + CHKPARAM(3); - proxy = (Edje_Part_Description_Proxy*) rp->custom->description; - SETINT(proxy->proxy.source_visible, params[3]); + proxy = (Edje_Part_Description_Proxy *)rp->custom->description; + SETINT(proxy->proxy.source_visible, params[3]); + + break; + } - break; - } #ifdef HAVE_EPHYSICS case EDJE_STATE_PARAM_PHYSICS_MASS: - CHKPARAM(3); + CHKPARAM(3); - SETFLOAT_T(rp->custom->description->physics.mass, params[3]); + SETFLOAT_T(rp->custom->description->physics.mass, params[3]); + + break; - break; case EDJE_STATE_PARAM_PHYSICS_RESTITUTION: - CHKPARAM(3); + CHKPARAM(3); - SETFLOAT_T(rp->custom->description->physics.restitution, params[3]); + SETFLOAT_T(rp->custom->description->physics.restitution, params[3]); + + break; - break; case EDJE_STATE_PARAM_PHYSICS_FRICTION: - CHKPARAM(3); + CHKPARAM(3); - SETFLOAT_T(rp->custom->description->physics.friction, params[3]); + SETFLOAT_T(rp->custom->description->physics.friction, params[3]); + + break; - break; case EDJE_STATE_PARAM_PHYSICS_DAMPING: - CHKPARAM(4); + CHKPARAM(4); - SETFLOAT_T(rp->custom->description->physics.damping.linear, params[3]); - SETFLOAT_T(rp->custom->description->physics.damping.angular, - params[4]); + SETFLOAT_T(rp->custom->description->physics.damping.linear, params[3]); + SETFLOAT_T(rp->custom->description->physics.damping.angular, + params[4]); + + break; - break; case EDJE_STATE_PARAM_PHYSICS_SLEEP: - CHKPARAM(4); + CHKPARAM(4); - SETFLOAT_T(rp->custom->description->physics.sleep.linear, params[3]); - SETFLOAT_T(rp->custom->description->physics.sleep.angular, params[4]); + SETFLOAT_T(rp->custom->description->physics.sleep.linear, params[3]); + SETFLOAT_T(rp->custom->description->physics.sleep.angular, params[4]); + + break; - break; case EDJE_STATE_PARAM_PHYSICS_MATERIAL: - CHKPARAM(3); + CHKPARAM(3); + + SETINT(rp->custom->description->physics.material, params[3]); + break; - SETINT(rp->custom->description->physics.material, params[3]); - break; case EDJE_STATE_PARAM_PHYSICS_DENSITY: - CHKPARAM(3); + CHKPARAM(3); + + SETFLOAT_T(rp->custom->description->physics.density, params[3]); + break; - SETFLOAT_T(rp->custom->description->physics.density, params[3]); - break; case EDJE_STATE_PARAM_PHYSICS_HARDNESS: - CHKPARAM(3); + CHKPARAM(3); + + SETFLOAT_T(rp->custom->description->physics.hardness, params[3]); + break; - SETFLOAT_T(rp->custom->description->physics.hardness, params[3]); - break; case EDJE_STATE_PARAM_PHYSICS_IGNORE_PART_POS: - CHKPARAM(3); + CHKPARAM(3); + + SETINT(rp->custom->description->physics.ignore_part_pos, params[3]); + break; - SETINT(rp->custom->description->physics.ignore_part_pos, params[3]); - break; case EDJE_STATE_PARAM_PHYSICS_LIGHT_ON: - CHKPARAM(3); + CHKPARAM(3); + + SETINT(rp->custom->description->physics.light_on, params[3]); + break; - SETINT(rp->custom->description->physics.light_on, params[3]); - break; case EDJE_STATE_PARAM_PHYSICS_MOV_FREEDOM_LIN: - CHKPARAM(5); + CHKPARAM(5); + + SETINT(rp->custom->description->physics.mov_freedom.lin.x, params[3]); + SETINT(rp->custom->description->physics.mov_freedom.lin.y, params[4]); + SETINT(rp->custom->description->physics.mov_freedom.lin.z, params[5]); + break; - SETINT(rp->custom->description->physics.mov_freedom.lin.x, params[3]); - SETINT(rp->custom->description->physics.mov_freedom.lin.y, params[4]); - SETINT(rp->custom->description->physics.mov_freedom.lin.z, params[5]); - break; case EDJE_STATE_PARAM_PHYSICS_MOV_FREEDOM_ANG: - CHKPARAM(5); + CHKPARAM(5); + + SETINT(rp->custom->description->physics.mov_freedom.ang.x, params[3]); + SETINT(rp->custom->description->physics.mov_freedom.ang.y, params[4]); + SETINT(rp->custom->description->physics.mov_freedom.ang.z, params[5]); + break; - SETINT(rp->custom->description->physics.mov_freedom.ang.x, params[3]); - SETINT(rp->custom->description->physics.mov_freedom.ang.y, params[4]); - SETINT(rp->custom->description->physics.mov_freedom.ang.z, params[5]); - break; case EDJE_STATE_PARAM_PHYSICS_BACK_CULL: - CHKPARAM(3); + CHKPARAM(3); + + SETINT(rp->custom->description->physics.backcull, params[3]); + break; - SETINT(rp->custom->description->physics.backcull, params[3]); - break; case EDJE_STATE_PARAM_PHYSICS_Z: - CHKPARAM(3); + CHKPARAM(3); + + SETINT(rp->custom->description->physics.z, params[3]); + break; - SETINT(rp->custom->description->physics.z, params[3]); - break; case EDJE_STATE_PARAM_PHYSICS_DEPTH: - CHKPARAM(3); + CHKPARAM(3); + + SETINT(rp->custom->description->physics.depth, params[3]); + break; - SETINT(rp->custom->description->physics.depth, params[3]); - break; #endif default: - break; + break; } return 0; @@ -3333,7 +3467,7 @@ static Embryo_Cell _edje_embryo_fn_part_swallow(Embryo_Program *ep, Embryo_Cell *params) { int part_id = 0; - char* group_name = 0; + char *group_name = 0; Edje *ed; Edje_Real_Part *rp; Evas_Object *new_obj; @@ -3351,10 +3485,10 @@ _edje_embryo_fn_part_swallow(Embryo_Program *ep, Embryo_Cell *params) rp = ed->table_parts[part_id % ed->table_parts_size]; if (!rp) return 0; - new_obj = edje_object_add(ed->base->evas); + new_obj = edje_object_add(ed->base->evas); if (!new_obj) return 0; - if (!edje_object_file_set(new_obj, ed->file->path, group_name)) + if (!edje_object_file_set(new_obj, ed->file->path, group_name)) { evas_object_del(new_obj); return 0; @@ -3533,12 +3667,12 @@ _edje_embryo_fn_external_param_get_str(Embryo_Program *ep, Embryo_Cell *params) { char *tmp = alloca(dst_len); memcpy(tmp, eep.s, dst_len - 1); - tmp[dst_len-1] = '\0'; + tmp[dst_len - 1] = '\0'; SETSTR(tmp, params[3]); } return 1; - error: +error: SETSTR("", params[3]); return 0; } @@ -3634,12 +3768,12 @@ _edje_embryo_fn_external_param_get_choice(Embryo_Program *ep, Embryo_Cell *param { char *tmp = alloca(dst_len); memcpy(tmp, eep.s, dst_len - 1); - tmp[dst_len-1] = '\0'; + tmp[dst_len - 1] = '\0'; SETSTR(tmp, params[3]); } return 1; - error: +error: SETSTR("", params[3]); return 0; } @@ -3724,8 +3858,8 @@ _edje_embryo_fn_external_param_set_bool(Embryo_Program *ep, Embryo_Cell *params) #ifdef HAVE_EPHYSICS /* Generic function to call ephysics functions that apply an action to - * a body using 3 double values. - * To be used by the other functions only avoiding code duplication. */ +* a body using 3 double values. +* To be used by the other functions only avoiding code duplication. */ static Embryo_Cell _edje_embryo_fn_physics_components_set(Embryo_Program *ep, Embryo_Cell *params, void (*func)(EPhysics_Body *body, double x, double y, double z)) { @@ -3744,9 +3878,9 @@ _edje_embryo_fn_physics_components_set(Embryo_Program *ep, Embryo_Cell *params, { double x, y, z; - x = (double) EMBRYO_CELL_TO_FLOAT(params[2]); - y = (double) EMBRYO_CELL_TO_FLOAT(params[3]); - z = (double) EMBRYO_CELL_TO_FLOAT(params[4]); + x = (double)EMBRYO_CELL_TO_FLOAT(params[2]); + y = (double)EMBRYO_CELL_TO_FLOAT(params[3]); + z = (double)EMBRYO_CELL_TO_FLOAT(params[4]); func(rp->body, x, y, z); } @@ -3788,7 +3922,7 @@ static Embryo_Cell _edje_embryo_fn_physics_impulse(Embryo_Program *ep, Embryo_Cell *params) { return _edje_embryo_fn_physics_components_set( - ep, params, ephysics_body_central_impulse_apply); + ep, params, ephysics_body_central_impulse_apply); } /* physics_torque_impulse(part_id, Float:x, Float:y, Float:z) */ @@ -3796,7 +3930,7 @@ static Embryo_Cell _edje_embryo_fn_physics_torque_impulse(Embryo_Program *ep, Embryo_Cell *params) { return _edje_embryo_fn_physics_components_set( - ep, params, ephysics_body_torque_impulse_apply); + ep, params, ephysics_body_torque_impulse_apply); } /* physics_force(part_id, Float:x, Float:y, Float:z) */ @@ -3804,7 +3938,7 @@ static Embryo_Cell _edje_embryo_fn_physics_force(Embryo_Program *ep, Embryo_Cell *params) { return _edje_embryo_fn_physics_components_set( - ep, params, ephysics_body_central_force_apply); + ep, params, ephysics_body_central_force_apply); } /* physics_torque(part_id, Float:x, Float:y, Float:z) */ @@ -3812,7 +3946,7 @@ static Embryo_Cell _edje_embryo_fn_physics_torque(Embryo_Program *ep, Embryo_Cell *params) { return _edje_embryo_fn_physics_components_set( - ep, params, ephysics_body_torque_apply); + ep, params, ephysics_body_torque_apply); } /* physics_clear_forces(part_id) */ @@ -3841,7 +3975,7 @@ static Embryo_Cell _edje_embryo_fn_physics_get_forces(Embryo_Program *ep, Embryo_Cell *params) { return _edje_embryo_fn_physics_components_get( - ep, params, ephysics_body_forces_get); + ep, params, ephysics_body_forces_get); } /* physics_get_torques(part_id, &Float:x, &Float:y, &Float:z) */ @@ -3849,7 +3983,7 @@ static Embryo_Cell _edje_embryo_fn_physics_get_torques(Embryo_Program *ep, Embryo_Cell *params) { return _edje_embryo_fn_physics_components_get( - ep, params, ephysics_body_torques_get); + ep, params, ephysics_body_torques_get); } /* physics_set_velocity(part_id, Float:x, Float:y, Float:z) */ @@ -3857,7 +3991,7 @@ static Embryo_Cell _edje_embryo_fn_physics_set_velocity(Embryo_Program *ep, Embryo_Cell *params) { return _edje_embryo_fn_physics_components_set( - ep, params, ephysics_body_linear_velocity_set); + ep, params, ephysics_body_linear_velocity_set); } /* physics_get_velocity(part_id, &Float:x, &Float:y, &Float:z) */ @@ -3865,7 +3999,7 @@ static Embryo_Cell _edje_embryo_fn_physics_get_velocity(Embryo_Program *ep, Embryo_Cell *params) { return _edje_embryo_fn_physics_components_get( - ep, params, ephysics_body_linear_velocity_get); + ep, params, ephysics_body_linear_velocity_get); } /* physics_set_ang_velocity(part_id, Float:x, Float:y, Float:z) */ @@ -3873,7 +4007,7 @@ static Embryo_Cell _edje_embryo_fn_physics_set_ang_velocity(Embryo_Program *ep, Embryo_Cell *params) { return _edje_embryo_fn_physics_components_set( - ep, params, ephysics_body_angular_velocity_set); + ep, params, ephysics_body_angular_velocity_set); } /* physics_get_ang_velocity(part_id, &Float:x, &Float:y, &Float:z) */ @@ -3881,7 +4015,7 @@ static Embryo_Cell _edje_embryo_fn_physics_get_ang_velocity(Embryo_Program *ep, Embryo_Cell *params) { return _edje_embryo_fn_physics_components_get( - ep, params, ephysics_body_angular_velocity_get); + ep, params, ephysics_body_angular_velocity_get); } /* physics_stop(part_id) */ @@ -3925,10 +4059,10 @@ _edje_embryo_fn_physics_set_rotation(Embryo_Program *ep, Embryo_Cell *params) EPhysics_Quaternion quat; double w, x, y, z; - w = (double) EMBRYO_CELL_TO_FLOAT(params[2]); - x = (double) EMBRYO_CELL_TO_FLOAT(params[3]); - y = (double) EMBRYO_CELL_TO_FLOAT(params[4]); - z = (double) EMBRYO_CELL_TO_FLOAT(params[5]); + w = (double)EMBRYO_CELL_TO_FLOAT(params[2]); + x = (double)EMBRYO_CELL_TO_FLOAT(params[3]); + y = (double)EMBRYO_CELL_TO_FLOAT(params[4]); + z = (double)EMBRYO_CELL_TO_FLOAT(params[5]); ephysics_quaternion_set(&quat, x, y, z, w); ephysics_quaternion_normalize(&quat); @@ -3969,6 +4103,7 @@ _edje_embryo_fn_physics_get_rotation(Embryo_Program *ep, Embryo_Cell *params) return 0; } + #endif void @@ -4203,3 +4338,4 @@ _edje_embryo_globals_init(Edje *ed) } } } + diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c index 7d816fdb9c..9c5c3325a9 100644 --- a/src/lib/edje/edje_entry.c +++ b/src/lib/edje/edje_entry.c @@ -9,8 +9,8 @@ static void _edje_entry_imf_event_selection_set_cb(void *data, Ecore_IMF_Co static Eina_Bool _edje_entry_imf_retrieve_selection_cb(void *data, Ecore_IMF_Context *ctx, char **text); #endif -typedef struct _Entry Entry; -typedef struct _Sel Sel; +typedef struct _Entry Entry; +typedef struct _Sel Sel; typedef struct _Anchor Anchor; static void _edje_entry_imf_cursor_location_set(Entry *en); @@ -20,54 +20,54 @@ static void _text_filter_format_prepend(Edje *ed, Entry *en, Evas_Textblock_Curs struct _Entry { - Edje_Real_Part *rp; - Edje *ed; - Evas_Coord ox, oy; - Evas_Object *cursor_bg; - Evas_Object *cursor_fg, *cursor_fg2; + Edje_Real_Part *rp; + Edje *ed; + Evas_Coord ox, oy; + Evas_Object *cursor_bg; + Evas_Object *cursor_fg, *cursor_fg2; Evas_Textblock_Cursor *cursor; Evas_Textblock_Cursor *sel_start, *sel_end; Evas_Textblock_Cursor *cursor_user, *cursor_user_extra; Evas_Textblock_Cursor *preedit_start, *preedit_end; - Ecore_Timer *pw_timer; - Eina_List *sel; - Eina_List *anchors; - Eina_List *anchorlist; - Eina_List *itemlist; - Eina_List *seq; - char *selection; - Edje_Input_Panel_Lang input_panel_lang; - Eina_Bool composing : 1; - Eina_Bool selecting : 1; - Eina_Bool have_selection : 1; - Eina_Bool select_allow : 1; - Eina_Bool select_mod_start : 1; - Eina_Bool select_mod_end : 1; - Eina_Bool had_sel : 1; - Eina_Bool input_panel_enable : 1; - Eina_Bool prediction_allow : 1; - Eina_Bool anchors_updated : 1; + Ecore_Timer *pw_timer; + Eina_List *sel; + Eina_List *anchors; + Eina_List *anchorlist; + Eina_List *itemlist; + Eina_List *seq; + char *selection; + Edje_Input_Panel_Lang input_panel_lang; + Eina_Bool composing : 1; + Eina_Bool selecting : 1; + Eina_Bool have_selection : 1; + Eina_Bool select_allow : 1; + Eina_Bool select_mod_start : 1; + Eina_Bool select_mod_end : 1; + Eina_Bool had_sel : 1; + Eina_Bool input_panel_enable : 1; + Eina_Bool prediction_allow : 1; + Eina_Bool anchors_updated : 1; #ifdef HAVE_ECORE_IMF - Eina_Bool have_preedit : 1; - Eina_Bool commit_cancel : 1; // For skipping useless commit - Ecore_IMF_Context *imf_context; + Eina_Bool have_preedit : 1; + Eina_Bool commit_cancel : 1; // For skipping useless commit + Ecore_IMF_Context *imf_context; #endif }; struct _Sel { Evas_Textblock_Rectangle rect; - Evas_Object *obj_fg, *obj_bg, *obj, *sobj; + Evas_Object *obj_fg, *obj_bg, *obj, *sobj; }; struct _Anchor { - Entry *en; - char *name; + Entry *en; + char *name; Evas_Textblock_Cursor *start, *end; - Eina_List *sel; - Eina_Bool item : 1; + Eina_List *sel; + Eina_Bool item : 1; }; #ifdef HAVE_ECORE_IMF @@ -142,6 +142,7 @@ _edje_entry_focus_out_cb(void *data, Evas_Object *o EINA_UNUSED, const char *emi ecore_imf_context_reset(en->imf_context); ecore_imf_context_focus_out(en->imf_context); } + #endif static void @@ -242,8 +243,9 @@ _text_filter_markup_prepend_internal(Edje *ed, Entry *en, Evas_Textblock_Cursor _range_del_emit(ed, en->cursor, en->rp->object, en); if (info) info->merge = EINA_TRUE; } - if (info) info->change.insert.pos = - evas_textblock_cursor_pos_get(en->cursor); + if (info) + info->change.insert.pos = + evas_textblock_cursor_pos_get(en->cursor); if (fmtpre) _text_filter_format_prepend(ed, en, en->cursor, fmtpre); evas_object_textblock_text_markup_prepend(c, text); free(text); @@ -282,8 +284,8 @@ _text_filter_text_prepend(Edje *ed, Entry *en, Evas_Textblock_Cursor *c, free(text2); if (markup_text) info = _text_filter_markup_prepend_internal(ed, en, c, markup_text, - fmtpre, fmtpost, - clearsel, changeinfo); + fmtpre, fmtpost, + clearsel, changeinfo); return info; } return NULL; @@ -314,13 +316,14 @@ _text_filter_format_prepend(Edje *ed, Entry *en, Evas_Textblock_Cursor *c, const if (*s == '+') { s++; - while (*s == ' ') s++; + while (*s == ' ') + s++; if (!*s) { free(text2); return; } - markup_text = (char*) malloc(strlen(s) + 3); + markup_text = (char *)malloc(strlen(s) + 3); if (markup_text) { *(markup_text) = '<'; @@ -332,13 +335,14 @@ _text_filter_format_prepend(Edje *ed, Entry *en, Evas_Textblock_Cursor *c, const else if (s[0] == '-') { s++; - while (*s == ' ') s++; + while (*s == ' ') + s++; if (!*s) { free(text2); return; } - markup_text = (char*) malloc(strlen(s) + 4); + markup_text = (char *)malloc(strlen(s) + 4); if (markup_text) { *(markup_text) = '<'; @@ -350,7 +354,7 @@ _text_filter_format_prepend(Edje *ed, Entry *en, Evas_Textblock_Cursor *c, const } else { - markup_text = (char*) malloc(strlen(s) + 4); + markup_text = (char *)malloc(strlen(s) + 4); if (markup_text) { *(markup_text) = '<'; @@ -409,12 +413,13 @@ _curs_update_from_curs(Evas_Textblock_Cursor *c, Evas_Object *o EINA_UNUSED, Ent switch (en->rp->part->cursor_mode) { case EDJE_ENTRY_CURSOR_MODE_BEFORE: - cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE; - break; + cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE; + break; + case EDJE_ENTRY_CURSOR_MODE_UNDER: - /* no break for a reason */ + /* no break for a reason */ default: - cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER; + cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER; } evas_textblock_cursor_geometry_get(c, cx, cy, &cw, &ch, NULL, cur_type); *cx += (cw / 2); @@ -627,7 +632,7 @@ _sel_update(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entr smart = evas_object_smart_parent_get(o); clip = evas_object_clip_get(o); if (!en->sel_start) - return; + return; evas_object_geometry_get(o, &x, &y, NULL, NULL); if (en->have_selection) @@ -907,8 +912,8 @@ _anchors_update(Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entry *en) if (ed->item_provider.func) { ob = ed->item_provider.func - (ed->item_provider.data, smart, - en->rp->part->name, an->name); + (ed->item_provider.data, smart, + en->rp->part->name, an->name); evas_object_smart_member_add(ob, smart); evas_object_stack_above(ob, o); evas_object_clip_set(ob, clip); @@ -983,7 +988,7 @@ _anchors_update(Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entry *en) Evas_Coord cx, cy, cw, ch; if (!evas_textblock_cursor_format_item_geometry_get - (an->start, &cx, &cy, &cw, &ch)) + (an->start, &cx, &cy, &cw, &ch)) continue; evas_object_move(sel->obj, x + cx, y + cy); evas_object_resize(sel->obj, cw, ch); @@ -1104,7 +1109,7 @@ _anchor_format_parse(const char *item) /* If we can find a quote as the first non-space char, * our new delimiter is a quote, not a space. */ while (*start == ' ') - start++; + start++; if (*start == '\'') { @@ -1224,7 +1229,7 @@ _anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en) static void _free_entry_change_info(void *_info) { - Edje_Entry_Change_Info *info = (Edje_Entry_Change_Info *) _info; + Edje_Entry_Change_Info *info = (Edje_Entry_Change_Info *)_info; if (info->insert) { eina_stringshare_del(info->change.insert.content); @@ -1246,7 +1251,7 @@ _range_del_emit(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o E start = evas_textblock_cursor_pos_get(en->sel_start); end = evas_textblock_cursor_pos_get(en->sel_end); if (start == end) - goto noop; + goto noop; info = calloc(1, sizeof(*info)); info->insert = EINA_FALSE; @@ -1318,7 +1323,7 @@ _edje_entry_hide_visible_password(Edje *ed, Edje_Real_Part *rp) if (!strcmp(text, "+ password=off")) { evas_textblock_node_format_remove_pair(rp->object, - (Evas_Object_Textblock_Node_Format *) node); + (Evas_Object_Textblock_Node_Format *)node); _edje_emit(ed, "entry,changed", rp->part->name); break; } @@ -1357,7 +1362,8 @@ _compose_seq_reset(Entry *en) { char *str; - EINA_LIST_FREE(en->seq, str) eina_stringshare_del(str); + EINA_LIST_FREE(en->seq, str) + eina_stringshare_del(str); en->composing = EINA_FALSE; } @@ -1734,12 +1740,12 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; } //else if ((control) && (!shift) && (!strcmp(ev->key, "w"))) - //{ - //_compose_seq_reset(en); - //_sel_clear(ed, en->cursor, rp->object, en); - //select current word? - //ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; - //} + //{ + //_compose_seq_reset(en); + //_sel_clear(ed, en->cursor, rp->object, en); + //select current word? + //ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + //} else if (!strcmp(ev->key, "Tab")) { _compose_seq_reset(en); @@ -1761,7 +1767,7 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, info->merge = EINA_TRUE; } info->change.insert.pos = - evas_textblock_cursor_pos_get(en->cursor); + evas_textblock_cursor_pos_get(en->cursor); info->change.insert.content = eina_stringshare_add(""); _text_filter_format_prepend(ed, en, en->cursor, "tab"); _anchors_get(en->cursor, rp->object, en); @@ -1839,7 +1845,7 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, } info->change.insert.pos = - evas_textblock_cursor_pos_get(en->cursor); + evas_textblock_cursor_pos_get(en->cursor); if (shift || evas_object_textblock_legacy_newline_get(rp->object)) { @@ -1939,7 +1945,7 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, } if (_edje_password_show_last_timeout >= 0) en->pw_timer = ecore_timer_add - (_edje_password_show_last_timeout, + (_edje_password_show_last_timeout, _password_timer_cb, en); } } @@ -1998,7 +2004,7 @@ _edje_key_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, v return; } #else - (void) event_info; + (void)event_info; #endif } @@ -2221,7 +2227,7 @@ _edje_part_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_ } } } - end: +end: if (evas_textblock_cursor_compare(tc, en->cursor)) { _edje_emit(en->ed, "cursor,changed", rp->part->name); @@ -2257,7 +2263,6 @@ _edje_part_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UN (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE)) return; - /* We don't check for ON_HOLD because we'd like to end selection anyway when * mouse is up, even if it's held. */ @@ -2321,12 +2326,12 @@ _edje_part_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UN if (en->had_sel) { if (en->select_mod_end) - _sel_extend(en->ed, en->cursor, rp->object, en); + _sel_extend(en->ed, en->cursor, rp->object, en); else if (en->select_mod_start) - _sel_preextend(en->ed, en->cursor, rp->object, en); + _sel_preextend(en->ed, en->cursor, rp->object, en); } else - _sel_extend(en->ed, en->cursor, rp->object, en); + _sel_extend(en->ed, en->cursor, rp->object, en); //evas_textblock_cursor_copy(en->cursor, en->sel_end); } else @@ -2422,12 +2427,12 @@ _edje_part_mouse_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_ if (en->had_sel) { if (en->select_mod_end) - _sel_extend(en->ed, en->cursor, rp->object, en); + _sel_extend(en->ed, en->cursor, rp->object, en); else if (en->select_mod_start) - _sel_preextend(en->ed, en->cursor, rp->object, en); + _sel_preextend(en->ed, en->cursor, rp->object, en); } else - _sel_extend(en->ed, en->cursor, rp->object, en); + _sel_extend(en->ed, en->cursor, rp->object, en); } else { @@ -2620,9 +2625,9 @@ _edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp) if (!en->imf_context) goto done; ecore_imf_context_client_window_set - (en->imf_context, - (void *)ecore_evas_window_get - (ecore_evas_ecore_evas_get(ed->base->evas))); + (en->imf_context, + (void *)ecore_evas_window_get + (ecore_evas_ecore_evas_get(ed->base->evas))); ecore_imf_context_client_canvas_set(en->imf_context, ed->base->evas); ecore_imf_context_retrieve_surrounding_callback_set(en->imf_context, @@ -2709,12 +2714,13 @@ _edje_entry_real_part_configure(Edje *ed, Edje_Real_Part *rp) switch (rp->part->cursor_mode) { case EDJE_ENTRY_CURSOR_MODE_BEFORE: - cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE; - break; + cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE; + break; + case EDJE_ENTRY_CURSOR_MODE_UNDER: - /* no break for a reason */ + /* no break for a reason */ default: - cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER; + cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER; } _sel_update(ed, en->cursor, rp->object, en); @@ -2765,7 +2771,7 @@ _edje_entry_selection_get(Edje_Real_Part *rp) // get selection - convert to markup if ((!en->selection) && (en->have_selection)) en->selection = evas_textblock_cursor_range_text_get - (en->sel_start, en->sel_end, EVAS_TEXTBLOCK_TEXT_MARKUP); + (en->sel_start, en->sel_end, EVAS_TEXTBLOCK_TEXT_MARKUP); return en->selection; } @@ -3069,12 +3075,13 @@ _edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord * switch (rp->part->cursor_mode) { case EDJE_ENTRY_CURSOR_MODE_BEFORE: - cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE; - break; + cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE; + break; + case EDJE_ENTRY_CURSOR_MODE_UNDER: - /* no break for a reason */ + /* no break for a reason */ default: - cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER; + cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER; } x = y = w = h = -1; @@ -3104,7 +3111,7 @@ _edje_entry_user_insert(Edje_Real_Part *rp, const char *text) if (!en) return; _edje_entry_imf_context_reset(rp); info = _text_filter_markup_prepend(en->ed, en, en->cursor, text, NULL, NULL, - EINA_TRUE, EINA_TRUE); + EINA_TRUE, EINA_TRUE); _anchors_get(en->cursor, rp->object, en); if (info) { @@ -3263,7 +3270,7 @@ _edje_entry_input_hint_set(Edje_Real_Part *rp, Edje_Input_Hints input_hints) if (en->imf_context) ecore_imf_context_input_hint_set(en->imf_context, (Ecore_IMF_Input_Hints)input_hints); #else - (void) input_hints; + (void)input_hints; #endif } @@ -3516,10 +3523,11 @@ _edje_entry_input_panel_show_on_demand_get(Edje_Real_Part *rp) en = rp->typedata.text->entry_data; if (!en) return EINA_FALSE; #ifdef HAVE_ECORE_IMF - if (en->imf_context) { - Eina_Bool ret = ecore_imf_context_input_panel_show_on_demand_get(en->imf_context); - return ret; - } + if (en->imf_context) + { + Eina_Bool ret = ecore_imf_context_input_panel_show_on_demand_get(en->imf_context); + return ret; + } #endif return EINA_FALSE; } @@ -3536,29 +3544,36 @@ _cursor_get(Edje_Real_Part *rp, Edje_Cursor cur) switch (cur) { case EDJE_CURSOR_MAIN: - return en->cursor; + return en->cursor; + case EDJE_CURSOR_SELECTION_BEGIN: - return en->sel_start; + return en->sel_start; + case EDJE_CURSOR_SELECTION_END: - return en->sel_end; + return en->sel_end; + case EDJE_CURSOR_PREEDIT_START: - if (!en->preedit_start) - en->preedit_start = evas_object_textblock_cursor_new(rp->object); - return en->preedit_start; + if (!en->preedit_start) + en->preedit_start = evas_object_textblock_cursor_new(rp->object); + return en->preedit_start; + case EDJE_CURSOR_PREEDIT_END: - if (!en->preedit_end) - en->preedit_end = evas_object_textblock_cursor_new(rp->object); - return en->preedit_end; + if (!en->preedit_end) + en->preedit_end = evas_object_textblock_cursor_new(rp->object); + return en->preedit_end; + case EDJE_CURSOR_USER: - if (!en->cursor_user) - en->cursor_user = evas_object_textblock_cursor_new(rp->object); - return en->cursor_user; + if (!en->cursor_user) + en->cursor_user = evas_object_textblock_cursor_new(rp->object); + return en->cursor_user; + case EDJE_CURSOR_USER_EXTRA: - if (!en->cursor_user_extra) - en->cursor_user_extra = evas_object_textblock_cursor_new(rp->object); - return en->cursor_user_extra; + if (!en->cursor_user_extra) + en->cursor_user_extra = evas_object_textblock_cursor_new(rp->object); + return en->cursor_user_extra; + default: - break; + break; } return NULL; } @@ -3808,7 +3823,7 @@ _edje_entry_cursor_coord_set(Edje_Real_Part *rp, Edje_Cursor cur, (cur == EDJE_CURSOR_SELECTION_END)) { if (en->have_selection) - _edje_emit(en->ed, "selection,changed", rp->part->name); + _edje_emit(en->ed, "selection,changed", rp->part->name); } return evas_textblock_cursor_char_coord_set(c, x, y); } @@ -3892,8 +3907,8 @@ _edje_entry_input_panel_layout_set(Edje_Real_Part *rp, Edje_Input_Panel_Layout l if (en->imf_context) ecore_imf_context_input_panel_layout_set(en->imf_context, (Ecore_IMF_Input_Panel_Layout)layout); #else - (void) rp; - (void) layout; + (void)rp; + (void)layout; #endif } @@ -3929,7 +3944,7 @@ _edje_entry_input_panel_layout_variation_set(Edje_Real_Part *rp, int variation) if (en->imf_context) ecore_imf_context_input_panel_layout_variation_set(en->imf_context, variation); #else - (void) variation; + (void)variation; #endif } @@ -3963,7 +3978,7 @@ _edje_entry_imf_context_reset(Edje_Real_Part *rp) if (en->imf_context) ecore_imf_context_reset(en->imf_context); if (en->commit_cancel) - en->commit_cancel = EINA_FALSE; + en->commit_cancel = EINA_FALSE; #else (void)rp; #endif @@ -3981,7 +3996,7 @@ _edje_entry_imf_cursor_location_set(Entry *en) ecore_imf_context_cursor_location_set(en->imf_context, cx, cy, cw, ch); ecore_imf_context_bidi_direction_set(en->imf_context, (Ecore_IMF_BiDi_Direction)dir); #else - (void) en; + (void)en; #endif } @@ -4007,7 +4022,7 @@ _edje_entry_imf_cursor_info_set(Entry *en) _edje_entry_imf_cursor_location_set(en); #else - (void) en; + (void)en; #endif } @@ -4119,7 +4134,7 @@ _edje_entry_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, } if (_edje_password_show_last_timeout >= 0) en->pw_timer = ecore_timer_add - (_edje_password_show_last_timeout, + (_edje_password_show_last_timeout, _password_timer_cb, en); } } @@ -4130,7 +4145,6 @@ _edje_entry_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, EINA_TRUE, EINA_TRUE); } - _edje_entry_imf_cursor_info_set(en); _anchors_get(en->cursor, rp->object, en); if (info) @@ -4154,8 +4168,10 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA int preedit_start_pos, preedit_end_pos; char *preedit_string; char *markup_txt = NULL; - char *tagname[] = {NULL, "preedit", "preedit_sel", "preedit_sel", - "preedit_sub1", "preedit_sub2", "preedit_sub3", "preedit_sub4"}; + char *tagname[] = { + NULL, "preedit", "preedit_sel", "preedit_sel", + "preedit_sub1", "preedit_sub2", "preedit_sub3", "preedit_sub4" + }; int i; size_t preedit_type_size = sizeof(tagname) / sizeof(tagname[0]); Eina_Bool preedit_end_state = EINA_FALSE; @@ -4225,7 +4241,7 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA // For skipping useless commit if (!preedit_end_state) - en->have_preedit = EINA_TRUE; + en->have_preedit = EINA_TRUE; if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) && _edje_password_show_last) @@ -4247,7 +4263,7 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA } if (_edje_password_show_last_timeout >= 0) en->pw_timer = ecore_timer_add - (_edje_password_show_last_timeout, + (_edje_password_show_last_timeout, _password_timer_cb, en); free(info); } @@ -4293,7 +4309,8 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA /* delete attribute list */ if (attrs) { - EINA_LIST_FREE(attrs, attr) free(attr); + EINA_LIST_FREE(attrs, attr) + free(attr); } free(preedit_string); @@ -4406,6 +4423,7 @@ _edje_entry_imf_retrieve_selection_cb(void *data, Ecore_IMF_Context *ctx EINA_UN else return EINA_FALSE; } + #endif /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/ diff --git a/src/lib/edje/edje_external.c b/src/lib/edje/edje_external.c index a23444eb1a..9065f94486 100644 --- a/src/lib/edje/edje_external.c +++ b/src/lib/edje/edje_external.c @@ -9,21 +9,26 @@ edje_external_param_type_str(Edje_External_Param_Type type) switch (type) { case EDJE_EXTERNAL_PARAM_TYPE_INT: - return "INT"; + return "INT"; + case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: - return "DOUBLE"; + return "DOUBLE"; + case EDJE_EXTERNAL_PARAM_TYPE_STRING: - return "STRING"; + return "STRING"; + case EDJE_EXTERNAL_PARAM_TYPE_BOOL: - return "BOOL"; + return "BOOL"; + case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: - return "CHOICE"; + return "CHOICE"; + default: - return "(unknown)"; + return "(unknown)"; } } -EOLIAN Evas_Object* +EOLIAN Evas_Object * _edje_object_part_external_object_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part) { Edje_Real_Part *rp; @@ -36,14 +41,14 @@ _edje_object_part_external_object_get(Eo *obj EINA_UNUSED, Edje *ed, const char rp = _edje_real_part_recursive_get(&ed, (char *)part); if (!rp) { - ERR("no part '%s'", part); - return NULL; + ERR("no part '%s'", part); + return NULL; } if (rp->part->type != EDJE_PART_TYPE_EXTERNAL) { - ERR("cannot get external object of a part '%s' that is not EXTERNAL", - rp->part->name); - return NULL; + ERR("cannot get external object of a part '%s' that is not EXTERNAL", + rp->part->name); + return NULL; } if ((rp->type != EDJE_RP_TYPE_SWALLOW) || (!rp->typedata.swallow)) return NULL; @@ -63,12 +68,12 @@ _edje_object_part_external_param_set(Eo *obj, Edje *ed, const char *part, const rp = _edje_real_part_recursive_get(&ed, (char *)part); if (!rp) { - ERR("no part '%s'", part); - return EINA_FALSE; + ERR("no part '%s'", part); + return EINA_FALSE; } if (_edje_external_param_set(obj, rp, param)) - return EINA_TRUE; + return EINA_TRUE; return EINA_FALSE; } @@ -84,14 +89,14 @@ _edje_object_part_external_param_get(Eo *obj, Edje *ed, const char *part, Edje_E rp = _edje_real_part_recursive_get(&ed, (char *)part); if (!rp) { - ERR("no part '%s'", part); - return EINA_FALSE; + ERR("no part '%s'", part); + return EINA_FALSE; } return _edje_external_param_get(obj, rp, param); } -EOLIAN Evas_Object* +EOLIAN Evas_Object * _edje_object_part_external_content_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part, const char *content) { Edje_Real_Part *rp; @@ -103,8 +108,8 @@ _edje_object_part_external_content_get(Eo *obj EINA_UNUSED, Edje *ed, const char rp = _edje_real_part_recursive_get(&ed, (char *)part); if (!rp) { - ERR("no part '%s'", part); - return NULL; + ERR("no part '%s'", part); + return NULL; } if ((rp->type != EDJE_RP_TYPE_SWALLOW) || (!rp->typedata.swallow)) return NULL; @@ -124,25 +129,25 @@ _edje_object_part_external_param_type_get(Eo *obj, Edje *ed, const char *part, c rp = _edje_real_part_recursive_get(&ed, (char *)part); if (!rp) { - ERR("no part '%s'", part); - return EDJE_EXTERNAL_PARAM_TYPE_MAX; + ERR("no part '%s'", part); + return EDJE_EXTERNAL_PARAM_TYPE_MAX; } - if ((rp->type != EDJE_RP_TYPE_SWALLOW) || - (!rp->typedata.swallow)) return EDJE_EXTERNAL_PARAM_TYPE_MAX; + if ((rp->type != EDJE_RP_TYPE_SWALLOW) || + (!rp->typedata.swallow)) return EDJE_EXTERNAL_PARAM_TYPE_MAX; type = evas_object_data_get(rp->typedata.swallow->swallowed_object, "Edje_External_Type"); if (!type) { - ERR("no external type for object %p", obj); - return EDJE_EXTERNAL_PARAM_TYPE_MAX; + ERR("no external type for object %p", obj); + return EDJE_EXTERNAL_PARAM_TYPE_MAX; } if (!type->parameters_info) { - ERR("no parameters information for external type '%s'", - type->module_name); - return EDJE_EXTERNAL_PARAM_TYPE_MAX; + ERR("no parameters information for external type '%s'", + type->module_name); + return EDJE_EXTERNAL_PARAM_TYPE_MAX; } for (info = type->parameters_info; info->name; info++) - if (strcmp(info->name, param) == 0) return info->type;; + if (strcmp(info->name, param) == 0) return info->type; ; ERR("no parameter '%s' external type '%s'", param, type->module_name); @@ -159,17 +164,17 @@ edje_external_type_register(const char *type_name, const Edje_External_Type *typ if (type_info->abi_version != EDJE_EXTERNAL_TYPE_ABI_VERSION) { - ERR("external type '%s' (%p) has incorrect abi version. " - "got %#x where %#x was expected.", - type_name, type_info, - type_info->abi_version, EDJE_EXTERNAL_TYPE_ABI_VERSION); - return EINA_FALSE; + ERR("external type '%s' (%p) has incorrect abi version. " + "got %#x where %#x was expected.", + type_name, type_info, + type_info->abi_version, EDJE_EXTERNAL_TYPE_ABI_VERSION); + return EINA_FALSE; } if (eina_hash_find(type_registry, type_name)) { - ERR("External type '%s' already registered", type_name); - return EINA_FALSE; + ERR("External type '%s' already registered", type_name); + return EINA_FALSE; } return eina_hash_add(type_registry, type_name, type_info); } @@ -192,16 +197,16 @@ edje_external_type_array_register(const Edje_External_Type_Info *array) for (itr = array; itr->name; itr++) { - if (itr->info->abi_version != EDJE_EXTERNAL_TYPE_ABI_VERSION) - { - ERR("external type '%s' (%p) has incorrect abi " - "version. got %#x where %#x was expected.", - itr->name, itr->info, - itr->info->abi_version, EDJE_EXTERNAL_TYPE_ABI_VERSION); - continue; - } + if (itr->info->abi_version != EDJE_EXTERNAL_TYPE_ABI_VERSION) + { + ERR("external type '%s' (%p) has incorrect abi " + "version. got %#x where %#x was expected.", + itr->name, itr->info, + itr->info->abi_version, EDJE_EXTERNAL_TYPE_ABI_VERSION); + continue; + } - eina_hash_direct_add(type_registry, itr->name, itr->info); + eina_hash_direct_add(type_registry, itr->name, itr->info); } } @@ -236,7 +241,7 @@ edje_external_param_find(const Eina_List *params, const char *key) Edje_External_Param *param; EINA_LIST_FOREACH(params, l, param) - if (!strcmp(param->name, key)) return param; + if (!strcmp(param->name, key)) return param; return NULL; } @@ -251,8 +256,8 @@ edje_external_param_int_get(const Eina_List *params, const char *key, int *ret) if (param && param->type == EDJE_EXTERNAL_PARAM_TYPE_INT && ret) { - *ret = param->i; - return EINA_TRUE; + *ret = param->i; + return EINA_TRUE; } return EINA_FALSE; @@ -268,8 +273,8 @@ edje_external_param_double_get(const Eina_List *params, const char *key, double if (param && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE && ret) { - *ret = param->d; - return EINA_TRUE; + *ret = param->d; + return EINA_TRUE; } return EINA_FALSE; @@ -285,8 +290,8 @@ edje_external_param_string_get(const Eina_List *params, const char *key, const c if (param && param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING && ret) { - *ret = param->s; - return EINA_TRUE; + *ret = param->s; + return EINA_TRUE; } return EINA_FALSE; @@ -302,8 +307,8 @@ edje_external_param_bool_get(const Eina_List *params, const char *key, Eina_Bool if (param && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL && ret) { - *ret = param->i; - return EINA_TRUE; + *ret = param->i; + return EINA_TRUE; } return EINA_FALSE; @@ -319,8 +324,8 @@ edje_external_param_choice_get(const Eina_List *params, const char *key, const c if (param && param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE && ret) { - *ret = param->s; - return EINA_TRUE; + *ret = param->s; + return EINA_TRUE; } return EINA_FALSE; @@ -357,8 +362,8 @@ _edje_external_shutdown(void) { if (--init_count == 0) { - eina_hash_free(type_registry); - type_registry = NULL; + eina_hash_free(type_registry); + type_registry = NULL; } } @@ -371,15 +376,15 @@ _edje_external_type_add(const char *type_name, Evas *evas, Evas_Object *parent, type = eina_hash_find(type_registry, type_name); if (!type) { - ERR("external type '%s' not registered", type_name); - return NULL; + ERR("external type '%s' not registered", type_name); + return NULL; } obj = type->add(type->data, evas, parent, params, part_name); if (!obj) { - ERR("External type '%s' returned NULL from constructor", type_name); - return NULL; + ERR("External type '%s' returned NULL from constructor", type_name); + return NULL; } evas_object_data_set(obj, "Edje_External_Type", type); @@ -395,8 +400,8 @@ _edje_external_signal_emit(Evas_Object *obj, const char *emission, const char *s type = evas_object_data_get(obj, "Edje_External_Type"); if (!type) { - ERR("External type data not found."); - return; + ERR("External type data not found."); + return; } type->signal_emit(type->data, obj, emission, source); @@ -406,31 +411,31 @@ Eina_Bool _edje_external_param_set(Evas_Object *obj, Edje_Real_Part *rp, const Edje_External_Param *param) { Evas_Object *swallowed_object; - + if ((rp->type != EDJE_RP_TYPE_SWALLOW) || - (!rp->typedata.swallow)) return EINA_FALSE; + (!rp->typedata.swallow)) return EINA_FALSE; swallowed_object = rp->typedata.swallow->swallowed_object; Edje_External_Type *type = evas_object_data_get(swallowed_object, "Edje_External_Type"); if (!type) { - if ((rp->part->type == EDJE_PART_TYPE_TEXT) || + if ((rp->part->type == EDJE_PART_TYPE_TEXT) || (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)) - { - if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) && - (!strcmp (param->name, "text")) && (obj)) - { - return edje_object_part_text_set(obj, rp->part->name, param->s); - } - } + { + if ((param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) && + (!strcmp(param->name, "text")) && (obj)) + { + return edje_object_part_text_set(obj, rp->part->name, param->s); + } + } - ERR("no external type for object %p", swallowed_object); - return EINA_FALSE; + ERR("no external type for object %p", swallowed_object); + return EINA_FALSE; } if (!type->param_set) { - ERR("external type '%s' from module '%s' does not provide param_set()", - type->module_name, type->module); - return EINA_FALSE; + ERR("external type '%s' from module '%s' does not provide param_set()", + type->module_name, type->module); + return EINA_FALSE; } return type->param_set(type->data, swallowed_object, param); } @@ -439,50 +444,50 @@ Eina_Bool _edje_external_param_get(const Evas_Object *obj, Edje_Real_Part *rp, Edje_External_Param *param) { Evas_Object *swallowed_object; - + if ((rp->type != EDJE_RP_TYPE_SWALLOW) || - (!rp->typedata.swallow)) return EINA_FALSE; + (!rp->typedata.swallow)) return EINA_FALSE; swallowed_object = rp->typedata.swallow->swallowed_object; Edje_External_Type *type = evas_object_data_get(swallowed_object, "Edje_External_Type"); if (!type) { - if ((rp->part->type == EDJE_PART_TYPE_TEXT) || + if ((rp->part->type == EDJE_PART_TYPE_TEXT) || (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)) - { - const char *text; - param->type = EDJE_EXTERNAL_PARAM_TYPE_STRING; - param->name = "text"; - text = edje_object_part_text_get(obj, rp->part->name); + { + const char *text; + param->type = EDJE_EXTERNAL_PARAM_TYPE_STRING; + param->name = "text"; + text = edje_object_part_text_get(obj, rp->part->name); param->s = text; - return EINA_TRUE; - } - - ERR("no external type for object %p", swallowed_object); - return EINA_FALSE; + return EINA_TRUE; + } + + ERR("no external type for object %p", swallowed_object); + return EINA_FALSE; } if (!type->param_get) { - ERR("external type '%s' from module '%s' does not provide param_get()", - type->module_name, type->module); - return EINA_FALSE; + ERR("external type '%s' from module '%s' does not provide param_get()", + type->module_name, type->module); + return EINA_FALSE; } return type->param_get(type->data, swallowed_object, param); } -Evas_Object* +Evas_Object * _edje_external_content_get(const Evas_Object *obj, const char *content) { Edje_External_Type *type = evas_object_data_get(obj, "Edje_External_Type"); if (!type) { - ERR("no external type for object %p", obj); - return NULL; + ERR("no external type for object %p", obj); + return NULL; } if (!type->content_get) { - ERR("external type '%s' from module '%s' does not provide content_get()", - type->module_name, type->module); - return NULL; + ERR("external type '%s' from module '%s' does not provide content_get()", + type->module_name, type->module); + return NULL; } return type->content_get(type->data, obj, content); } @@ -494,41 +499,41 @@ _edje_external_params_free(Eina_List *external_params, Eina_Bool free_strings) EINA_LIST_FREE(external_params, param) { - if (free_strings) - { - if (param->name) eina_stringshare_del(param->name); - if (param->s) eina_stringshare_del(param->s); - } - free(param); + if (free_strings) + { + if (param->name) eina_stringshare_del(param->name); + if (param->s) eina_stringshare_del(param->s); + } + free(param); } } void _edje_external_recalc_apply(Edje *ed EINA_UNUSED, Edje_Real_Part *ep, - Edje_Calc_Params *params EINA_UNUSED, - Edje_Part_Description_Common *chosen_desc EINA_UNUSED) + Edje_Calc_Params *params EINA_UNUSED, + Edje_Part_Description_Common *chosen_desc EINA_UNUSED) { Edje_External_Type *type; Edje_Part_Description_External *ext; void *params1, *params2 = NULL; if ((ep->type != EDJE_RP_TYPE_SWALLOW) || - (!ep->typedata.swallow)) return; + (!ep->typedata.swallow)) return; if (!ep->typedata.swallow->swallowed_object) return; type = evas_object_data_get(ep->typedata.swallow->swallowed_object, "Edje_External_Type"); if ((!type) || (!type->state_set)) return; - ext = (Edje_Part_Description_External*) ep->param1.description; + ext = (Edje_Part_Description_External *)ep->param1.description; params1 = ep->param1.external_params ? ep->param1.external_params : ext->external_params; if (ep->param2 && ep->param2->description) { - ext = (Edje_Part_Description_External*) ep->param2->description; + ext = (Edje_Part_Description_External *)ep->param2->description; - params2 = ep->param2->external_params ? + params2 = ep->param2->external_params ? ep->param2->external_params : ext->external_params; } @@ -563,3 +568,4 @@ _edje_external_parsed_params_free(Evas_Object *obj, void *params) type->params_free(params); } + diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index b3f351953a..add6a1ac18 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -3,8 +3,8 @@ typedef struct _Edje_Table_Items Edje_Table_Items; struct _Edje_Table_Items { - Evas_Object *child; - const char *part; + Evas_Object *child; + const char *part; unsigned short col; unsigned short row; unsigned short colspan; @@ -15,11 +15,13 @@ typedef struct _Edje_Drag_Items Edje_Drag_Items; struct _Edje_Drag_Items { const char *part; - FLOAT_T x, y, w, h; - struct { + FLOAT_T x, y, w, h; + struct + { FLOAT_T x, y; } step; - struct { + struct + { FLOAT_T x, y; } page; }; @@ -29,9 +31,9 @@ void _edje_file_add(Edje *ed, const Eina_File *f); /* START - Nested part support */ #define _edje_smart_nested_type "Evas_Smart_Nested" typedef struct _Edje_Nested_Support Edje_Nested_Support; -struct _Edje_Nested_Support -{ /* We builed nested-parts list using this struct */ - Evas_Object *o; /* Smart object containing nested children */ +struct _Edje_Nested_Support /* We builed nested-parts list using this struct */ +{ + Evas_Object *o; /* Smart object containing nested children */ unsigned char nested_children_count; /* Number of nested children */ }; @@ -131,21 +133,20 @@ _edje_extract_mo_files(Edje *ed) Evas_Object * edje_smart_nested_add(Evas *evas) { - return evas_object_smart_add(evas, _edje_smart_nested_smart_class_new()); + return evas_object_smart_add(evas, _edje_smart_nested_smart_class_new()); } /* END - Nested part support */ - #ifdef EDJE_PROGRAM_CACHE static Eina_Bool _edje_collection_free_prog_cache_matches_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata); #endif -static void _edje_object_pack_item_hints_set(Evas_Object *obj, Edje_Pack_Element *it); -static void _cb_signal_repeat(void *data, Evas_Object *obj, const char *signal, const char *source); +static void _edje_object_pack_item_hints_set(Evas_Object *obj, Edje_Pack_Element *it); +static void _cb_signal_repeat(void *data, Evas_Object *obj, const char *signal, const char *source); static Eina_List *_edje_object_collect(Edje *ed); -static int _sort_defined_boxes(const void *a, const void *b); +static int _sort_defined_boxes(const void *a, const void *b); /************************** API Routines **************************/ @@ -168,27 +169,37 @@ edje_load_error_str(Edje_Load_Error error) switch (error) { case EDJE_LOAD_ERROR_NONE: - return "No Error"; + return "No Error"; + case EDJE_LOAD_ERROR_GENERIC: - return "Generic Error"; + return "Generic Error"; + case EDJE_LOAD_ERROR_DOES_NOT_EXIST: - return "File Does Not Exist"; + return "File Does Not Exist"; + case EDJE_LOAD_ERROR_PERMISSION_DENIED: - return "Permission Denied"; + return "Permission Denied"; + case EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED: - return "Resource Allocation Failed"; + return "Resource Allocation Failed"; + case EDJE_LOAD_ERROR_CORRUPT_FILE: - return "Corrupt File"; + return "Corrupt File"; + case EDJE_LOAD_ERROR_UNKNOWN_FORMAT: - return "Unknown Format"; + return "Unknown Format"; + case EDJE_LOAD_ERROR_INCOMPATIBLE_FILE: - return "Incompatible File"; + return "Incompatible File"; + case EDJE_LOAD_ERROR_UNKNOWN_COLLECTION: - return "Unknown Collection"; + return "Unknown Collection"; + case EDJE_LOAD_ERROR_RECURSIVE_REFERENCE: - return "Recursive Reference"; + return "Recursive Reference"; + default: - return "Unknown Error"; + return "Unknown Error"; } } @@ -198,7 +209,7 @@ edje_mmap_collection_list(Eina_File *f) Eina_List *lst = NULL; Edje_File *edf; int error_ret = 0; - + if (!f) return NULL; edf = _edje_cache_file_coll_open(f, NULL, &error_ret, NULL, NULL); if (edf) @@ -209,7 +220,7 @@ edje_mmap_collection_list(Eina_File *f) i = eina_hash_iterator_key_new(edf->collection); EINA_ITERATOR_FOREACH(i, key) - lst = eina_list_append(lst, eina_stringshare_add(key)); + lst = eina_list_append(lst, eina_stringshare_add(key)); eina_iterator_free(i); @@ -217,7 +228,7 @@ edje_mmap_collection_list(Eina_File *f) } return lst; -} +} EAPI Eina_List * edje_file_collection_list(const char *file) @@ -260,45 +271,45 @@ edje_mmap_group_exists(Eina_File *f, const char *glob) const char *p; if ((!f) || (!glob)) - return EINA_FALSE; + return EINA_FALSE; edf = _edje_cache_file_coll_open(f, NULL, &error_ret, NULL, NULL); if (!edf) return EINA_FALSE; for (p = glob; *p; p++) { - if ((*p == '*') || (*p == '?') || (*p == '[')) - { - is_glob = EINA_TRUE; - break; - } + if ((*p == '*') || (*p == '?') || (*p == '[')) + { + is_glob = EINA_TRUE; + break; + } } if (is_glob) { - if (!edf->collection_patterns) - { - Edje_Part_Collection_Directory_Entry *ce; - Eina_Iterator *i; - Eina_List *l = NULL; + if (!edf->collection_patterns) + { + Edje_Part_Collection_Directory_Entry *ce; + Eina_Iterator *i; + Eina_List *l = NULL; - i = eina_hash_iterator_data_new(edf->collection); + i = eina_hash_iterator_data_new(edf->collection); - EINA_ITERATOR_FOREACH(i, ce) - l = eina_list_append(l, ce); + EINA_ITERATOR_FOREACH(i, ce) + l = eina_list_append(l, ce); - eina_iterator_free(i); + eina_iterator_free(i); - edf->collection_patterns = edje_match_collection_dir_init(l); - eina_list_free(l); - } + edf->collection_patterns = edje_match_collection_dir_init(l); + eina_list_free(l); + } - succeed = edje_match_collection_dir_exec(edf->collection_patterns, glob); - if (edf->collection_patterns) - { - edje_match_patterns_free(edf->collection_patterns); - edf->collection_patterns = NULL; - } + succeed = edje_match_collection_dir_exec(edf->collection_patterns, glob); + if (edf->collection_patterns) + { + edje_match_patterns_free(edf->collection_patterns); + edf->collection_patterns = NULL; + } } else { @@ -314,7 +325,7 @@ edje_mmap_group_exists(Eina_File *f, const char *glob) typedef struct _Edje_File_Iterator Edje_File_Iterator; struct _Edje_File_Iterator { - Eina_Iterator iterator; + Eina_Iterator iterator; Eina_Iterator *it; }; @@ -322,10 +333,10 @@ struct _Edje_File_Iterator static Eina_Bool _edje_file_iterator_next(Eina_Iterator *it, void **data) { - Edje_File_Iterator *et = (void*) it; + Edje_File_Iterator *et = (void *)it; Edje_File *edf = NULL; - if (!eina_iterator_next(et->it, (void**) &edf)) + if (!eina_iterator_next(et->it, (void **)&edf)) return EINA_FALSE; *data = edf->f; @@ -341,7 +352,7 @@ _edje_file_iterator_container(Eina_Iterator *it EINA_UNUSED) static void _edje_file_iterator_free(Eina_Iterator *it) { - Edje_File_Iterator *et = (void*) it; + Edje_File_Iterator *et = (void *)it; EINA_MAGIC_SET(&et->iterator, 0); eina_iterator_free(et->it); @@ -398,7 +409,7 @@ edje_mmap_data_get(const Eina_File *f, const char *key) edf = _edje_cache_file_coll_open(f, NULL, &error_ret, NULL, NULL); if (edf) { - str = (char*) edje_string_get(eina_hash_find(edf->data, key)); + str = (char *)edje_string_get(eina_hash_find(edf->data, key)); if (str) str = strdup(str); @@ -450,6 +461,7 @@ _edje_physics_world_update_cb(void *data, EPhysics_World *world EINA_UNUSED, voi Edje *edje = data; _edje_recalc_do(edje); } + #endif int @@ -547,208 +559,221 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch ephysics_init(); ed->world = ephysics_world_new(); ephysics_world_event_callback_add( - ed->world, EPHYSICS_CALLBACK_WORLD_UPDATE, - _edje_physics_world_update_cb, ed); + ed->world, EPHYSICS_CALLBACK_WORLD_UPDATE, + _edje_physics_world_update_cb, ed); ephysics_world_rate_set(ed->world, ed->collection->physics.world.rate); ephysics_world_gravity_set( - ed->world, ed->collection->physics.world.gravity.x, - ed->collection->physics.world.gravity.y, - ed->collection->physics.world.gravity.z); + ed->world, ed->collection->physics.world.gravity.x, + ed->collection->physics.world.gravity.y, + ed->collection->physics.world.gravity.z); } #else ERR("Edje compiled without support to physics."); #endif - /* colorclass stuff */ - for (i = 0; i < ed->collection->parts_count; ++i) - { - Edje_Part *ep; - unsigned int k; + /* colorclass stuff */ + for (i = 0; i < ed->collection->parts_count; ++i) + { + Edje_Part *ep; + unsigned int k; - ep = ed->collection->parts[i]; + ep = ed->collection->parts[i]; - /* Register any color classes in this parts descriptions. */ - if ((ep->default_desc) && (ep->default_desc->color_class)) - _edje_color_class_member_add(ed, ep->default_desc->color_class); + /* Register any color classes in this parts descriptions. */ + if ((ep->default_desc) && (ep->default_desc->color_class)) + _edje_color_class_member_add(ed, ep->default_desc->color_class); - for (k = 0; k < ep->other.desc_count; k++) - { - Edje_Part_Description_Common *desc; + for (k = 0; k < ep->other.desc_count; k++) + { + Edje_Part_Description_Common *desc; - desc = ep->other.desc[k]; + desc = ep->other.desc[k]; - if (desc->color_class) - _edje_color_class_member_add(ed, desc->color_class); - } - } - /* build real parts */ - for (n = 0; n < ed->collection->parts_count; n++) - { - Edje_Part *ep; - Eina_Bool memerr = EINA_FALSE; + if (desc->color_class) + _edje_color_class_member_add(ed, desc->color_class); + } + } + /* build real parts */ + for (n = 0; n < ed->collection->parts_count; n++) + { + Edje_Part *ep; + Eina_Bool memerr = EINA_FALSE; - ep = ed->collection->parts[n]; + ep = ed->collection->parts[n]; - if (ep->nested_children_count) - { /* Add object to nested parts list */ + if (ep->nested_children_count) /* Add object to nested parts list */ + { st_nested = malloc(sizeof(*st_nested)); nested_smart = st_nested->o = edje_smart_nested_add(tev); /* We add 1 to children_count because the parent object is added to smart obj children as well */ st_nested->nested_children_count = - ep->nested_children_count + 1; + ep->nested_children_count + 1; evas_object_show(st_nested->o); eina_array_push(nested, st_nested); - } + } - rp = eina_mempool_malloc(_edje_real_part_mp, sizeof(Edje_Real_Part)); - if (!rp) - { - /* FIXME: destroy all allocated ressource, need to have a common exit point */ - ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; - goto on_error; - } + rp = eina_mempool_malloc(_edje_real_part_mp, sizeof(Edje_Real_Part)); + if (!rp) + { + /* FIXME: destroy all allocated ressource, need to have a common exit point */ + ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; + goto on_error; + } - memset(rp, 0, sizeof (Edje_Real_Part)); + memset(rp, 0, sizeof (Edje_Real_Part)); - rp->param1.p.map = eina_cow_alloc(_edje_calc_params_map_cow); + rp->param1.p.map = eina_cow_alloc(_edje_calc_params_map_cow); #ifdef HAVE_EPHYSICS - rp->param1.p.physics = eina_cow_alloc(_edje_calc_params_physics_cow); + rp->param1.p.physics = eina_cow_alloc(_edje_calc_params_physics_cow); #endif - if ((ep->dragable.x != 0) || (ep->dragable.y != 0)) - { - rp->drag = calloc(1, sizeof (Edje_Real_Part_Drag)); - if (!rp->drag) - { - ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; - goto on_error; - } + if ((ep->dragable.x != 0) || (ep->dragable.y != 0)) + { + rp->drag = calloc(1, sizeof (Edje_Real_Part_Drag)); + if (!rp->drag) + { + ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; + goto on_error; + } - rp->drag->step.x = FROM_INT(ep->dragable.step_x); - rp->drag->step.y = FROM_INT(ep->dragable.step_y); - } - // allow part type specific data - this keeps real_part smaller - switch (ep->type) - { - case EDJE_PART_TYPE_TEXT: - case EDJE_PART_TYPE_TEXTBLOCK: - rp->type = EDJE_RP_TYPE_TEXT; - rp->typedata.text = calloc(1, sizeof(Edje_Real_Part_Text)); - if (!rp->typedata.text) memerr = EINA_TRUE; - break; - case EDJE_PART_TYPE_GROUP: - case EDJE_PART_TYPE_SWALLOW: - case EDJE_PART_TYPE_EXTERNAL: - rp->type = EDJE_RP_TYPE_SWALLOW; - rp->typedata.swallow = calloc(1, sizeof(Edje_Real_Part_Swallow)); - if (!rp->typedata.swallow) memerr = EINA_TRUE; - break; - case EDJE_PART_TYPE_BOX: - case EDJE_PART_TYPE_TABLE: - rp->type = EDJE_RP_TYPE_CONTAINER; - rp->typedata.container = calloc(1, sizeof(Edje_Real_Part_Container)); - if (!rp->typedata.container) memerr = EINA_TRUE; - break; - default: - break; - } + rp->drag->step.x = FROM_INT(ep->dragable.step_x); + rp->drag->step.y = FROM_INT(ep->dragable.step_y); + } + // allow part type specific data - this keeps real_part smaller + switch (ep->type) + { + case EDJE_PART_TYPE_TEXT: + case EDJE_PART_TYPE_TEXTBLOCK: + rp->type = EDJE_RP_TYPE_TEXT; + rp->typedata.text = calloc(1, sizeof(Edje_Real_Part_Text)); + if (!rp->typedata.text) memerr = EINA_TRUE; + break; - if (memerr) - { - if (rp->drag) free(rp->drag); - ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; - eina_mempool_free(_edje_real_part_mp, rp); - evas_event_thaw(tev); - evas_event_thaw_eval(tev); - return 0; - } + case EDJE_PART_TYPE_GROUP: + case EDJE_PART_TYPE_SWALLOW: + case EDJE_PART_TYPE_EXTERNAL: + rp->type = EDJE_RP_TYPE_SWALLOW; + rp->typedata.swallow = calloc(1, sizeof(Edje_Real_Part_Swallow)); + if (!rp->typedata.swallow) memerr = EINA_TRUE; + break; - _edje_ref(ed); - rp->part = ep; - eina_array_push(&parts, rp); - rp->param1.description = - _edje_part_description_find(ed, rp, "default", 0.0, EINA_TRUE); - rp->chosen_description = rp->param1.description; - if (!rp->param1.description) - ERR("no default part description for '%s'!", - rp->part->name); + case EDJE_PART_TYPE_BOX: + case EDJE_PART_TYPE_TABLE: + rp->type = EDJE_RP_TYPE_CONTAINER; + rp->typedata.container = calloc(1, sizeof(Edje_Real_Part_Container)); + if (!rp->typedata.container) memerr = EINA_TRUE; + break; - switch (ep->type) - { - case EDJE_PART_TYPE_RECTANGLE: - rp->object = evas_object_rectangle_add(ed->base->evas); - break; - case EDJE_PART_TYPE_PROXY: - case EDJE_PART_TYPE_IMAGE: - rp->object = evas_object_image_add(ed->base->evas); - break; - case EDJE_PART_TYPE_TEXT: - _edje_text_part_on_add(ed, rp); - rp->object = evas_object_text_add(ed->base->evas); - evas_object_text_font_source_set(rp->object, ed->path); - break; - case EDJE_PART_TYPE_GROUP: - sources = eina_list_append(sources, rp); - // fallthrough intentional - case EDJE_PART_TYPE_SWALLOW: - case EDJE_PART_TYPE_EXTERNAL: - if (ep->type == EDJE_PART_TYPE_EXTERNAL) - externals = eina_list_append(externals, rp); - rp->object = evas_object_rectangle_add(ed->base->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); - _edje_callbacks_focus_add(rp->object, ed, rp); - break; - case EDJE_PART_TYPE_TEXTBLOCK: - _edje_textblock_styles_add(ed, rp); - textblocks = eina_list_append(textblocks, rp); - rp->object = evas_object_textblock_add(ed->base->evas); - break; - case EDJE_PART_TYPE_BOX: - sources = eina_list_append(sources, rp); - rp->object = evas_object_box_add(ed->base->evas); - rp->typedata.container->anim = _edje_box_layout_anim_new(rp->object); - break; - case EDJE_PART_TYPE_TABLE: - sources = eina_list_append(sources, rp); - rp->object = evas_object_table_add(ed->base->evas); - break; - case EDJE_PART_TYPE_GRADIENT: - ERR("SPANK ! SPANK ! SPANK ! YOU ARE USING GRADIENT IN PART %s FROM GROUP %s INSIDE FILE %s !! THEY ARE NOW REMOVED !", - ep->name, group, eina_file_filename_get(file)); - break; - case EDJE_PART_TYPE_SPACER: - rp->object = NULL; - break; - default: - ERR("wrong part type %i!", ep->type); - break; - } + default: + break; + } - if (rp->object) - { - if (nested_smart) - { /* Update this pointer to father object only - this will make smart object size == father sz */ - rp->nested_smart = nested_smart; - nested_smart = NULL; - } + if (memerr) + { + if (rp->drag) free(rp->drag); + ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; + eina_mempool_free(_edje_real_part_mp, rp); + evas_event_thaw(tev); + evas_event_thaw_eval(tev); + return 0; + } - if (st_nested && st_nested->nested_children_count) - { /* Add this to list of children */ - evas_object_smart_member_add(rp->object, - st_nested->o); + _edje_ref(ed); + rp->part = ep; + eina_array_push(&parts, rp); + rp->param1.description = + _edje_part_description_find(ed, rp, "default", 0.0, EINA_TRUE); + rp->chosen_description = rp->param1.description; + if (!rp->param1.description) + ERR("no default part description for '%s'!", + rp->part->name); - st_nested->nested_children_count--; + switch (ep->type) + { + case EDJE_PART_TYPE_RECTANGLE: + rp->object = evas_object_rectangle_add(ed->base->evas); + break; - /* No more nested children for this obj */ - while (st_nested && (st_nested->nested_children_count == 0)) + case EDJE_PART_TYPE_PROXY: + case EDJE_PART_TYPE_IMAGE: + rp->object = evas_object_image_add(ed->base->evas); + break; + + case EDJE_PART_TYPE_TEXT: + _edje_text_part_on_add(ed, rp); + rp->object = evas_object_text_add(ed->base->evas); + evas_object_text_font_source_set(rp->object, ed->path); + break; + + case EDJE_PART_TYPE_GROUP: + sources = eina_list_append(sources, rp); + + // fallthrough intentional + case EDJE_PART_TYPE_SWALLOW: + case EDJE_PART_TYPE_EXTERNAL: + if (ep->type == EDJE_PART_TYPE_EXTERNAL) + externals = eina_list_append(externals, rp); + rp->object = evas_object_rectangle_add(ed->base->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); + _edje_callbacks_focus_add(rp->object, ed, rp); + break; + + case EDJE_PART_TYPE_TEXTBLOCK: + _edje_textblock_styles_add(ed, rp); + textblocks = eina_list_append(textblocks, rp); + rp->object = evas_object_textblock_add(ed->base->evas); + break; + + case EDJE_PART_TYPE_BOX: + sources = eina_list_append(sources, rp); + rp->object = evas_object_box_add(ed->base->evas); + rp->typedata.container->anim = _edje_box_layout_anim_new(rp->object); + break; + + case EDJE_PART_TYPE_TABLE: + sources = eina_list_append(sources, rp); + rp->object = evas_object_table_add(ed->base->evas); + break; + + case EDJE_PART_TYPE_GRADIENT: + ERR("SPANK ! SPANK ! SPANK ! YOU ARE USING GRADIENT IN PART %s FROM GROUP %s INSIDE FILE %s !! THEY ARE NOW REMOVED !", + ep->name, group, eina_file_filename_get(file)); + break; + + case EDJE_PART_TYPE_SPACER: + rp->object = NULL; + break; + + default: + ERR("wrong part type %i!", ep->type); + break; + } + + if (rp->object) + { + if (nested_smart) /* Update this pointer to father object only + this will make smart object size == father sz */ + { + rp->nested_smart = nested_smart; + nested_smart = NULL; + } + + if (st_nested && st_nested->nested_children_count) /* Add this to list of children */ + { + evas_object_smart_member_add(rp->object, + st_nested->o); + + st_nested->nested_children_count--; + + /* No more nested children for this obj */ + while (st_nested && (st_nested->nested_children_count == 0)) { /* Loop to add smart counter as child */ Evas_Object *p_obj = st_nested->o; @@ -758,7 +783,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch /* Check for parent in stack */ idx = eina_array_count(nested) - 1; - st_nested = (idx >= 0) ? eina_array_data_get(nested,idx) : NULL; + st_nested = (idx >= 0) ? eina_array_data_get(nested, idx) : NULL; if (st_nested) { @@ -797,433 +822,442 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch } if (rp->part->clip_to_id < 0) evas_object_clip_set(rp->object, ed->base->clipper); - } - } - if (n > 0) - { - ed->table_parts = malloc(sizeof(Edje_Real_Part *) * n); - ed->table_parts_size = n; - /* FIXME: check malloc return */ - n = eina_array_count(&parts) - 1; - while ((rp = eina_array_pop(&parts))) - { - ed->table_parts[n] = rp; - n--; - } - for (i = 0; i < ed->table_parts_size; i++) - { - rp = ed->table_parts[i]; - if (rp->param1.description) /* FIXME: prevent rel to gone radient part to go wrong. You may - be able to remove this when all theme are correctly rewritten. */ - { - if (rp->param1.description->rel1.id_x >= 0) - rp->param1.description->rel1.id_x %= ed->table_parts_size; - if (rp->param1.description->rel1.id_y >= 0) - rp->param1.description->rel1.id_y %= ed->table_parts_size; - if (rp->param1.description->rel2.id_x >= 0) - rp->param1.description->rel2.id_x %= ed->table_parts_size; - if (rp->param1.description->rel2.id_y >= 0) - rp->param1.description->rel2.id_y %= ed->table_parts_size; - } - if (rp->part->clip_to_id >= 0) - { - Edje_Real_Part *clip_to; - - clip_to = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size]; - if (clip_to && - clip_to->object && - rp->object) - { - evas_object_pass_events_set(clip_to->object, 1); - evas_object_pointer_mode_set(clip_to->object, EVAS_OBJECT_POINTER_MODE_NOGRAB); - evas_object_clip_set(rp->object, clip_to->object); - } - } - if (rp->drag) - { - if (rp->part->dragable.confine_id >= 0) - rp->drag->confine_to = ed->table_parts[rp->part->dragable.confine_id % ed->table_parts_size]; - if (rp->part->dragable.threshold_id >= 0) - rp->drag->threshold = ed->table_parts[rp->part->dragable.threshold_id % ed->table_parts_size]; - } - - if ((rp->type == EDJE_RP_TYPE_SWALLOW) && - (rp->typedata.swallow)) - { - rp->typedata.swallow->swallow_params.min.w = 0; - rp->typedata.swallow->swallow_params.min.h = 0; - rp->typedata.swallow->swallow_params.max.w = -1; - rp->typedata.swallow->swallow_params.max.h = -1; - } - - if (rp->part->type == EDJE_PART_TYPE_TEXT - || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK) - { - Edje_Part_Description_Text *text; - - text = (Edje_Part_Description_Text *) rp->param1.description; - - if (ed->file->feature_ver < 1) - { - text->text.id_source = -1; - text->text.id_text_source = -1; - } - - if ((rp->type == EDJE_RP_TYPE_TEXT) && - (rp->typedata.text)) - { - if (text->text.id_source >= 0) - rp->typedata.text->source = ed->table_parts[text->text.id_source % ed->table_parts_size]; - if (text->text.id_text_source >= 0) - rp->typedata.text->text_source = ed->table_parts[text->text.id_text_source % ed->table_parts_size]; - } - if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) - { - _edje_entry_real_part_init(ed, rp); - if (!ed->has_entries) - ed->has_entries = EINA_TRUE; - } - } - } - } - - _edje_ref(ed); - _edje_block(ed); - _edje_util_freeze(ed); - _edje_var_init(ed); - for (i = 0; i < ed->table_parts_size; i++) - { - rp = ed->table_parts[i]; - evas_object_show(rp->object); - if (_edje_block_break(ed)) break; - if (rp->drag) - { - if (rp->part->dragable.x < 0) rp->drag->val.x = FROM_DOUBLE(1.0); - if (rp->part->dragable.y < 0) rp->drag->val.x = FROM_DOUBLE(1.0); - _edje_dragable_pos_set(ed, rp, rp->drag->val.x, rp->drag->val.y); - } - } - ed->recalc_call = EINA_TRUE; - ed->dirty = EINA_TRUE; -#ifdef EDJE_CALC_CACHE - ed->all_part_change = EINA_TRUE; -#endif - if ((evas_object_clipees_get(ed->base->clipper)) && - (evas_object_visible_get(obj))) - evas_object_show(ed->base->clipper); - - /* instantiate 'internal swallows' */ - EINA_LIST_FREE(externals, rp) - { - Edje_Part_Description_External *external; - Evas_Object *child_obj; - - external = (Edje_Part_Description_External *) rp->part->default_desc; - child_obj = _edje_external_type_add(rp->part->source, - evas_object_evas_get(ed->obj), ed->obj, - external->external_params, rp->part->name); - if (child_obj) - { - _edje_real_part_swallow(ed, rp, child_obj, EINA_TRUE); - rp->param1.external_params = _edje_external_params_parse(child_obj, - external->external_params); - _edje_external_recalc_apply(ed, rp, NULL, rp->chosen_description); - } - } - - EINA_LIST_FREE(sources, rp) - { - /* XXX: curr_item and pack_it don't require to be NULL since - * XXX: they are just used when source != NULL and type == BOX, - * XXX: and they're always set in this case, but GCC fails to - * XXX: notice that, so let's shut it up - */ - Edje_Pack_Element **curr_item = NULL; - unsigned int item_count = 0; - Edje_Pack_Element *pack_it = NULL; - const char *source = NULL; - - switch (rp->part->type) - { - case EDJE_PART_TYPE_GROUP: - source = rp->part->source; - break; - case EDJE_PART_TYPE_BOX: - case EDJE_PART_TYPE_TABLE: - if (rp->part->items) - { - curr_item = rp->part->items; - item_count = rp->part->items_count; - if (item_count > 0) - { - pack_it = *curr_item; - source = pack_it->source; - item_count--; - curr_item++; - } - } - break; - default: - /* This list should only be filled by group, box or table, nothing else. */ - abort(); - continue; - } - - while (source) - { - Eina_List *l; - Evas_Object *child_obj; - Edje_Pack_Element pack_it_copy; - const char *group_path_entry = eina_stringshare_add(source); - const char *data; - - if (!group_path) - { - group_path = eina_list_append(NULL, eina_stringshare_add(group)); - group_path_started = 1; - } - /* make sure that this group isn't already in the tree of parents */ - EINA_LIST_FOREACH(group_path, l, data) - { - if (data == group_path_entry) - { - ERR("recursive loop group '%s' already included inside part '%s' of group '%s' from file '%s'", - group_path_entry, rp->part->name, group, eina_file_filename_get(file)); - ed->load_error = EDJE_LOAD_ERROR_RECURSIVE_REFERENCE; - eina_stringshare_del(group_path_entry); - goto on_error; - } - } - - if (pack_it) - { - pack_it_copy = *pack_it; - } - else - { - memset(&pack_it_copy, 0, sizeof (pack_it_copy)); - } - - do - { - child_obj = edje_object_add(ed->base->evas); - group_path = eina_list_append(group_path, group_path_entry); - if (rp->part->type == EDJE_PART_TYPE_GROUP) - { - _edje_real_part_swallow(ed, rp, child_obj, EINA_FALSE); - } - - if (!_edje_object_file_set_internal(child_obj, file, source, rp->part->name, group_path, nested)) - { - ERR("impossible to set part '%s' of group '%s' from file '%s' to '%s'", - rp->part->name, group_path_entry, eina_file_filename_get(file), source); - ed->load_error = edje_object_load_error_get(child_obj); - evas_object_del(child_obj); - eina_stringshare_del(group_path_entry); - goto on_error; - } - - group_path = eina_list_remove(group_path, group_path_entry); - - edje_object_propagate_callback_add(child_obj, - _cb_signal_repeat, - obj); - if (rp->part->type == EDJE_PART_TYPE_GROUP) - { - Edje *edg = _edje_fetch(child_obj); - ed->groups = eina_list_append(ed->groups, edg); - evas_object_data_set(child_obj, "\377 edje.part_obj", rp); - _edje_real_part_swallow(ed, rp, child_obj, EINA_FALSE); - _edje_subobj_register(ed, child_obj); - source = NULL; - } - else - { - if ((rp->type == EDJE_RP_TYPE_CONTAINER) && - (rp->typedata.container)) - { - Eina_Strbuf *buf = NULL; - const char *name = pack_it_copy.name; - - pack_it->parent = rp; - - _edje_object_pack_item_hints_set(child_obj, &pack_it_copy); - - if (pack_it->spread.h > 1 && pack_it->spread.w >= 1) - { - buf = eina_strbuf_new(); - if (name) - eina_strbuf_append_printf(buf, "%s{%i,%i}", name, pack_it_copy.col, pack_it_copy.row); - else - eina_strbuf_append_printf(buf, "%i,%i", pack_it_copy.col, pack_it_copy.row); - name = eina_strbuf_string_get(buf); - } - if (name) evas_object_name_set(child_obj, name); - if (buf) eina_strbuf_free(buf); - - if (rp->part->type == EDJE_PART_TYPE_BOX) - { - _edje_real_part_box_append(ed, rp, child_obj); - evas_object_data_set(child_obj, "\377 edje.box_item", pack_it); - } - else if (rp->part->type == EDJE_PART_TYPE_TABLE) - { - _edje_real_part_table_pack(ed, rp, child_obj, - pack_it_copy.col, pack_it_copy.row, - pack_it_copy.colspan, pack_it_copy.rowspan); - evas_object_data_set(child_obj, "\377 edje.table_item", pack_it); - } - _edje_subobj_register(ed, child_obj); - evas_object_show(child_obj); - rp->typedata.container->items = eina_list_append(rp->typedata.container->items, child_obj); - } - } - - pack_it_copy.spread.w--; - pack_it_copy.col++; - if (pack_it_copy.spread.w < 1 && pack_it) - { - pack_it_copy.col = pack_it->col; - pack_it_copy.row++; - pack_it_copy.spread.h--; - pack_it_copy.spread.w = pack_it->spread.w; - } - } - while (pack_it_copy.spread.h > 0); - - eina_stringshare_del(group_path_entry); - - if ((rp->type == EDJE_RP_TYPE_CONTAINER) && - (rp->typedata.container)) - { - if (item_count > 0) - { - pack_it = *curr_item; - source = pack_it->source; - curr_item++; - item_count--; - } - else - { - source = NULL; - curr_item = NULL; - pack_it = NULL; - } - } - } - } - - if (group_path_started) - { - const char *str; - - EINA_LIST_FREE(group_path, str) - eina_stringshare_del(str); - } - - /* reswallow any swallows that existed before setting the file */ - if (collect) - { - Edje_User_Defined *eud; - Eina_List *boxes = NULL; - - EINA_LIST_FREE(collect, eud) - { - Evas_Object *child = NULL; - - switch (eud->type) - { - case EDJE_USER_SWALLOW: - edje_object_part_swallow(obj, eud->part, eud->u.swallow.child); - child = eud->u.swallow.child; - break; - case EDJE_USER_BOX_PACK: - boxes = eina_list_append(boxes, eud); - eud = NULL; - break; - case EDJE_USER_TABLE_PACK: - edje_object_part_table_pack(obj, eud->part, eud->u.table.child, - eud->u.table.col, eud->u.table.row, - eud->u.table.colspan, eud->u.table.rowspan); - child = eud->u.table.child; - break; - case EDJE_USER_DRAG_STEP: - edje_object_part_drag_step_set(obj, eud->part, - eud->u.drag_position.x, - eud->u.drag_position.y); - break; - case EDJE_USER_DRAG_PAGE: - edje_object_part_drag_page_set(obj, eud->part, - eud->u.drag_position.x, - eud->u.drag_position.y); - break; - case EDJE_USER_DRAG_VALUE: - edje_object_part_drag_value_set(obj, eud->part, - eud->u.drag_position.x, - eud->u.drag_position.y); - break; - case EDJE_USER_DRAG_SIZE: - edje_object_part_drag_size_set(obj, eud->part, - eud->u.drag_size.w, - eud->u.drag_size.h); - break; - case EDJE_USER_STRING: - edje_object_part_text_set(obj, eud->part, eud->u.string.text); - eina_stringshare_del(eud->u.string.text); - break; - } - if (eud) _edje_user_definition_remove(eud, child); - } - - boxes = eina_list_sort(boxes, -1, _sort_defined_boxes); - EINA_LIST_FREE(boxes, eud) - { - edje_object_part_box_append(obj, eud->part, eud->u.box.child); - _edje_user_definition_remove(eud, eud->u.box.child); - } - } - - snprintf(lang, sizeof(lang), "edje,language,%s", _edje_language); - edje_object_signal_emit(obj, lang, "edje"); - - if (edje_object_mirrored_get(obj)) - edje_object_signal_emit(obj, "edje,state,rtl", "edje"); - else - edje_object_signal_emit(obj, "edje,state,ltr", "edje"); - - _edje_recalc(ed); - _edje_util_thaw(ed); - _edje_unblock(ed); - _edje_unref(ed); - ed->load_error = EDJE_LOAD_ERROR_NONE; - _edje_emit(ed, "load", NULL); - - /* instantiate 'internal textblock style' */ - EINA_LIST_FREE(textblocks, rp) - if (rp->part->default_desc) + } + } + if (n > 0) + { + ed->table_parts = malloc(sizeof(Edje_Real_Part *) * n); + ed->table_parts_size = n; + /* FIXME: check malloc return */ + n = eina_array_count(&parts) - 1; + while ((rp = eina_array_pop(&parts))) { - Edje_Part_Description_Text *text; - Edje_Style *stl = NULL; - const char *style; - - text = (Edje_Part_Description_Text *) rp->part->default_desc; - style = edje_string_get(&text->text.style); - if (style) + ed->table_parts[n] = rp; + n--; + } + for (i = 0; i < ed->table_parts_size; i++) + { + rp = ed->table_parts[i]; + if (rp->param1.description) /* FIXME: prevent rel to gone radient part to go wrong. You may + be able to remove this when all theme are correctly rewritten. */ { - Eina_List *l; + if (rp->param1.description->rel1.id_x >= 0) + rp->param1.description->rel1.id_x %= ed->table_parts_size; + if (rp->param1.description->rel1.id_y >= 0) + rp->param1.description->rel1.id_y %= ed->table_parts_size; + if (rp->param1.description->rel2.id_x >= 0) + rp->param1.description->rel2.id_x %= ed->table_parts_size; + if (rp->param1.description->rel2.id_y >= 0) + rp->param1.description->rel2.id_y %= ed->table_parts_size; + } + if (rp->part->clip_to_id >= 0) + { + Edje_Real_Part *clip_to; - EINA_LIST_FOREACH(ed->file->styles, l, stl) + clip_to = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size]; + if (clip_to && + clip_to->object && + rp->object) { - if ((stl->name) && (!strcmp(stl->name, style))) break; - stl = NULL; + evas_object_pass_events_set(clip_to->object, 1); + evas_object_pointer_mode_set(clip_to->object, EVAS_OBJECT_POINTER_MODE_NOGRAB); + evas_object_clip_set(rp->object, clip_to->object); } } - if (stl) + if (rp->drag) { - if (evas_object_textblock_style_get(rp->object) != stl->style) - evas_object_textblock_style_set(rp->object, stl->style); + if (rp->part->dragable.confine_id >= 0) + rp->drag->confine_to = ed->table_parts[rp->part->dragable.confine_id % ed->table_parts_size]; + if (rp->part->dragable.threshold_id >= 0) + rp->drag->threshold = ed->table_parts[rp->part->dragable.threshold_id % ed->table_parts_size]; + } + + if ((rp->type == EDJE_RP_TYPE_SWALLOW) && + (rp->typedata.swallow)) + { + rp->typedata.swallow->swallow_params.min.w = 0; + rp->typedata.swallow->swallow_params.min.h = 0; + rp->typedata.swallow->swallow_params.max.w = -1; + rp->typedata.swallow->swallow_params.max.h = -1; + } + + if (rp->part->type == EDJE_PART_TYPE_TEXT + || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK) + { + Edje_Part_Description_Text *text; + + text = (Edje_Part_Description_Text *)rp->param1.description; + + if (ed->file->feature_ver < 1) + { + text->text.id_source = -1; + text->text.id_text_source = -1; + } + + if ((rp->type == EDJE_RP_TYPE_TEXT) && + (rp->typedata.text)) + { + if (text->text.id_source >= 0) + rp->typedata.text->source = ed->table_parts[text->text.id_source % ed->table_parts_size]; + if (text->text.id_text_source >= 0) + rp->typedata.text->text_source = ed->table_parts[text->text.id_text_source % ed->table_parts_size]; + } + if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) + { + _edje_entry_real_part_init(ed, rp); + if (!ed->has_entries) + ed->has_entries = EINA_TRUE; + } } } + } + + _edje_ref(ed); + _edje_block(ed); + _edje_util_freeze(ed); + _edje_var_init(ed); + for (i = 0; i < ed->table_parts_size; i++) + { + rp = ed->table_parts[i]; + evas_object_show(rp->object); + if (_edje_block_break(ed)) break; + if (rp->drag) + { + if (rp->part->dragable.x < 0) rp->drag->val.x = FROM_DOUBLE(1.0); + if (rp->part->dragable.y < 0) rp->drag->val.x = FROM_DOUBLE(1.0); + _edje_dragable_pos_set(ed, rp, rp->drag->val.x, rp->drag->val.y); + } + } + ed->recalc_call = EINA_TRUE; + ed->dirty = EINA_TRUE; +#ifdef EDJE_CALC_CACHE + ed->all_part_change = EINA_TRUE; +#endif + if ((evas_object_clipees_get(ed->base->clipper)) && + (evas_object_visible_get(obj))) + evas_object_show(ed->base->clipper); + + /* instantiate 'internal swallows' */ + EINA_LIST_FREE(externals, rp) + { + Edje_Part_Description_External *external; + Evas_Object *child_obj; + + external = (Edje_Part_Description_External *)rp->part->default_desc; + child_obj = _edje_external_type_add(rp->part->source, + evas_object_evas_get(ed->obj), ed->obj, + external->external_params, rp->part->name); + if (child_obj) + { + _edje_real_part_swallow(ed, rp, child_obj, EINA_TRUE); + rp->param1.external_params = _edje_external_params_parse(child_obj, + external->external_params); + _edje_external_recalc_apply(ed, rp, NULL, rp->chosen_description); + } + } + + EINA_LIST_FREE(sources, rp) + { + /* XXX: curr_item and pack_it don't require to be NULL since + * XXX: they are just used when source != NULL and type == BOX, + * XXX: and they're always set in this case, but GCC fails to + * XXX: notice that, so let's shut it up + */ + Edje_Pack_Element **curr_item = NULL; + unsigned int item_count = 0; + Edje_Pack_Element *pack_it = NULL; + const char *source = NULL; + + switch (rp->part->type) + { + case EDJE_PART_TYPE_GROUP: + source = rp->part->source; + break; + + case EDJE_PART_TYPE_BOX: + case EDJE_PART_TYPE_TABLE: + if (rp->part->items) + { + curr_item = rp->part->items; + item_count = rp->part->items_count; + if (item_count > 0) + { + pack_it = *curr_item; + source = pack_it->source; + item_count--; + curr_item++; + } + } + break; + + default: + /* This list should only be filled by group, box or table, nothing else. */ + abort(); + continue; + } + + while (source) + { + Eina_List *l; + Evas_Object *child_obj; + Edje_Pack_Element pack_it_copy; + const char *group_path_entry = eina_stringshare_add(source); + const char *data; + + if (!group_path) + { + group_path = eina_list_append(NULL, eina_stringshare_add(group)); + group_path_started = 1; + } + /* make sure that this group isn't already in the tree of parents */ + EINA_LIST_FOREACH(group_path, l, data) + { + if (data == group_path_entry) + { + ERR("recursive loop group '%s' already included inside part '%s' of group '%s' from file '%s'", + group_path_entry, rp->part->name, group, eina_file_filename_get(file)); + ed->load_error = EDJE_LOAD_ERROR_RECURSIVE_REFERENCE; + eina_stringshare_del(group_path_entry); + goto on_error; + } + } + + if (pack_it) + { + pack_it_copy = *pack_it; + } + else + { + memset(&pack_it_copy, 0, sizeof (pack_it_copy)); + } + + do + { + child_obj = edje_object_add(ed->base->evas); + group_path = eina_list_append(group_path, group_path_entry); + if (rp->part->type == EDJE_PART_TYPE_GROUP) + { + _edje_real_part_swallow(ed, rp, child_obj, EINA_FALSE); + } + + if (!_edje_object_file_set_internal(child_obj, file, source, rp->part->name, group_path, nested)) + { + ERR("impossible to set part '%s' of group '%s' from file '%s' to '%s'", + rp->part->name, group_path_entry, eina_file_filename_get(file), source); + ed->load_error = edje_object_load_error_get(child_obj); + evas_object_del(child_obj); + eina_stringshare_del(group_path_entry); + goto on_error; + } + + group_path = eina_list_remove(group_path, group_path_entry); + + edje_object_propagate_callback_add(child_obj, + _cb_signal_repeat, + obj); + if (rp->part->type == EDJE_PART_TYPE_GROUP) + { + Edje *edg = _edje_fetch(child_obj); + ed->groups = eina_list_append(ed->groups, edg); + evas_object_data_set(child_obj, "\377 edje.part_obj", rp); + _edje_real_part_swallow(ed, rp, child_obj, EINA_FALSE); + _edje_subobj_register(ed, child_obj); + source = NULL; + } + else + { + if ((rp->type == EDJE_RP_TYPE_CONTAINER) && + (rp->typedata.container)) + { + Eina_Strbuf *buf = NULL; + const char *name = pack_it_copy.name; + + pack_it->parent = rp; + + _edje_object_pack_item_hints_set(child_obj, &pack_it_copy); + + if (pack_it->spread.h > 1 && pack_it->spread.w >= 1) + { + buf = eina_strbuf_new(); + if (name) + eina_strbuf_append_printf(buf, "%s{%i,%i}", name, pack_it_copy.col, pack_it_copy.row); + else + eina_strbuf_append_printf(buf, "%i,%i", pack_it_copy.col, pack_it_copy.row); + name = eina_strbuf_string_get(buf); + } + if (name) evas_object_name_set(child_obj, name); + if (buf) eina_strbuf_free(buf); + + if (rp->part->type == EDJE_PART_TYPE_BOX) + { + _edje_real_part_box_append(ed, rp, child_obj); + evas_object_data_set(child_obj, "\377 edje.box_item", pack_it); + } + else if (rp->part->type == EDJE_PART_TYPE_TABLE) + { + _edje_real_part_table_pack(ed, rp, child_obj, + pack_it_copy.col, pack_it_copy.row, + pack_it_copy.colspan, pack_it_copy.rowspan); + evas_object_data_set(child_obj, "\377 edje.table_item", pack_it); + } + _edje_subobj_register(ed, child_obj); + evas_object_show(child_obj); + rp->typedata.container->items = eina_list_append(rp->typedata.container->items, child_obj); + } + } + + pack_it_copy.spread.w--; + pack_it_copy.col++; + if (pack_it_copy.spread.w < 1 && pack_it) + { + pack_it_copy.col = pack_it->col; + pack_it_copy.row++; + pack_it_copy.spread.h--; + pack_it_copy.spread.w = pack_it->spread.w; + } + } + while (pack_it_copy.spread.h > 0); + + eina_stringshare_del(group_path_entry); + + if ((rp->type == EDJE_RP_TYPE_CONTAINER) && + (rp->typedata.container)) + { + if (item_count > 0) + { + pack_it = *curr_item; + source = pack_it->source; + curr_item++; + item_count--; + } + else + { + source = NULL; + curr_item = NULL; + pack_it = NULL; + } + } + } + } + + if (group_path_started) + { + const char *str; + + EINA_LIST_FREE(group_path, str) + eina_stringshare_del(str); + } + + /* reswallow any swallows that existed before setting the file */ + if (collect) + { + Edje_User_Defined *eud; + Eina_List *boxes = NULL; + + EINA_LIST_FREE(collect, eud) + { + Evas_Object *child = NULL; + + switch (eud->type) + { + case EDJE_USER_SWALLOW: + edje_object_part_swallow(obj, eud->part, eud->u.swallow.child); + child = eud->u.swallow.child; + break; + + case EDJE_USER_BOX_PACK: + boxes = eina_list_append(boxes, eud); + eud = NULL; + break; + + case EDJE_USER_TABLE_PACK: + edje_object_part_table_pack(obj, eud->part, eud->u.table.child, + eud->u.table.col, eud->u.table.row, + eud->u.table.colspan, eud->u.table.rowspan); + child = eud->u.table.child; + break; + + case EDJE_USER_DRAG_STEP: + edje_object_part_drag_step_set(obj, eud->part, + eud->u.drag_position.x, + eud->u.drag_position.y); + break; + + case EDJE_USER_DRAG_PAGE: + edje_object_part_drag_page_set(obj, eud->part, + eud->u.drag_position.x, + eud->u.drag_position.y); + break; + + case EDJE_USER_DRAG_VALUE: + edje_object_part_drag_value_set(obj, eud->part, + eud->u.drag_position.x, + eud->u.drag_position.y); + break; + + case EDJE_USER_DRAG_SIZE: + edje_object_part_drag_size_set(obj, eud->part, + eud->u.drag_size.w, + eud->u.drag_size.h); + break; + + case EDJE_USER_STRING: + edje_object_part_text_set(obj, eud->part, eud->u.string.text); + eina_stringshare_del(eud->u.string.text); + break; + } + if (eud) _edje_user_definition_remove(eud, child); + } + + boxes = eina_list_sort(boxes, -1, _sort_defined_boxes); + EINA_LIST_FREE(boxes, eud) + { + edje_object_part_box_append(obj, eud->part, eud->u.box.child); + _edje_user_definition_remove(eud, eud->u.box.child); + } + } + + snprintf(lang, sizeof(lang), "edje,language,%s", _edje_language); + edje_object_signal_emit(obj, lang, "edje"); + + if (edje_object_mirrored_get(obj)) + edje_object_signal_emit(obj, "edje,state,rtl", "edje"); + else + edje_object_signal_emit(obj, "edje,state,ltr", "edje"); + + _edje_recalc(ed); + _edje_util_thaw(ed); + _edje_unblock(ed); + _edje_unref(ed); + ed->load_error = EDJE_LOAD_ERROR_NONE; + _edje_emit(ed, "load", NULL); + + /* instantiate 'internal textblock style' */ + EINA_LIST_FREE(textblocks, rp) + if (rp->part->default_desc) + { + Edje_Part_Description_Text *text; + Edje_Style *stl = NULL; + const char *style; + + text = (Edje_Part_Description_Text *)rp->part->default_desc; + style = edje_string_get(&text->text.style); + if (style) + { + Eina_List *l; + + EINA_LIST_FOREACH(ed->file->styles, l, stl) + { + if ((stl->name) && (!strcmp(stl->name, style))) break; + stl = NULL; + } + } + if (stl) + { + if (evas_object_textblock_style_get(rp->object) != stl->style) + evas_object_textblock_style_set(rp->object, stl->style); + } + } } _edje_entry_init(ed); eina_array_flush(&parts); @@ -1249,7 +1283,7 @@ on_error: const char *path; EINA_LIST_FREE(group_path, path) - eina_stringshare_del(path); + eina_stringshare_del(path); } evas_event_thaw(tev); evas_event_thaw_eval(tev); @@ -1313,62 +1347,66 @@ _edje_object_collect(Edje *ed) switch (eud->type) { case EDJE_USER_STRING: - eud->u.string.text = eina_stringshare_ref(eud->u.string.text); - break; + eud->u.string.text = eina_stringshare_ref(eud->u.string.text); + break; + case EDJE_USER_BOX_PACK: - if (eud->u.box.index == -1) - { - Edje_User_Defined *search; - Edje_Real_Part *rp; - Eina_List *children; - Eina_List *ls; - Evas_Object *child; - int idx = 0; + if (eud->u.box.index == -1) + { + Edje_User_Defined *search; + Edje_Real_Part *rp; + Eina_List *children; + Eina_List *ls; + Evas_Object *child; + int idx = 0; - rp = _edje_real_part_recursive_get(&ed, eud->part); - if (rp) - { - if (rp->part->type != EDJE_PART_TYPE_BOX) continue; + rp = _edje_real_part_recursive_get(&ed, eud->part); + if (rp) + { + if (rp->part->type != EDJE_PART_TYPE_BOX) continue; + + children = evas_object_box_children_get(rp->object); + EINA_LIST_FREE(children, child) + if (!evas_object_data_get(child, "\377 edje.box_item")) + { + EINA_LIST_FOREACH(l, ls, search) + { + if (search->type == EDJE_USER_BOX_PACK && + search->u.box.child == child && + search->part == eud->part /* beauty of stringshare ! */) + { + search->u.box.index = idx++; + break; + } + } + _edje_real_part_box_remove(eud->ed, rp, child); + } + } + } + break; - children = evas_object_box_children_get(rp->object); - EINA_LIST_FREE(children, child) - if (!evas_object_data_get(child, "\377 edje.box_item")) - { - EINA_LIST_FOREACH(l, ls, search) - { - if (search->type == EDJE_USER_BOX_PACK && - search->u.box.child == child && - search->part == eud->part /* beauty of stringshare ! */) - { - search->u.box.index = idx++; - break; - } - } - _edje_real_part_box_remove(eud->ed, rp, child); - } - } - } - break; case EDJE_USER_TABLE_PACK: - { - Edje_Real_Part *rp; + { + Edje_Real_Part *rp; - rp = _edje_real_part_recursive_get(&ed, eud->part); - if (rp) - { - if (rp->part->type != EDJE_PART_TYPE_TABLE) continue; - _edje_real_part_table_unpack(eud->ed, rp, eud->u.table.child); - } - break; + rp = _edje_real_part_recursive_get(&ed, eud->part); + if (rp) + { + if (rp->part->type != EDJE_PART_TYPE_TABLE) continue; + _edje_real_part_table_unpack(eud->ed, rp, eud->u.table.child); } - case EDJE_USER_SWALLOW: - edje_object_part_unswallow(NULL, eud->u.swallow.child); break; + } + + case EDJE_USER_SWALLOW: + edje_object_part_unswallow(NULL, eud->u.swallow.child); + break; + case EDJE_USER_DRAG_STEP: case EDJE_USER_DRAG_PAGE: case EDJE_USER_DRAG_VALUE: case EDJE_USER_DRAG_SIZE: - break; + break; } } @@ -1427,7 +1465,7 @@ _edje_file_del(Edje *ed) #ifdef HAVE_EPHYSICS EINA_LIST_FREE(rp->body_faces, face_obj) - evas_object_del(face_obj); + evas_object_del(face_obj); #endif if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) @@ -1471,9 +1509,11 @@ _edje_file_del(Edje *ed) _edje_external_parsed_params_free(rp->typedata.swallow->swallowed_object, rp->param1.external_params); if (rp->param2) _edje_external_parsed_params_free(rp->typedata.swallow->swallowed_object, rp->param2->external_params); - // fallthrough intentional + + // fallthrough intentional case EDJE_PART_TYPE_GROUP: evas_object_del(rp->typedata.swallow->swallowed_object); + default: break; } @@ -1507,9 +1547,9 @@ _edje_file_del(Edje *ed) if (rp->param2) { free(rp->param2->set); - eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **) &rp->param2->p.map); + eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **)&rp->param2->p.map); #ifdef HAVE_EPHYSICS - eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **) &rp->param2->p.physics); + eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&rp->param2->p.physics); #endif } eina_mempool_free(_edje_real_part_state_mp, rp->param2); @@ -1517,26 +1557,26 @@ _edje_file_del(Edje *ed) if (rp->custom) { free(rp->custom->set); - eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **) &rp->custom->p.map); + eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **)&rp->custom->p.map); #ifdef HAVE_EPHYSICS - eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **) &rp->custom->p.physics); + eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&rp->custom->p.physics); #endif } eina_mempool_free(_edje_real_part_state_mp, rp->custom); if (rp->current) { - eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **) &rp->current->map); + eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **)&rp->current->map); #ifdef HAVE_EPHYSICS - eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **) &rp->current->physics); + eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&rp->current->physics); #endif free(rp->current); rp->current = NULL; } _edje_unref(ed); - eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **) &rp->param1.p.map); + eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **)&rp->param1.p.map); #ifdef HAVE_EPHYSICS - eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **) &rp->param1.p.physics); + eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&rp->param1.p.physics); #endif eina_mempool_free(_edje_real_part_mp, rp); } @@ -1586,7 +1626,8 @@ _edje_file_del(Edje *ed) } if (ed->L) _edje_lua2_script_shutdown(ed); - while (ed->subobjs) _edje_subobj_unregister(ed, ed->subobjs->data); + while (ed->subobjs) + _edje_subobj_unregister(ed, ed->subobjs->data); if (ed->table_parts) free(ed->table_parts); ed->table_parts = NULL; ed->table_parts_size = 0; @@ -1603,9 +1644,9 @@ _edje_file_free(Edje_File *edf) { Edje_Color_Class *ecc; -#define HASH_FREE(Hash) \ - if (Hash) eina_hash_free(Hash); \ - Hash = NULL; +#define HASH_FREE(Hash) \ + if (Hash) eina_hash_free(Hash); \ + Hash = NULL; /* Clean cache before cleaning memory pool */ if (edf->collection_cache) _edje_cache_coll_flush(edf); @@ -1630,8 +1671,7 @@ _edje_file_free(Edje_File *edf) Edje_Image_Directory_Set_Entry *se; EINA_LIST_FREE(edf->image_dir->sets[i].entries, se) - free(se); - + free(se); } free(edf->image_dir->entries); @@ -1687,7 +1727,7 @@ _edje_file_free(Edje_File *edf) } free(edf->mo_dir->mo_entries); free(edf->mo_dir); - } + } if (edf->external_dir) { @@ -1731,9 +1771,9 @@ _edje_program_free(Edje_Program *pr, Eina_Bool free_strings) if (pr->tone_name) eina_stringshare_del(pr->tone_name); } EINA_LIST_FREE(pr->targets, prt) - free(prt); + free(prt); EINA_LIST_FREE(pr->after, pa) - free(pa); + free(pa); free(pr); } @@ -1744,10 +1784,10 @@ _edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec, Edje_Part_Collec _edje_embryo_script_shutdown(ec); -#define EDJE_LOAD_PROGRAM_FREE(Array, Ec, It, FreeStrings) \ - for (It = 0; It < Ec->programs.Array##_count; ++It) \ - _edje_program_free(Ec->programs.Array[It], FreeStrings); \ - free(Ec->programs.Array); +#define EDJE_LOAD_PROGRAM_FREE(Array, Ec, It, FreeStrings) \ + for (It = 0; It < Ec->programs.Array##_count; ++It) \ + _edje_program_free(Ec->programs.Array[It], FreeStrings); \ + free(Ec->programs.Array); EDJE_LOAD_PROGRAM_FREE(fnmatch, ec, i, edf->free_strings); EDJE_LOAD_PROGRAM_FREE(strcmp, ec, i, edf->free_strings); @@ -1773,11 +1813,11 @@ _edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec, Edje_Part_Collec free(ep->other.desc); /* Alloc for RTL objects in edje_calc.c:_edje_part_description_find() */ - if(ep->other.desc_rtl) + if (ep->other.desc_rtl) free(ep->other.desc_rtl); - for (j = 0; j < ep->items_count; ++j) - free(ep->items[j]); + for (j = 0; j < ep->items_count; ++j) + free(ep->items[j]); free(ep->items); // technically need this - but we ASSUME we use "one_big" so everything gets // freed in one go lower down when we del the mempool... but what if pool goes @@ -1794,7 +1834,7 @@ _edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec, Edje_Part_Collec it = eina_hash_iterator_data_new(ec->data); EINA_ITERATOR_FOREACH(it, es) - free(es); + free(es); eina_iterator_free(it); eina_hash_free(ec->data); @@ -1842,42 +1882,44 @@ _edje_collection_free_part_description_clean(int type, Edje_Part_Description_Com switch (type) { case EDJE_PART_TYPE_IMAGE: - { - Edje_Part_Description_Image *img; + { + Edje_Part_Description_Image *img; - img = (Edje_Part_Description_Image *) desc; + img = (Edje_Part_Description_Image *)desc; + + for (i = 0; i < img->image.tweens_count; ++i) + free(img->image.tweens[i]); + free(img->image.tweens); + break; + } - for (i = 0; i < img->image.tweens_count; ++i) - free(img->image.tweens[i]); - free(img->image.tweens); - break; - } case EDJE_PART_TYPE_EXTERNAL: - { - Edje_Part_Description_External *external; + { + Edje_Part_Description_External *external; - external = (Edje_Part_Description_External *) desc; + external = (Edje_Part_Description_External *)desc; + + if (external->external_params) + _edje_external_params_free(external->external_params, free_strings); + break; + } - if (external->external_params) - _edje_external_params_free(external->external_params, free_strings); - break; - } case EDJE_PART_TYPE_TEXT: case EDJE_PART_TYPE_TEXTBLOCK: - if (free_strings) - { - Edje_Part_Description_Text *text; + if (free_strings) + { + Edje_Part_Description_Text *text; - text = (Edje_Part_Description_Text *) desc; + text = (Edje_Part_Description_Text *)desc; - eina_stringshare_del(text->text.text.str); - eina_stringshare_del(text->text.domain); - eina_stringshare_del(text->text.text_class); - eina_stringshare_del(text->text.style.str); - eina_stringshare_del(text->text.font.str); - eina_stringshare_del(text->text.filter.str); - } - break; + eina_stringshare_del(text->text.text.str); + eina_stringshare_del(text->text.domain); + eina_stringshare_del(text->text.text_class); + eina_stringshare_del(text->text.style.str); + eina_stringshare_del(text->text.font.str); + eina_stringshare_del(text->text.filter.str); + } + break; } } @@ -1887,10 +1929,10 @@ _edje_collection_free_part_description_free(int type, Edje_Part_Collection_Directory_Entry *ce, Eina_Bool free_strings) { -#define FREE_POOL(Type, Ce, Desc) \ - case EDJE_PART_TYPE_##Type: eina_mempool_free(Ce->mp.Type, Desc); \ - ce->count.Type--; \ - break; +#define FREE_POOL(Type, Ce, Desc) \ +case EDJE_PART_TYPE_##Type: eina_mempool_free(Ce->mp.Type, Desc); \ + ce->count.Type--; \ + break; _edje_collection_free_part_description_clean(type, desc, free_strings); @@ -1919,6 +1961,7 @@ _edje_collection_free_prog_cache_matches_free_cb(const Eina_Hash *hash EINA_UNUS hash = NULL; fdata = NULL; } + #endif static void @@ -1955,9 +1998,13 @@ _edje_object_pack_item_hints_set(Evas_Object *obj, Edje_Pack_Element *it) switch (it->aspect.mode) { case EDJE_ASPECT_CONTROL_NONE: mode = EVAS_ASPECT_CONTROL_NONE; break; + case EDJE_ASPECT_CONTROL_NEITHER: mode = EVAS_ASPECT_CONTROL_NEITHER; break; + case EDJE_ASPECT_CONTROL_HORIZONTAL: mode = EVAS_ASPECT_CONTROL_HORIZONTAL; break; + case EDJE_ASPECT_CONTROL_VERTICAL: mode = EVAS_ASPECT_CONTROL_VERTICAL; break; + case EDJE_ASPECT_CONTROL_BOTH: mode = EVAS_ASPECT_CONTROL_BOTH; break; } evas_object_size_hint_aspect_set(obj, mode, it->aspect.w, it->aspect.h); @@ -1991,16 +2038,16 @@ static void _cb_signal_repeat(void *data, Evas_Object *obj, const char *sig, const char *source) { Edje_Pack_Element *pack_it; - Evas_Object *parent; - Edje *ed; - Edje *ed_parent; - char new_src[4096]; /* XXX is this max reasonable? */ - size_t length_parent = 0; - size_t length_index = 0; - size_t length_source; - int i = 0; - const char *alias = NULL; - const char *name = NULL; + Evas_Object *parent; + Edje *ed; + Edje *ed_parent; + char new_src[4096]; /* XXX is this max reasonable? */ + size_t length_parent = 0; + size_t length_index = 0; + size_t length_source; + int i = 0; + const char *alias = NULL; + const char *name = NULL; Edje_Message_Signal emsg; parent = data; @@ -2082,7 +2129,7 @@ _cb_signal_repeat(void *data, Evas_Object *obj, const char *sig, const char *sou /* Add back the end of the source */ origin = strlen(new_src); - length ++; /* Remove the trailing ':' from the count */ + length++; /* Remove the trailing ':' from the count */ if (origin > length) { char *tmp; @@ -2104,5 +2151,6 @@ _cb_signal_repeat(void *data, Evas_Object *obj, const char *sig, const char *sou emsg.data = NULL; if (ed_parent) _edje_util_message_send(ed_parent, EDJE_QUEUE_SCRIPT, - EDJE_MESSAGE_SIGNAL, 0, &emsg); + EDJE_MESSAGE_SIGNAL, 0, &emsg); } + diff --git a/src/lib/edje/edje_lua.c b/src/lib/edje/edje_lua.c index 6fb6b2e91f..9253dbe2c9 100644 --- a/src/lib/edje/edje_lua.c +++ b/src/lib/edje/edje_lua.c @@ -11,27 +11,27 @@ #define EDJE_LUA_GET 1 #define EDJE_LUA_SET 2 -#define EDJE_LUA_FN 3 +#define EDJE_LUA_FN 3 -typedef struct _Edje_Lua_Alloc Edje_Lua_Alloc; +typedef struct _Edje_Lua_Alloc Edje_Lua_Alloc; -typedef struct _Edje_Lua_Ref Edje_Lua_Ref; +typedef struct _Edje_Lua_Ref Edje_Lua_Ref; -typedef struct _Edje_Lua_Reg Edje_Lua_Reg; +typedef struct _Edje_Lua_Reg Edje_Lua_Reg; -typedef struct _Edje_Lua_Timer Edje_Lua_Timer; +typedef struct _Edje_Lua_Timer Edje_Lua_Timer; -typedef struct _Edje_Lua_Animator Edje_Lua_Animator; +typedef struct _Edje_Lua_Animator Edje_Lua_Animator; -typedef struct _Edje_Lua_Poller Edje_Lua_Poller; +typedef struct _Edje_Lua_Poller Edje_Lua_Poller; -typedef struct _Edje_Lua_Transform Edje_Lua_Transform; +typedef struct _Edje_Lua_Transform Edje_Lua_Transform; -typedef struct _Edje_Lua_Transition Edje_Lua_Transition; +typedef struct _Edje_Lua_Transition Edje_Lua_Transition; -typedef struct _Edje_Lua_Evas_Object Edje_Lua_Evas_Object; +typedef struct _Edje_Lua_Evas_Object Edje_Lua_Evas_Object; -typedef struct _Edje_Lua_Edje_Part_Object Edje_Lua_Edje_Part_Object; +typedef struct _Edje_Lua_Edje_Part_Object Edje_Lua_Edje_Part_Object; typedef struct _Edje_Lua_Edje_Part_Description Edje_Lua_Edje_Part_Description; @@ -42,7 +42,7 @@ struct _Edje_Lua_Alloc struct _Edje_Lua_Ref { - int id; + int id; lua_State *L; }; @@ -53,65 +53,65 @@ struct _Edje_Lua_Reg struct _Edje_Lua_Timer { - lua_State *L; - Ecore_Timer *et; + lua_State *L; + Ecore_Timer *et; Edje_Lua_Ref *cb; }; struct _Edje_Lua_Animator { - lua_State *L; + lua_State *L; Ecore_Animator *ea; - Edje_Lua_Ref *cb; + Edje_Lua_Ref *cb; }; struct _Edje_Lua_Poller { - lua_State *L; + lua_State *L; Ecore_Poller *ep; Edje_Lua_Ref *cb; }; struct _Edje_Lua_Transform { - lua_State *L; + lua_State *L; Evas_Transform et; }; struct _Edje_Lua_Transition { - lua_State *L; - Ecore_Timer *et; + lua_State *L; + Ecore_Timer *et; Edje_Lua_Ref *trans; Edje_Lua_Ref *cb; Edje_Lua_Ref *ref; - double dur; + double dur; }; struct _Edje_Lua_Evas_Object { - lua_State *L; - Edje *ed; + lua_State *L; + Edje *ed; Evas_Object *eo; - Eina_Bool mouse_events; - Eina_List *cb; + Eina_Bool mouse_events; + Eina_List *cb; }; struct _Edje_Lua_Edje_Part_Object { - lua_State *L; - Edje *ed; - Evas_Object *eo; + lua_State *L; + Edje *ed; + Evas_Object *eo; Edje_Real_Part *rp; - const char *key; + const char *key; }; struct _Edje_Lua_Edje_Part_Description { - lua_State *L; - Edje *ed; - Evas_Object *eo; - Edje_Real_Part *rp; + lua_State *L; + Edje *ed; + Evas_Object *eo; + Edje_Real_Part *rp; Edje_Part_Description *pd; }; @@ -132,25 +132,29 @@ __edje_lua_error(const char *file, const char *fnc, int line, lua_State *L, int switch (err_code) { - case LUA_ERRRUN: - err_type = "runtime"; - break; - case LUA_ERRSYNTAX: - err_type = "syntax"; - break; - case LUA_ERRMEM: - err_type = "memory allocation"; - break; - case LUA_ERRERR: - err_type = "error handler"; - break; - default: - err_type = "unknown"; - break; + case LUA_ERRRUN: + err_type = "runtime"; + break; + + case LUA_ERRSYNTAX: + err_type = "syntax"; + break; + + case LUA_ERRMEM: + err_type = "memory allocation"; + break; + + case LUA_ERRERR: + err_type = "error handler"; + break; + + default: + err_type = "unknown"; + break; } eina_log_print - (_edje_default_log_dom, EINA_LOG_LEVEL_ERR, file, fnc, line, - "Lua %s error: %s", err_type, lua_tostring(L, -1)); + (_edje_default_log_dom, EINA_LOG_LEVEL_ERR, file, fnc, line, + "Lua %s error: %s", err_type, lua_tostring(L, -1)); // don't exit. this is BAD. lua script bugs will cause thngs like e to // exit mysteriously ending your x session. bad! // exit(-1); @@ -182,7 +186,7 @@ _edje_lua_new_thread(Edje *ed, lua_State *L) lua_setmetatable(L, -2); lua_setfenv(L, -2); return thread; -#endif +#endif } void @@ -191,37 +195,37 @@ _edje_lua_free_thread(Edje *ed, lua_State *L) #if 1 // newlua luaL_unref(L, LUA_REGISTRYINDEX, ed->lua_ref); lua_gc(L, LUA_GCCOLLECT, 0); -#else +#else lua_pushthread(L); lua_getfenv(L, -1); lua_pushnil(L); while (lua_next(L, -2)) { - // key at -2, value at -1 - lua_pop(L, 1); - lua_pushvalue(L, -1); - lua_pushnil(L); - lua_rawset(L, -4); + // key at -2, value at -1 + lua_pop(L, 1); + lua_pushvalue(L, -1); + lua_pushnil(L); + lua_rawset(L, -4); } lua_settop(L, 0); lua_gc(L, LUA_GCCOLLECT, 0); -#endif +#endif } /* * only for debug, returns number of objects in registry */ static int -_edje_lua_reg_count (lua_State *L) +_edje_lua_reg_count(lua_State *L) { int count = 0; lua_pushvalue(L, LUA_REGISTRYINDEX); lua_pushnil(L); while (lua_next(L, -2)) { - // key at -2, value at -1 - lua_pop(L, 1); - count++; + // key at -2, value at -1 + lua_pop(L, 1); + count++; } lua_pop(L, 1); return count; @@ -286,9 +290,9 @@ _edje_lua_rawsetfield(lua_State *L, int index, const char *key) lua_pushstring(L, key); lua_insert(L, -2); if (index < 0) - lua_rawset(L, index - 1); + lua_rawset(L, index - 1); else - lua_rawset(L, index); + lua_rawset(L, index); } static void @@ -296,9 +300,9 @@ _edje_lua_rawgetfield(lua_State *L, int index, const char *key) { lua_pushstring(L, key); if (index < 0) - lua_rawget(L, index - 1); + lua_rawget(L, index - 1); else - lua_rawget(L, index); + lua_rawget(L, index); } static void @@ -309,7 +313,7 @@ _edje_lua_new_const(lua_State *L, const char *id, int val) } static void -_edje_lua_new_metatable(lua_State *L, const Edje_Lua_Reg ** class) +_edje_lua_new_metatable(lua_State *L, const Edje_Lua_Reg **class) { lua_newtable(L); lua_pushlightuserdata(L, class); @@ -321,14 +325,14 @@ _edje_lua_new_metatable(lua_State *L, const Edje_Lua_Reg ** class) } static void -_edje_lua_get_metatable(lua_State *L, const Edje_Lua_Reg ** class) +_edje_lua_get_metatable(lua_State *L, const Edje_Lua_Reg **class) { lua_pushlightuserdata(L, class); lua_rawget(L, LUA_REGISTRYINDEX); } static void -_edje_lua_free_metatable(lua_State *L, const Edje_Lua_Reg ** class) +_edje_lua_free_metatable(lua_State *L, const Edje_Lua_Reg **class) { lua_pushlightuserdata(L, class); lua_rawget(L, LUA_REGISTRYINDEX); @@ -341,97 +345,97 @@ _edje_lua_free_metatable(lua_State *L, const Edje_Lua_Reg ** class) } static void * -_edje_lua_checkudata(lua_State *L, int pos, const Edje_Lua_Reg * module) +_edje_lua_checkudata(lua_State *L, int pos, const Edje_Lua_Reg *module) { luaL_checktype(L, pos, LUA_TUSERDATA); lua_getmetatable(L, pos); lua_rawget(L, LUA_REGISTRYINDEX); Edje_Lua_Reg **class = lua_touserdata(L, -1); - lua_pop(L, 1); // class + lua_pop(L, 1); // class int flag = 0; int ptr = 0; while (class[ptr] && !flag) - if (class[ptr++] == module) - flag = 1; + if (class[ptr++] == module) + flag = 1; if (!flag) { - lua_pushstring(L, "class type mismatch"); - lua_error(L); + lua_pushstring(L, "class type mismatch"); + lua_error(L); } return lua_touserdata(L, pos); } static void -_edje_lua_new_class(lua_State *L, const Edje_Lua_Reg ** class) +_edje_lua_new_class(lua_State *L, const Edje_Lua_Reg **class) { int n = 0; _edje_lua_new_metatable(L, class); while (class && (class[n] != NULL)) { - luaL_register(L, NULL, class[n]->mt); - lua_pushstring(L, "hands off, it's none of your business!"); - _edje_lua_rawsetfield(L, -2, "__metatable"); + luaL_register(L, NULL, class[n]->mt); + lua_pushstring(L, "hands off, it's none of your business!"); + _edje_lua_rawsetfield(L, -2, "__metatable"); - if (n == 0) - { - lua_newtable(L); - luaL_register(L, NULL, class[n]->set); - lua_rawseti (L, -2, EDJE_LUA_SET); + if (n == 0) + { + lua_newtable(L); + luaL_register(L, NULL, class[n]->set); + lua_rawseti(L, -2, EDJE_LUA_SET); - lua_newtable(L); - luaL_register(L, NULL, class[n]->get); - lua_rawseti (L, -2, EDJE_LUA_GET); + lua_newtable(L); + luaL_register(L, NULL, class[n]->get); + lua_rawseti(L, -2, EDJE_LUA_GET); - lua_newtable(L); - luaL_register(L, NULL, class[n]->fn); - lua_rawseti (L, -2, EDJE_LUA_FN); - } - else - { - lua_rawgeti(L, -1, EDJE_LUA_SET); - luaL_register(L, NULL, class[n]->set); - lua_pop(L, 1); + lua_newtable(L); + luaL_register(L, NULL, class[n]->fn); + lua_rawseti(L, -2, EDJE_LUA_FN); + } + else + { + lua_rawgeti(L, -1, EDJE_LUA_SET); + luaL_register(L, NULL, class[n]->set); + lua_pop(L, 1); - lua_rawgeti(L, -1, EDJE_LUA_GET); - luaL_register(L, NULL, class[n]->get); - lua_pop(L, 1); + lua_rawgeti(L, -1, EDJE_LUA_GET); + luaL_register(L, NULL, class[n]->get); + lua_pop(L, 1); - lua_rawgeti(L, -1, EDJE_LUA_FN); - luaL_register(L, NULL, class[n]->fn); - lua_pop(L, 1); - } - n += 1; + lua_rawgeti(L, -1, EDJE_LUA_FN); + luaL_register(L, NULL, class[n]->fn); + lua_pop(L, 1); + } + n += 1; } } static void -_edje_lua_set_class(lua_State *L, int index, const Edje_Lua_Reg ** class) +_edje_lua_set_class(lua_State *L, int index, const Edje_Lua_Reg **class) { lua_newtable(L); if (index < 0) - lua_setfenv(L, index - 1); + lua_setfenv(L, index - 1); else - lua_setfenv(L, index); + lua_setfenv(L, index); _edje_lua_get_metatable(L, class); if (index < 0) - lua_setmetatable(L, index - 1); + lua_setmetatable(L, index - 1); else - lua_setmetatable(L, index); + lua_setmetatable(L, index); } static int _edje_lua_look_fn(lua_State *L) { lua_rawgeti(L, -1, EDJE_LUA_FN); - lua_pushvalue(L, 2); // key - lua_rawget(L, -2); // .fn[key] + lua_pushvalue(L, 2); // key + lua_rawget(L, -2); // .fn[key] if (lua_iscfunction(L, -1)) - return 1; + return 1; else { - lua_pop(L, 2); // .fn[key], .fn - return 0; + lua_pop(L, 2); // .fn[key], .fn + return 0; } } @@ -439,22 +443,22 @@ static int _edje_lua_look_get(lua_State *L) { lua_rawgeti(L, -1, EDJE_LUA_GET); - lua_pushvalue(L, 2); // key - lua_rawget(L, -2); // .get[key] + lua_pushvalue(L, 2); // key + lua_rawget(L, -2); // .get[key] if (lua_iscfunction(L, -1)) { - int err_code; + int err_code; - lua_pushvalue(L, 1); + lua_pushvalue(L, 1); - if ((err_code = lua_pcall(L, 1, 1, 0))) - _edje_lua_error(L, err_code); - return 1; + if ((err_code = lua_pcall(L, 1, 1, 0))) + _edje_lua_error(L, err_code); + return 1; } else { - lua_pop(L, 2); // .get[key], .get - return 0; + lua_pop(L, 2); // .get[key], .get + return 0; } } @@ -462,23 +466,23 @@ static int _edje_lua_look_set(lua_State *L) { lua_rawgeti(L, -1, EDJE_LUA_SET); - lua_pushvalue(L, 2); // key - lua_rawget(L, -2); // .set[key] + lua_pushvalue(L, 2); // key + lua_rawget(L, -2); // .set[key] if (lua_iscfunction(L, -1)) { - int err_code; + int err_code; - lua_pushvalue(L, 1); // obj - lua_pushvalue(L, 3); // value + lua_pushvalue(L, 1); // obj + lua_pushvalue(L, 3); // value - if ((err_code = lua_pcall(L, 2, 0, 0))) // .set[key](obj,key,value) - _edje_lua_error(L, err_code); - return 1; + if ((err_code = lua_pcall(L, 2, 0, 0))) // .set[key](obj,key,value) + _edje_lua_error(L, err_code); + return 1; } else { - lua_pop(L, 2); // .set[key], .set - return 0; + lua_pop(L, 2); // .set[key], .set + return 0; } } @@ -487,7 +491,7 @@ _edje_lua_look_set(lua_State *L) */ const luaL_Reg lNil[] = { - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; const luaL_Reg lClass_mt[]; @@ -506,13 +510,13 @@ _edje_lua_class_mt_index(lua_State *L) { _edje_lua_checkudata(L, 1, &mClass); lua_getmetatable(L, 1); - if (!_edje_lua_look_fn(L)) // look in lClass_fn - if (!_edje_lua_look_get(L)) // look in lClass_get - { // look in obj ref hash - lua_getfenv(L, 1); - lua_pushvalue(L, 2); // key - lua_rawget(L, -2); - } + if (!_edje_lua_look_fn(L)) // look in lClass_fn + if (!_edje_lua_look_get(L)) // look in lClass_get + { // look in obj ref hash + lua_getfenv(L, 1); + lua_pushvalue(L, 2); // key + lua_rawget(L, -2); + } return 1; } @@ -521,12 +525,12 @@ _edje_lua_class_mt_newindex(lua_State *L) { _edje_lua_checkudata(L, 1, &mClass); lua_getmetatable(L, 1); - if (!_edje_lua_look_set(L)) // look in lClass_set - { // look in obj ref hash - lua_getfenv(L, 1); - lua_pushvalue(L, 2); - lua_pushvalue(L, 3); - lua_rawset(L, -3); + if (!_edje_lua_look_set(L)) // look in lClass_set + { // look in obj ref hash + lua_getfenv(L, 1); + lua_pushvalue(L, 2); + lua_pushvalue(L, 3); + lua_rawset(L, -3); } return 0; } @@ -537,17 +541,17 @@ _edje_lua_class_mt_gc(lua_State *L) _edje_lua_checkudata(L, 1, &mClass); //printf("_edje_lua_class_mt_gc\n"); /* FIXME has to be commented to not raise an error, solve differently - lua_getfield(L, 1, "del"); - if (!lua_isnil(L, -1)) - { - lua_pushvalue(L, 1); - int err_code; + lua_getfield(L, 1, "del"); + if (!lua_isnil(L, -1)) + { + lua_pushvalue(L, 1); + int err_code; - if (err_code = lua_pcall(L, 1, 0, 0)) - _edje_lua_error(L, err_code); - } - lua_pop(L, 1); - */ + if (err_code = lua_pcall(L, 1, 0, 0)) + _edje_lua_error(L, err_code); + } + lua_pop(L, 1); + */ return 0; } @@ -563,10 +567,10 @@ _edje_lua_class_fn_set(lua_State *L) lua_pushnil(L); while (lua_next(L, 2)) { - // key at -2, value at -1 - lua_pushvalue(L, -2); - lua_insert(L, -2); - lua_settable(L, 1); + // key at -2, value at -1 + lua_pushvalue(L, -2); + lua_insert(L, -2); + lua_settable(L, 1); } return 0; } @@ -582,22 +586,22 @@ _edje_lua_class_fn_get(lua_State *L) * res[k] = obj[k] * end */ - lua_newtable(L); // res - lua_getmetatable(L, 1); // mt + lua_newtable(L); // res + lua_getmetatable(L, 1); // mt lua_getfield(L, -1, ".get"); - lua_remove(L, -2); // mt + lua_remove(L, -2); // mt lua_pushnil(L); while (lua_next(L, -2)) { - // key at -2, value at -1 - lua_pop(L, 1); // value = cfunction - lua_pushvalue(L, -1); // key - lua_pushvalue(L, -1); // key - lua_gettable(L, 1); // obj[key] - lua_settable(L, 2); // res[key] + // key at -2, value at -1 + lua_pop(L, 1); // value = cfunction + lua_pushvalue(L, -1); // key + lua_pushvalue(L, -1); // key + lua_gettable(L, 1); // obj[key] + lua_settable(L, 2); // res[key] } - lua_pop(L, 1); // .get + lua_pop(L, 1); // .get return 1; } @@ -607,14 +611,14 @@ _edje_lua_class_itr_call(lua_State *L, int id) int err_code; _edje_lua_checkudata(L, 1, &mClass); - lua_getmetatable(L, 1); // mt + lua_getmetatable(L, 1); // mt lua_rawgeti(L, -1, id); - lua_remove(L, -2); // mt + lua_remove(L, -2); // mt lua_getglobal(L, "pairs"); lua_insert(L, -2); if ((err_code = lua_pcall(L, 1, 3, 0))) - _edje_lua_error(L, err_code); + _edje_lua_error(L, err_code); return 3; } @@ -650,7 +654,7 @@ _edje_lua_class_fn_pairs(lua_State *L) lua_insert(L, -2); if ((err_code = lua_pcall(L, 1, 3, 0))) - _edje_lua_error(L, err_code); + _edje_lua_error(L, err_code); return 3; } @@ -665,7 +669,7 @@ _edje_lua_class_fn_ipairs(lua_State *L) lua_insert(L, -2); if ((err_code = lua_pcall(L, 1, 3, 0))) - _edje_lua_error(L, err_code); + _edje_lua_error(L, err_code); return 3; } @@ -673,7 +677,7 @@ const luaL_Reg lClass_mt[] = { {"__index", _edje_lua_class_mt_index}, {"__newindex", _edje_lua_class_mt_newindex}, {"__gc", _edje_lua_class_mt_gc}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; const luaL_Reg lClass_fn[] = { @@ -684,10 +688,9 @@ const luaL_Reg lClass_fn[] = { {"fpairs", _edje_lua_class_fn_fpairs}, {"pairs", _edje_lua_class_fn_pairs}, {"ipairs", _edje_lua_class_fn_ipairs}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; - const luaL_Reg lTimer_get[]; const luaL_Reg lTimer_set[]; @@ -704,7 +707,7 @@ const Edje_Lua_Reg mTimer = { const Edje_Lua_Reg *cTimer[] = { &mClass, &mTimer, - NULL // sentinel + NULL // sentinel }; static Eina_Bool @@ -715,7 +718,7 @@ _edje_lua_timer_cb(void *data) int err_code; Eina_Bool res; - _edje_lua_get_ref(L, obj->cb); // callback function + _edje_lua_get_ref(L, obj->cb); // callback function _edje_lua_get_reg(L, obj); if ((err_code = lua_pcall(L, 1, 1, 0))) @@ -725,22 +728,22 @@ _edje_lua_timer_cb(void *data) } res = luaL_optint(L, -1, ECORE_CALLBACK_CANCEL); + lua_pop(L, 1); // -- res + +/* + if (_edje_lua_panic_here()) + printf("blahc\n"); + else lua_pop(L, 1); // -- res - -/* - if (_edje_lua_panic_here()) - printf("blahc\n"); - else - lua_pop(L, 1); // -- res */ if (res == ECORE_CALLBACK_CANCEL) { - // delete object - _edje_lua_get_reg(L, obj); - lua_pushvalue(L, -1); - lua_pushstring(L, "del"); - lua_gettable(L, -2); - lua_insert(L, -2); + // delete object + _edje_lua_get_reg(L, obj); + lua_pushvalue(L, -1); + lua_pushstring(L, "del"); + lua_gettable(L, -2); + lua_insert(L, -2); if ((err_code = lua_pcall(L, 1, 0, 0))) _edje_lua_error(L, err_code); } @@ -752,9 +755,9 @@ _edje_lua_timer_get_pending(lua_State *L) { Edje_Lua_Timer *obj = _edje_lua_checkudata(L, 1, &mTimer); if (obj->et) - lua_pushnumber(L, ecore_timer_pending_get(obj->et)); + lua_pushnumber(L, ecore_timer_pending_get(obj->et)); else - lua_pushnil(L); + lua_pushnil(L); return 1; } @@ -767,7 +770,7 @@ _edje_lua_timer_get_precision(lua_State *L) lua_pushnumber(L, ecore_timer_precision_get()); else lua_pushnil(L); - + return 1; } @@ -788,7 +791,7 @@ const luaL_Reg lTimer_get[] = { {"pending", _edje_lua_timer_get_pending}, {"precision", _edje_lua_timer_get_precision}, {"interval", _edje_lua_timer_get_interval}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; static int @@ -796,13 +799,13 @@ _edje_lua_timer_set_interval(lua_State *L) { Edje_Lua_Timer *obj = _edje_lua_checkudata(L, 1, &mTimer); if (obj->et) - ecore_timer_interval_set(obj->et, luaL_checknumber(L, 2)); + ecore_timer_interval_set(obj->et, luaL_checknumber(L, 2)); return 0; } const luaL_Reg lTimer_set[] = { {"interval", _edje_lua_timer_set_interval}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; static int @@ -811,13 +814,13 @@ _edje_lua_timer_fn_del(lua_State *L) Edje_Lua_Timer *obj = _edje_lua_checkudata(L, 1, &mTimer); if (obj->et) { - ecore_timer_del(obj->et); - obj->et = NULL; + ecore_timer_del(obj->et); + obj->et = NULL; } if (obj->cb) { - _edje_lua_free_ref(L, obj->cb); // created in _edje_lua_group_fn_timer - obj->cb = NULL; + _edje_lua_free_ref(L, obj->cb); // created in _edje_lua_group_fn_timer + obj->cb = NULL; } _edje_lua_free_reg(L, obj); // created in _edje_lua_group_fn_timer return 0; @@ -828,7 +831,7 @@ _edje_lua_timer_fn_freeze(lua_State *L) { Edje_Lua_Timer *obj = _edje_lua_checkudata(L, 1, &mTimer); if (obj->et) - ecore_timer_freeze(obj->et); + ecore_timer_freeze(obj->et); return 0; } @@ -837,7 +840,7 @@ _edje_lua_timer_fn_thaw(lua_State *L) { Edje_Lua_Timer *obj = _edje_lua_checkudata(L, 1, &mTimer); if (obj->et) - ecore_timer_thaw(obj->et); + ecore_timer_thaw(obj->et); return 0; } @@ -846,7 +849,7 @@ _edje_lua_timer_fn_delay(lua_State *L) { Edje_Lua_Timer *obj = _edje_lua_checkudata(L, 1, &mTimer); if (obj->et) - ecore_timer_delay(obj->et, luaL_checknumber(L, 2)); + ecore_timer_delay(obj->et, luaL_checknumber(L, 2)); return 0; } @@ -855,7 +858,7 @@ const luaL_Reg lTimer_fn[] = { {"freeze", _edje_lua_timer_fn_freeze}, {"thaw", _edje_lua_timer_fn_thaw}, {"delay", _edje_lua_timer_fn_delay}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; const luaL_Reg lAnimator_get[]; @@ -872,7 +875,7 @@ const Edje_Lua_Reg mAnimator = { const Edje_Lua_Reg *cAnimator[] = { &mClass, &mAnimator, - NULL // sentinel + NULL // sentinel }; static Eina_Bool @@ -893,15 +896,15 @@ _edje_lua_animator_cb(void *data) } res = luaL_checkint(L, -1); - lua_pop(L, 1); // Pop res off the stack + lua_pop(L, 1); // Pop res off the stack if (res == ECORE_CALLBACK_CANCEL) { - /* delete animator */ - _edje_lua_get_reg(L, obj); - lua_pushvalue(L, -1); - lua_pushstring(L, "del"); - lua_gettable(L, -2); - lua_insert(L, -2); + /* delete animator */ + _edje_lua_get_reg(L, obj); + lua_pushvalue(L, -1); + lua_pushstring(L, "del"); + lua_gettable(L, -2); + lua_insert(L, -2); if ((err = lua_pcall(L, 1, 0, 0))) _edje_lua_error(L, err); } @@ -923,8 +926,8 @@ _edje_lua_animator_get_frametime(lua_State *L) } const luaL_Reg lAnimator_get[] = { - {"frametime", _edje_lua_animator_get_frametime}, - {NULL, NULL} + {"frametime", _edje_lua_animator_get_frametime}, + {NULL, NULL} }; static int @@ -933,13 +936,13 @@ _edje_lua_animator_fn_del(lua_State *L) Edje_Lua_Animator *obj = _edje_lua_checkudata(L, 1, &mAnimator); if (obj->ea) { - ecore_animator_del(obj->ea); - obj->ea = NULL; + ecore_animator_del(obj->ea); + obj->ea = NULL; } if (obj->cb) { - _edje_lua_free_ref(L, obj->cb); // created in _edje_lua_group_fn_animator - obj->cb = NULL; + _edje_lua_free_ref(L, obj->cb); // created in _edje_lua_group_fn_animator + obj->cb = NULL; } _edje_lua_free_reg(L, obj); // created in _edje_lua_group_fn_animator return 0; @@ -947,7 +950,7 @@ _edje_lua_animator_fn_del(lua_State *L) const luaL_Reg lAnimator_fn[] = { {"del", _edje_lua_animator_fn_del}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; const luaL_Reg lPoller_get[]; @@ -964,7 +967,7 @@ const Edje_Lua_Reg mPoller = { const Edje_Lua_Reg *cPoller[] = { &mClass, &mPoller, - NULL // sentinel + NULL // sentinel }; static Eina_Bool @@ -985,15 +988,15 @@ _edje_lua_poller_cb(void *data) } res = luaL_checkint(L, -1); - lua_pop(L, 1); // Pop res off the stack + lua_pop(L, 1); // Pop res off the stack if (res == ECORE_CALLBACK_CANCEL) { - /* delete poller */ - _edje_lua_get_reg(L, obj); - lua_pushvalue(L, -1); - lua_pushstring(L, "del"); - lua_gettable(L, -2); - lua_insert(L, -2); + /* delete poller */ + _edje_lua_get_reg(L, obj); + lua_pushvalue(L, -1); + lua_pushstring(L, "del"); + lua_gettable(L, -2); + lua_insert(L, -2); if ((err = lua_pcall(L, 1, 0, 0))) _edje_lua_error(L, err); } @@ -1025,14 +1028,14 @@ _edje_lua_poller_fn_del(lua_State *L) Edje_Lua_Poller *obj = _edje_lua_checkudata(L, 1, &mPoller); if (obj->ep) { - ecore_poller_del(obj->ep); - obj->ep = NULL; + ecore_poller_del(obj->ep); + obj->ep = NULL; } if (obj->cb) { - _edje_lua_free_ref(L, obj->cb); // created in _edje_lua_group_fn_poller - obj->cb = NULL; + _edje_lua_free_ref(L, obj->cb); // created in _edje_lua_group_fn_poller + obj->cb = NULL; } _edje_lua_free_reg(L, obj); // created in _edje_lua_group_fn_poller @@ -1064,7 +1067,7 @@ const Edje_Lua_Reg mTransform = { const Edje_Lua_Reg *cTransform[] = { &mClass, &mTransform, - NULL // sentinel + NULL // sentinel }; static int @@ -1072,27 +1075,27 @@ _edje_lua_transform_get_matrix(lua_State *L) { Edje_Lua_Transform *obj = _edje_lua_checkudata(L, 1, &mTransform); lua_createtable(L, 3, 0); - lua_createtable(L, 3, 0); - lua_pushnumber(L, obj->et.mxx); lua_rawseti(L, -2, 1); - lua_pushnumber(L, obj->et.mxy); lua_rawseti(L, -2, 2); - lua_pushnumber(L, obj->et.mxz); lua_rawseti(L, -2, 3); - lua_rawseti(L, -2, 1); - lua_createtable(L, 3, 0); - lua_pushnumber(L, obj->et.myx); lua_rawseti(L, -2, 1); - lua_pushnumber(L, obj->et.myy); lua_rawseti(L, -2, 2); - lua_pushnumber(L, obj->et.myz); lua_rawseti(L, -2, 3); - lua_rawseti(L, -2, 2); - lua_createtable(L, 3, 0); - lua_pushnumber(L, obj->et.mzx); lua_rawseti(L, -2, 1); - lua_pushnumber(L, obj->et.mzy); lua_rawseti(L, -2, 2); - lua_pushnumber(L, obj->et.mzz); lua_rawseti(L, -2, 3); - lua_rawseti(L, -2, 3); + lua_createtable(L, 3, 0); + lua_pushnumber(L, obj->et.mxx); lua_rawseti(L, -2, 1); + lua_pushnumber(L, obj->et.mxy); lua_rawseti(L, -2, 2); + lua_pushnumber(L, obj->et.mxz); lua_rawseti(L, -2, 3); + lua_rawseti(L, -2, 1); + lua_createtable(L, 3, 0); + lua_pushnumber(L, obj->et.myx); lua_rawseti(L, -2, 1); + lua_pushnumber(L, obj->et.myy); lua_rawseti(L, -2, 2); + lua_pushnumber(L, obj->et.myz); lua_rawseti(L, -2, 3); + lua_rawseti(L, -2, 2); + lua_createtable(L, 3, 0); + lua_pushnumber(L, obj->et.mzx); lua_rawseti(L, -2, 1); + lua_pushnumber(L, obj->et.mzy); lua_rawseti(L, -2, 2); + lua_pushnumber(L, obj->et.mzz); lua_rawseti(L, -2, 3); + lua_rawseti(L, -2, 3); return 1; } const luaL_Reg lTransform_get[] = { {"matrix", _edje_lua_transform_get_matrix}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; static int @@ -1100,30 +1103,30 @@ _edje_lua_transform_set_matrix(lua_State *L) { Edje_Lua_Transform *obj = _edje_lua_checkudata(L, 1, &mTransform); luaL_checktype(L, 2, LUA_TTABLE); - lua_rawgeti(L, 2, 1); - luaL_checktype(L, -1, LUA_TTABLE); - lua_rawgeti(L, -1, 1); obj->et.mxx = luaL_checknumber(L, -1); lua_pop(L, 1); - lua_rawgeti(L, -1, 2); obj->et.mxy = luaL_checknumber(L, -1); lua_pop(L, 1); - lua_rawgeti(L, -1, 3); obj->et.mxz = luaL_checknumber(L, -1); lua_pop(L, 1); - lua_pop(L, 1); - lua_rawgeti(L, 2, 2); - luaL_checktype(L, -1, LUA_TTABLE); - lua_rawgeti(L, -1, 1); obj->et.myx = luaL_checknumber(L, -1); lua_pop(L, 1); - lua_rawgeti(L, -1, 2); obj->et.myy = luaL_checknumber(L, -1); lua_pop(L, 1); - lua_rawgeti(L, -1, 3); obj->et.myz = luaL_checknumber(L, -1); lua_pop(L, 1); - lua_pop(L, 1); - lua_rawgeti(L, 2, 3); - luaL_checktype(L, -1, LUA_TTABLE); - lua_rawgeti(L, -1, 1); obj->et.mzx = luaL_checknumber(L, -1); lua_pop(L, 1); - lua_rawgeti(L, -1, 2); obj->et.mzy = luaL_checknumber(L, -1); lua_pop(L, 1); - lua_rawgeti(L, -1, 3); obj->et.mzz = luaL_checknumber(L, -1); lua_pop(L, 1); - lua_pop(L, 1); + lua_rawgeti(L, 2, 1); + luaL_checktype(L, -1, LUA_TTABLE); + lua_rawgeti(L, -1, 1); obj->et.mxx = luaL_checknumber(L, -1); lua_pop(L, 1); + lua_rawgeti(L, -1, 2); obj->et.mxy = luaL_checknumber(L, -1); lua_pop(L, 1); + lua_rawgeti(L, -1, 3); obj->et.mxz = luaL_checknumber(L, -1); lua_pop(L, 1); + lua_pop(L, 1); + lua_rawgeti(L, 2, 2); + luaL_checktype(L, -1, LUA_TTABLE); + lua_rawgeti(L, -1, 1); obj->et.myx = luaL_checknumber(L, -1); lua_pop(L, 1); + lua_rawgeti(L, -1, 2); obj->et.myy = luaL_checknumber(L, -1); lua_pop(L, 1); + lua_rawgeti(L, -1, 3); obj->et.myz = luaL_checknumber(L, -1); lua_pop(L, 1); + lua_pop(L, 1); + lua_rawgeti(L, 2, 3); + luaL_checktype(L, -1, LUA_TTABLE); + lua_rawgeti(L, -1, 1); obj->et.mzx = luaL_checknumber(L, -1); lua_pop(L, 1); + lua_rawgeti(L, -1, 2); obj->et.mzy = luaL_checknumber(L, -1); lua_pop(L, 1); + lua_rawgeti(L, -1, 3); obj->et.mzz = luaL_checknumber(L, -1); lua_pop(L, 1); + lua_pop(L, 1); return 0; } const luaL_Reg lTransform_set[] = { {"matrix", _edje_lua_transform_set_matrix}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; static int @@ -1182,7 +1185,7 @@ const luaL_Reg lTransform_fn[] = { {"scale", _edje_lua_transform_fn_scale}, {"shear", _edje_lua_transform_fn_shear}, {"compose", _edje_lua_transform_fn_compose}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; /* @@ -1205,19 +1208,19 @@ const Edje_Lua_Reg mTransition = { const Edje_Lua_Reg *cTransition[] = { &mClass, &mTransition, - NULL // sentinel + NULL // sentinel }; const luaL_Reg lTransition_get[] = { - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; const luaL_Reg lTransition_set[] = { - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; const luaL_Reg lTransition_fn[] = { - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; const luaL_Reg lObject_get[]; @@ -1234,7 +1237,7 @@ const Edje_Lua_Reg mObject = { }; static void -_edje_lua_object_del_cb(void *data, EINA_UNUSED Evas * e, Evas_Object * obj, EINA_UNUSED void *event_info) +_edje_lua_object_del_cb(void *data, EINA_UNUSED Evas *e, Evas_Object *obj, EINA_UNUSED void *event_info) { //printf("_edje_lua_object_delete_cb\n"); lua_State *L = data; @@ -1246,19 +1249,19 @@ _edje_lua_object_del_cb(void *data, EINA_UNUSED Evas * e, Evas_Object * obj, EIN Edje_Lua_Ref *ref; EINA_LIST_FREE(udata->cb, ref) - _edje_lua_free_ref(L, ref); + _edje_lua_free_ref(L, ref); } static int _edje_lua_object_fn_del(lua_State *L) { Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject); - + if (obj->eo) { - evas_object_del(obj->eo); - obj->eo = NULL; - obj->ed = NULL; + evas_object_del(obj->eo); + obj->eo = NULL; + obj->ed = NULL; } return 0; } @@ -1285,8 +1288,8 @@ _edje_lua_object_fn_move(lua_State *L) Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject); //printf ("%i %i %i %i\n", obj->ed->x, obj->ed->y, luaL_checkint (L, 2), luaL_checkint (L, 3)); evas_object_move(obj->eo, - obj->ed->x + luaL_checkint(L, 2), - obj->ed->y + luaL_checkint(L, 3)); + obj->ed->x + luaL_checkint(L, 2), + obj->ed->y + luaL_checkint(L, 3)); return 0; } @@ -1351,7 +1354,7 @@ const luaL_Reg lObject_fn[] = { {"stack_above", _edje_lua_object_fn_stack_above}, {"stack_below", _edje_lua_object_fn_stack_below}, {"clip_unset", _edje_lua_object_fn_clip_unset}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; static int @@ -1593,16 +1596,16 @@ static int _edje_lua_object_get_clipees(lua_State *L) { Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mObject); - Eina_List *clipees = (Eina_List *) evas_object_clipees_get(obj->eo); + Eina_List *clipees = (Eina_List *)evas_object_clipees_get(obj->eo); Eina_List *l; Evas_Object *clip; int i = 1; lua_createtable(L, eina_list_count(clipees), 0); EINA_LIST_FOREACH(clipees, l, clip) { - _edje_lua_get_reg(L, clip); - // TODO create object if it does not already exist? - lua_rawseti(L, -2, i++); + _edje_lua_get_reg(L, clip); + // TODO create object if it does not already exist? + lua_rawseti(L, -2, i++); } return 1; } @@ -1702,7 +1705,7 @@ const luaL_Reg lObject_get[] = { {"pointer_mode", _edje_lua_object_get_pointer_mode}, {"precise_is_inside", _edje_lua_object_get_precise_is_inside}, {"mouse_events", _edje_lua_object_get_mouse_events}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; static int @@ -1729,8 +1732,8 @@ _edje_lua_object_set_size_hint_min(lua_State *L) lua_rawgeti(L, 2, 1); lua_rawgeti(L, 2, 2); evas_object_size_hint_min_set(obj->eo, - luaL_checkint(L, -2), - luaL_checkint(L, -1)); + luaL_checkint(L, -2), + luaL_checkint(L, -1)); return 0; } @@ -1742,8 +1745,8 @@ _edje_lua_object_set_size_hint_max(lua_State *L) lua_rawgeti(L, 2, 1); lua_rawgeti(L, 2, 2); evas_object_size_hint_max_set(obj->eo, - luaL_checkint(L, -2), - luaL_checkint(L, -1)); + luaL_checkint(L, -2), + luaL_checkint(L, -1)); return 0; } @@ -1755,8 +1758,8 @@ _edje_lua_object_set_size_hint_request(lua_State *L) lua_rawgeti(L, 2, 1); lua_rawgeti(L, 2, 2); evas_object_size_hint_request_set(obj->eo, - luaL_checkint(L, -2), - luaL_checkint(L, -1)); + luaL_checkint(L, -2), + luaL_checkint(L, -1)); return 0; } @@ -1769,9 +1772,9 @@ _edje_lua_object_set_size_hint_aspect(lua_State *L) lua_rawgeti(L, 2, 2); lua_rawgeti(L, 2, 3); evas_object_size_hint_aspect_set(obj->eo, - luaL_checkint(L, -3), - luaL_checkint(L, -2), - luaL_checkint(L, -1)); + luaL_checkint(L, -3), + luaL_checkint(L, -2), + luaL_checkint(L, -1)); return 0; } @@ -1783,8 +1786,8 @@ _edje_lua_object_set_size_hint_align(lua_State *L) lua_rawgeti(L, 2, 1); lua_rawgeti(L, 2, 2); evas_object_size_hint_align_set(obj->eo, - luaL_checknumber(L, -2), - luaL_checknumber(L, -1)); + luaL_checknumber(L, -2), + luaL_checknumber(L, -1)); return 0; } @@ -1796,8 +1799,8 @@ _edje_lua_object_set_size_hint_weight(lua_State *L) lua_rawgeti(L, 2, 1); lua_rawgeti(L, 2, 2); evas_object_size_hint_weight_set(obj->eo, - luaL_checknumber(L, -2), - luaL_checknumber(L, -1)); + luaL_checknumber(L, -2), + luaL_checknumber(L, -1)); return 0; } @@ -1811,10 +1814,10 @@ _edje_lua_object_set_size_hint_padding(lua_State *L) lua_rawgeti(L, 2, 3); lua_rawgeti(L, 2, 4); evas_object_size_hint_padding_set(obj->eo, - luaL_checknumber(L, -4), - luaL_checknumber(L, -3), - luaL_checknumber(L, -2), - luaL_checknumber(L, -1)); + luaL_checknumber(L, -4), + luaL_checknumber(L, -3), + luaL_checknumber(L, -2), + luaL_checknumber(L, -1)); return 0; } @@ -1852,10 +1855,10 @@ _edje_lua_object_set_color(lua_State *L) lua_rawgeti(L, 2, 3); lua_rawgeti(L, 2, 4); evas_object_color_set(obj->eo, - luaL_checkint(L, -4), - luaL_checkint(L, -3), - luaL_checkint(L, -2), - luaL_checkint(L, -1)); + luaL_checkint(L, -4), + luaL_checkint(L, -3), + luaL_checkint(L, -2), + luaL_checkint(L, -1)); return 0; } @@ -1924,23 +1927,23 @@ _edje_lua_object_set_precise_is_inside(lua_State *L) return 0; } -#define OBJECT_CB_MACRO(KEY) \ - lua_State *L = data; \ - _edje_lua_get_reg(L, obj); \ - lua_getfield(L, -1, KEY); \ - if (lua_type(L, -1) != LUA_TFUNCTION) \ - { \ - lua_pop(L, 2); \ - return; \ - } \ - lua_insert(L, -2); +#define OBJECT_CB_MACRO(KEY) \ + lua_State * L = data; \ + _edje_lua_get_reg(L, obj); \ + lua_getfield(L, -1, KEY); \ + if (lua_type(L, -1) != LUA_TFUNCTION) \ + { \ + lua_pop(L, 2); \ + return; \ + } \ + lua_insert(L, -2); static void -_edje_lua_object_cb_mouse_in(void *data, EINA_UNUSED Evas * e, Evas_Object * obj, - void *event_info) +_edje_lua_object_cb_mouse_in(void *data, EINA_UNUSED Evas *e, Evas_Object *obj, + void *event_info) { OBJECT_CB_MACRO("mouse_in"); - Evas_Event_Mouse_In * ev = event_info; + Evas_Event_Mouse_In *ev = event_info; int err_code; lua_pushnumber(L, ev->output.x); @@ -1953,11 +1956,11 @@ _edje_lua_object_cb_mouse_in(void *data, EINA_UNUSED Evas * e, Evas_Object * obj } static void -_edje_lua_object_cb_mouse_out(void *data, EINA_UNUSED Evas * e, Evas_Object * obj, - void *event_info) +_edje_lua_object_cb_mouse_out(void *data, EINA_UNUSED Evas *e, Evas_Object *obj, + void *event_info) { OBJECT_CB_MACRO("mouse_out"); - Evas_Event_Mouse_In * ev = event_info; + Evas_Event_Mouse_In *ev = event_info; int err_code; lua_pushnumber(L, ev->output.x); @@ -1970,11 +1973,11 @@ _edje_lua_object_cb_mouse_out(void *data, EINA_UNUSED Evas * e, Evas_Object * ob } static void -_edje_lua_object_cb_mouse_down(void *data, EINA_UNUSED Evas * e, Evas_Object * obj, - void *event_info) +_edje_lua_object_cb_mouse_down(void *data, EINA_UNUSED Evas *e, Evas_Object *obj, + void *event_info) { OBJECT_CB_MACRO("mouse_down"); - Evas_Event_Mouse_Down * ev = event_info; + Evas_Event_Mouse_Down *ev = event_info; int err_code; lua_pushnumber(L, ev->button); @@ -1988,11 +1991,11 @@ _edje_lua_object_cb_mouse_down(void *data, EINA_UNUSED Evas * e, Evas_Object * o } static void -_edje_lua_object_cb_mouse_up(void *data, EINA_UNUSED Evas * e, Evas_Object * obj, - void *event_info) +_edje_lua_object_cb_mouse_up(void *data, EINA_UNUSED Evas *e, Evas_Object *obj, + void *event_info) { OBJECT_CB_MACRO("mouse_up"); - Evas_Event_Mouse_Up * ev = event_info; + Evas_Event_Mouse_Up *ev = event_info; int err_code; lua_pushnumber(L, ev->button); @@ -2006,11 +2009,11 @@ _edje_lua_object_cb_mouse_up(void *data, EINA_UNUSED Evas * e, Evas_Object * obj } static void -_edje_lua_object_cb_mouse_move(void *data, EINA_UNUSED Evas * e, Evas_Object * obj, - void *event_info) +_edje_lua_object_cb_mouse_move(void *data, EINA_UNUSED Evas *e, Evas_Object *obj, + void *event_info) { OBJECT_CB_MACRO("mouse_move"); - Evas_Event_Mouse_Move * ev = event_info; + Evas_Event_Mouse_Move *ev = event_info; int err_code; lua_pushnumber(L, ev->buttons); @@ -2024,11 +2027,11 @@ _edje_lua_object_cb_mouse_move(void *data, EINA_UNUSED Evas * e, Evas_Object * o } static void -_edje_lua_object_cb_mouse_wheel(void *data, EINA_UNUSED Evas * e, Evas_Object * obj, - void *event_info) +_edje_lua_object_cb_mouse_wheel(void *data, EINA_UNUSED Evas *e, Evas_Object *obj, + void *event_info) { OBJECT_CB_MACRO("mouse_wheel"); - Evas_Event_Mouse_Wheel * ev = event_info; + Evas_Event_Mouse_Wheel *ev = event_info; int err_code; lua_pushnumber(L, ev->z); @@ -2048,23 +2051,23 @@ _edje_lua_object_set_mouse_events(lua_State *L) obj->mouse_events = lua_toboolean(L, 2); if (obj->mouse_events) { - // add all mouse events - evas_object_event_callback_add(obj->eo, EVAS_CALLBACK_MOUSE_IN, _edje_lua_object_cb_mouse_in, L); - evas_object_event_callback_add(obj->eo, EVAS_CALLBACK_MOUSE_OUT, _edje_lua_object_cb_mouse_out, L); - evas_object_event_callback_add(obj->eo, EVAS_CALLBACK_MOUSE_DOWN, _edje_lua_object_cb_mouse_down, L); - evas_object_event_callback_add(obj->eo, EVAS_CALLBACK_MOUSE_UP, _edje_lua_object_cb_mouse_up, L); - evas_object_event_callback_add(obj->eo, EVAS_CALLBACK_MOUSE_MOVE, _edje_lua_object_cb_mouse_move, L); - evas_object_event_callback_add(obj->eo, EVAS_CALLBACK_MOUSE_WHEEL, _edje_lua_object_cb_mouse_wheel, L); + // add all mouse events + evas_object_event_callback_add(obj->eo, EVAS_CALLBACK_MOUSE_IN, _edje_lua_object_cb_mouse_in, L); + evas_object_event_callback_add(obj->eo, EVAS_CALLBACK_MOUSE_OUT, _edje_lua_object_cb_mouse_out, L); + evas_object_event_callback_add(obj->eo, EVAS_CALLBACK_MOUSE_DOWN, _edje_lua_object_cb_mouse_down, L); + evas_object_event_callback_add(obj->eo, EVAS_CALLBACK_MOUSE_UP, _edje_lua_object_cb_mouse_up, L); + evas_object_event_callback_add(obj->eo, EVAS_CALLBACK_MOUSE_MOVE, _edje_lua_object_cb_mouse_move, L); + evas_object_event_callback_add(obj->eo, EVAS_CALLBACK_MOUSE_WHEEL, _edje_lua_object_cb_mouse_wheel, L); } else { - // delete all mouse events - evas_object_event_callback_del(obj->eo, EVAS_CALLBACK_MOUSE_IN, _edje_lua_object_cb_mouse_in); - evas_object_event_callback_del(obj->eo, EVAS_CALLBACK_MOUSE_OUT, _edje_lua_object_cb_mouse_out); - evas_object_event_callback_del(obj->eo, EVAS_CALLBACK_MOUSE_DOWN, _edje_lua_object_cb_mouse_down); - evas_object_event_callback_del(obj->eo, EVAS_CALLBACK_MOUSE_UP, _edje_lua_object_cb_mouse_up); - evas_object_event_callback_del(obj->eo, EVAS_CALLBACK_MOUSE_MOVE, _edje_lua_object_cb_mouse_move); - evas_object_event_callback_del(obj->eo, EVAS_CALLBACK_MOUSE_WHEEL, _edje_lua_object_cb_mouse_wheel); + // delete all mouse events + evas_object_event_callback_del(obj->eo, EVAS_CALLBACK_MOUSE_IN, _edje_lua_object_cb_mouse_in); + evas_object_event_callback_del(obj->eo, EVAS_CALLBACK_MOUSE_OUT, _edje_lua_object_cb_mouse_out); + evas_object_event_callback_del(obj->eo, EVAS_CALLBACK_MOUSE_DOWN, _edje_lua_object_cb_mouse_down); + evas_object_event_callback_del(obj->eo, EVAS_CALLBACK_MOUSE_UP, _edje_lua_object_cb_mouse_up); + evas_object_event_callback_del(obj->eo, EVAS_CALLBACK_MOUSE_MOVE, _edje_lua_object_cb_mouse_move); + evas_object_event_callback_del(obj->eo, EVAS_CALLBACK_MOUSE_WHEEL, _edje_lua_object_cb_mouse_wheel); } return 0; } @@ -2092,13 +2095,13 @@ const luaL_Reg lObject_set[] = { {"pointer_mode", _edje_lua_object_get_pointer_mode}, {"precise_is_inside", _edje_lua_object_get_precise_is_inside}, {"mouse_events", _edje_lua_object_set_mouse_events}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; const Edje_Lua_Reg *cRectangle[] = { &mClass, &mObject, - NULL // sentinel + NULL // sentinel }; const luaL_Reg lImage_get[]; @@ -2116,7 +2119,7 @@ const Edje_Lua_Reg *cImage[] = { &mClass, &mObject, &mImage, - NULL // sentinel + NULL // sentinel }; static int @@ -2131,11 +2134,11 @@ _edje_lua_image_get_size(lua_State *L) lua_pushnumber(L, h); lua_rawseti(L, -2, 2); return 1; -}; +} const luaL_Reg lImage_get[] = { {"size", _edje_lua_image_get_size}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; static int @@ -2159,9 +2162,9 @@ _edje_lua_image_set_fill(lua_State *L) lua_rawgeti(L, 2, 3); lua_rawgeti(L, 2, 4); evas_object_image_fill_set(obj->eo, - luaL_checkint(L, -4), - luaL_checkint(L, -3), - luaL_checkint(L, -2), luaL_checkint(L, -1)); + luaL_checkint(L, -4), + luaL_checkint(L, -3), + luaL_checkint(L, -2), luaL_checkint(L, -1)); return 0; } @@ -2187,7 +2190,7 @@ const luaL_Reg lImage_set[] = { {"fill", _edje_lua_image_set_fill}, {"fill_transform", _edje_lua_image_set_fill_transform}, {"alpha", _edje_lua_image_set_alpha}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; const luaL_Reg lLine_get[]; @@ -2204,7 +2207,7 @@ const Edje_Lua_Reg *cLine[] = { &mClass, &mObject, &mLine, - NULL // sentinel + NULL // sentinel }; static int @@ -2223,7 +2226,7 @@ _edje_lua_line_get_xy(lua_State *L) const luaL_Reg lLine_get[] = { {"xy", _edje_lua_line_get_xy}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; static int @@ -2245,7 +2248,7 @@ _edje_lua_line_set_xy(lua_State *L) const luaL_Reg lLine_set[] = { {"xy", _edje_lua_line_set_xy}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; const luaL_Reg lPolygon_fn[]; @@ -2261,7 +2264,7 @@ const Edje_Lua_Reg *cPolygon[] = { &mClass, &mObject, &mPolygon, - NULL // sentinel + NULL // sentinel }; static int @@ -2269,8 +2272,8 @@ _edje_lua_polygon_fn_point_add(lua_State *L) { Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mPolygon); evas_object_polygon_point_add(obj->eo, - luaL_checknumber(L, 2), - luaL_checknumber(L, 3)); + luaL_checknumber(L, 2), + luaL_checknumber(L, 3)); return 0; } @@ -2285,7 +2288,7 @@ _edje_lua_polygon_fn_points_clear(lua_State *L) const luaL_Reg lPolygon_fn[] = { {"point_add", _edje_lua_polygon_fn_point_add}, {"points_clear", _edje_lua_polygon_fn_points_clear}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; const luaL_Reg lTable_get[]; @@ -2305,7 +2308,7 @@ const Edje_Lua_Reg *cTable[] = { &mClass, &mObject, &mTable, - NULL // sentinel + NULL // sentinel }; static int @@ -2362,16 +2365,16 @@ static int _edje_lua_table_get_children(lua_State *L) { Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mTable); - Eina_List *children = (Eina_List *) evas_object_table_children_get(obj->eo); + Eina_List *children = (Eina_List *)evas_object_table_children_get(obj->eo); Eina_List *l; Evas_Object *child; int i = 1; lua_createtable(L, eina_list_count(children), 0); EINA_LIST_FOREACH(children, l, child) { - _edje_lua_get_reg(L, child); - // TODO create object if it does not already exist? - lua_rawseti(L, -2, i++); + _edje_lua_get_reg(L, child); + // TODO create object if it does not already exist? + lua_rawseti(L, -2, i++); } return 1; } @@ -2382,7 +2385,7 @@ const luaL_Reg lTable_get[] = { {"align", _edje_lua_table_get_align}, {"col_row_size", _edje_lua_table_get_col_row_size}, {"children", _edje_lua_table_get_children}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; static int @@ -2390,7 +2393,7 @@ _edje_lua_table_set_homogeneous(lua_State *L) { Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mTable); evas_object_table_homogeneous_set(obj->eo, - luaL_checkint(L, 2)); + luaL_checkint(L, 2)); return 0; } @@ -2402,8 +2405,8 @@ _edje_lua_table_set_padding(lua_State *L) lua_rawgeti(L, 2, 1); lua_rawgeti(L, 2, 2); evas_object_table_padding_set(obj->eo, - luaL_checkint(L, -2), - luaL_checkint(L, -1)); + luaL_checkint(L, -2), + luaL_checkint(L, -1)); return 0; } @@ -2415,8 +2418,8 @@ _edje_lua_table_set_align(lua_State *L) lua_rawgeti(L, 2, 1); lua_rawgeti(L, 2, 2); evas_object_table_align_set(obj->eo, - luaL_checknumber(L, -2), - luaL_checknumber(L, -1)); + luaL_checknumber(L, -2), + luaL_checknumber(L, -1)); return 0; } @@ -2424,7 +2427,7 @@ const luaL_Reg lTable_set[] = { {"homogeneous", _edje_lua_table_set_homogeneous}, {"padding", _edje_lua_table_set_padding}, {"align", _edje_lua_table_set_align}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; static int @@ -2433,11 +2436,11 @@ _edje_lua_table_fn_pack(lua_State *L) Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mTable); Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject); lua_pushboolean(L, - evas_object_table_pack(obj->eo, tar->eo, - luaL_checkint(L, 3), - luaL_checkint(L, 4), - luaL_checkint(L, 5), - luaL_checkint(L, 6))); + evas_object_table_pack(obj->eo, tar->eo, + luaL_checkint(L, 3), + luaL_checkint(L, 4), + luaL_checkint(L, 5), + luaL_checkint(L, 6))); return 1; } @@ -2447,7 +2450,7 @@ _edje_lua_table_fn_unpack(lua_State *L) Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mTable); Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject); lua_pushboolean(L, - evas_object_table_unpack(obj->eo, tar->eo)); + evas_object_table_unpack(obj->eo, tar->eo)); return 1; } @@ -2463,7 +2466,7 @@ const luaL_Reg lTable_fn[] = { {"pack", _edje_lua_table_fn_pack}, {"unpack", _edje_lua_table_fn_unpack}, {"clear", _edje_lua_table_fn_clear}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; const luaL_Reg lDescription_get[]; @@ -2481,14 +2484,14 @@ const Edje_Lua_Reg *cDescription[] = { &mClass, &mObject, &mDescription, - NULL // sentinel + NULL // sentinel }; static int _edje_lua_description_get_alignment(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_createtable(L, 2, 0); lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->align.x)); @@ -2502,7 +2505,7 @@ static int _edje_lua_description_get_min(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_createtable(L, 2, 0); lua_pushnumber(L, obj->rp->custom->description->min.w); @@ -2516,7 +2519,7 @@ static int _edje_lua_description_get_max(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_createtable(L, 2, 0); lua_pushnumber(L, obj->rp->custom->description->max.w); @@ -2530,7 +2533,7 @@ static int _edje_lua_description_get_step(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_createtable(L, 2, 0); lua_pushnumber(L, obj->rp->custom->description->step.x); @@ -2544,7 +2547,7 @@ static int _edje_lua_description_get_aspect(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_createtable(L, 2, 0); lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->aspect.min)); @@ -2558,7 +2561,7 @@ static int _edje_lua_description_get_aspect_pref(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_pushnumber(L, obj->rp->custom->description->aspect.prefer); return 1; @@ -2568,7 +2571,7 @@ static int _edje_lua_description_get_color(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); /* check whether this part has a "custom" state */ if (!obj->rp->custom) return 0; lua_createtable(L, 4, 0); @@ -2587,7 +2590,7 @@ static int _edje_lua_description_get_color2(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_createtable(L, 4, 0); lua_pushnumber(L, obj->rp->custom->description->color2.r); @@ -2605,7 +2608,7 @@ static int _edje_lua_description_get_color3(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_createtable(L, 4, 0); lua_pushnumber(L, obj->rp->custom->description->color3.r); @@ -2623,7 +2626,7 @@ static int _edje_lua_description_get_color_class(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_pushstring(L, obj->rp->custom->description->color_class); return 1; @@ -2633,7 +2636,7 @@ static int _edje_lua_description_get_rel1(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_createtable(L, 2, 0); lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->rel1.relative_x)); @@ -2647,7 +2650,7 @@ static int _edje_lua_description_get_rel1_to(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_createtable(L, 2, 0); lua_pushnumber(L, obj->rp->custom->description->rel1.id_x); @@ -2661,7 +2664,7 @@ static int _edje_lua_description_get_rel1_offset(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_createtable(L, 2, 0); lua_pushnumber(L, obj->rp->custom->description->rel1.offset_x); @@ -2675,7 +2678,7 @@ static int _edje_lua_description_get_rel2(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_createtable(L, 2, 0); lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->rel2.relative_x)); @@ -2689,7 +2692,7 @@ static int _edje_lua_description_get_rel2_to(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_createtable(L, 2, 0); lua_pushnumber(L, obj->rp->custom->description->rel2.id_x); @@ -2703,7 +2706,7 @@ static int _edje_lua_description_get_rel2_offset(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_createtable(L, 2, 0); lua_pushnumber(L, obj->rp->custom->description->rel2.offset_x); @@ -2717,10 +2720,10 @@ static int _edje_lua_description_get_image(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE)) - return 0; + return 0; // TODO return 0; } @@ -2729,9 +2732,9 @@ static int _edje_lua_description_get_border(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE)) - return 0; + return 0; if (!obj->rp->custom) return 0; lua_createtable(L, 4, 0); lua_pushnumber(L, obj->rp->custom->description->border.l); @@ -2749,9 +2752,9 @@ static int _edje_lua_description_get_fill_smooth(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE)) - return 0; + return 0; if (!obj->rp->custom) return 0; lua_pushboolean(L, obj->rp->custom->description->fill.smooth); return 1; @@ -2761,9 +2764,9 @@ static int _edje_lua_description_get_fill_pos(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE)) - return 0; + return 0; if (!obj->rp->custom) return 0; lua_createtable(L, 4, 0); lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->fill.pos_rel_x)); @@ -2781,9 +2784,9 @@ static int _edje_lua_description_get_fill_size(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE)) - return 0; + return 0; if (!obj->rp->custom) return 0; lua_createtable(L, 4, 0); lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->fill.rel_x)); @@ -2801,10 +2804,10 @@ static int _edje_lua_description_get_text(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT) && (obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; + return 0; if (!obj->rp->custom) return 0; lua_pushstring(L, obj->rp->custom->description->text.text); return 1; @@ -2814,10 +2817,10 @@ static int _edje_lua_description_get_text_class(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT) && (obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; + return 0; if (!obj->rp->custom) return 0; lua_pushstring(L, obj->rp->custom->description->text.text_class); return 1; @@ -2827,9 +2830,9 @@ static int _edje_lua_description_get_text_font(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT)) - return 0; + return 0; if (!obj->rp->custom) return 0; lua_pushstring(L, obj->rp->custom->description->text.text_class); return 1; @@ -2839,9 +2842,9 @@ static int _edje_lua_description_get_text_style(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; + return 0; if (!obj->rp->custom) return 0; lua_pushstring(L, obj->rp->custom->description->text.style); return 1; @@ -2851,9 +2854,9 @@ static int _edje_lua_description_get_text_size(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT)) - return 0; + return 0; if (!obj->rp->custom) return 0; lua_pushnumber(L, obj->rp->custom->description->text.size); return 1; @@ -2863,9 +2866,9 @@ static int _edje_lua_description_get_text_fit(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT)) - return 0; + return 0; if (!obj->rp->custom) return 0; lua_createtable(L, 2, 0); lua_pushboolean(L, obj->rp->custom->description->text.fit_x); @@ -2879,10 +2882,10 @@ static int _edje_lua_description_get_text_min(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT) && (obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; + return 0; if (!obj->rp->custom) return 0; lua_createtable(L, 2, 0); lua_pushnumber(L, obj->rp->custom->description->text.min_x); @@ -2896,10 +2899,10 @@ static int _edje_lua_description_get_text_max(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT) && (obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; + return 0; if (!obj->rp->custom) return 0; lua_createtable(L, 2, 0); lua_pushnumber(L, obj->rp->custom->description->text.max_x); @@ -2913,9 +2916,9 @@ static int _edje_lua_description_get_text_align(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT)) - return 0; + return 0; if (!obj->rp->custom) return 0; lua_createtable(L, 2, 0); lua_pushnumber(L, TO_DOUBLE(obj->rp->custom->description->text.align.x)); @@ -2929,7 +2932,7 @@ static int _edje_lua_description_get_visible(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_pushboolean(L, obj->rp->custom->description->visible); return 1; @@ -2967,14 +2970,14 @@ const luaL_Reg lDescription_get[] = { {"text_max", _edje_lua_description_get_text_max}, {"text_align", _edje_lua_description_get_text_align}, {"visible", _edje_lua_description_get_visible}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; static int _edje_lua_description_set_alignment(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; luaL_checktype(L, 2, LUA_TTABLE); lua_rawgeti(L, 2, 1); @@ -2988,7 +2991,7 @@ static int _edje_lua_description_set_min(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_rawgeti(L, 2, 1); lua_rawgeti(L, 2, 2); @@ -3001,7 +3004,7 @@ static int _edje_lua_description_set_max(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_rawgeti(L, 2, 1); lua_rawgeti(L, 2, 2); @@ -3014,7 +3017,7 @@ static int _edje_lua_description_set_step(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_rawgeti(L, 2, 1); lua_rawgeti(L, 2, 2); @@ -3027,32 +3030,30 @@ static int _edje_lua_description_set_aspect(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; lua_rawgeti(L, 2, 1); lua_rawgeti(L, 2, 2); obj->rp->custom->description->aspect.min = FROM_DOUBLE(luaL_checknumber(L, -2)); obj->rp->custom->description->aspect.max = FROM_DOUBLE(luaL_checknumber(L, -1)); return 0; - } static int _edje_lua_description_set_aspect_pref(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; obj->rp->custom->description->aspect.prefer = luaL_checknumber(L, 2); return 0; - } static int _edje_lua_description_set_color(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; luaL_checktype(L, 2, LUA_TTABLE); lua_rawgeti(L, 2, 1); @@ -3070,7 +3071,7 @@ static int _edje_lua_description_set_color2(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; luaL_checktype(L, 2, LUA_TTABLE); lua_rawgeti(L, 2, 1); @@ -3088,7 +3089,7 @@ static int _edje_lua_description_set_color3(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; luaL_checktype(L, 2, LUA_TTABLE); lua_rawgeti(L, 2, 1); @@ -3106,7 +3107,7 @@ static int _edje_lua_description_set_color_class(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; obj->rp->custom->description->color_class = (char *)luaL_checkstring(L, 2); return 0; @@ -3116,7 +3117,7 @@ static int _edje_lua_description_set_rel1(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; luaL_checktype(L, 2, LUA_TTABLE); lua_rawgeti(L, 2, 1); @@ -3130,7 +3131,7 @@ static int _edje_lua_description_set_rel1_to(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; luaL_checktype(L, 2, LUA_TTABLE); lua_rawgeti(L, 2, 1); @@ -3148,7 +3149,7 @@ static int _edje_lua_description_set_rel1_offset(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; luaL_checktype(L, 2, LUA_TTABLE); lua_rawgeti(L, 2, 1); @@ -3162,7 +3163,7 @@ static int _edje_lua_description_set_rel2(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; luaL_checktype(L, 2, LUA_TTABLE); lua_rawgeti(L, 2, 1); @@ -3176,7 +3177,7 @@ static int _edje_lua_description_set_rel2_to(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; luaL_checktype(L, 2, LUA_TTABLE); lua_rawgeti(L, 2, 1); @@ -3194,7 +3195,7 @@ static int _edje_lua_description_set_rel2_offset(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; luaL_checktype(L, 2, LUA_TTABLE); lua_rawgeti(L, 2, 1); @@ -3208,12 +3209,12 @@ static int _edje_lua_description_set_image(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE)) - return 0; + return 0; obj->rp->custom->description->image.id = - edje_edit_image_id_get(obj->ed->obj, (char *)luaL_checkstring(L, 2)); + edje_edit_image_id_get(obj->ed->obj, (char *)luaL_checkstring(L, 2)); return 0; } @@ -3221,9 +3222,9 @@ static int _edje_lua_description_set_border(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE)) - return 0; + return 0; if (!obj->rp->custom) return 0; luaL_checktype(L, 2, LUA_TTABLE); lua_rawgeti(L, 2, 1); @@ -3241,9 +3242,9 @@ static int _edje_lua_description_set_fill_smooth(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE)) - return 0; + return 0; if (!obj->rp->custom) return 0; obj->rp->custom->description->fill.smooth = lua_toboolean(L, 2); return 0; @@ -3253,9 +3254,9 @@ static int _edje_lua_description_set_fill_pos(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE)) - return 0; + return 0; if (!obj->rp->custom) return 0; luaL_checktype(L, 2, LUA_TTABLE); lua_rawgeti(L, 2, 1); @@ -3273,9 +3274,9 @@ static int _edje_lua_description_set_fill_size(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_IMAGE)) - return 0; + return 0; if (!obj->rp->custom) return 0; luaL_checktype(L, 2, LUA_TTABLE); lua_rawgeti(L, 2, 1); @@ -3293,10 +3294,10 @@ static int _edje_lua_description_set_text(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT) && (obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; + return 0; if (!obj->rp->custom) return 0; obj->rp->custom->description->text.text = (char *)luaL_checkstring(L, 2); return 0; @@ -3306,13 +3307,13 @@ static int _edje_lua_description_set_text_class(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT) && (obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; + return 0; if (!obj->rp->custom) return 0; obj->rp->custom->description->text.text_class = - (char *)luaL_checkstring(L, 2); + (char *)luaL_checkstring(L, 2); return 0; } @@ -3320,9 +3321,9 @@ static int _edje_lua_description_set_text_font(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT)) - return 0; + return 0; if (!obj->rp->custom) return 0; obj->rp->custom->description->text.font = (char *)luaL_checkstring(L, 2); return 0; @@ -3332,9 +3333,9 @@ static int _edje_lua_description_set_text_style(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; + return 0; if (!obj->rp->custom) return 0; obj->rp->custom->description->text.style = (char *)luaL_checkstring(L, 2); return 0; @@ -3344,9 +3345,9 @@ static int _edje_lua_description_set_text_size(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT)) - return 0; + return 0; if (!obj->rp->custom) return 0; obj->rp->custom->description->text.size = luaL_checkint(L, 2); return 0; @@ -3356,7 +3357,7 @@ static int _edje_lua_description_set_text_fit(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; luaL_checktype(L, 2, LUA_TTABLE); lua_rawgeti(L, 2, 1); @@ -3370,10 +3371,10 @@ static int _edje_lua_description_set_text_min(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT) && (obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; + return 0; if (!obj->rp->custom) return 0; luaL_checktype(L, 2, LUA_TTABLE); lua_rawgeti(L, 2, 1); @@ -3387,10 +3388,10 @@ static int _edje_lua_description_set_text_max(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT) && (obj->rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) - return 0; + return 0; if (!obj->rp->custom) return 0; luaL_checktype(L, 2, LUA_TTABLE); lua_rawgeti(L, 2, 1); @@ -3404,9 +3405,9 @@ static int _edje_lua_description_set_text_align(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if ((obj->rp->part->type != EDJE_PART_TYPE_TEXT)) - return 0; + return 0; if (!obj->rp->custom) return 0; luaL_checktype(L, 2, LUA_TTABLE); lua_rawgeti(L, 2, 1); @@ -3420,7 +3421,7 @@ static int _edje_lua_description_set_visible(lua_State *L) { Edje_Lua_Edje_Part_Description *obj = - _edje_lua_checkudata(L, 1, &mDescription); + _edje_lua_checkudata(L, 1, &mDescription); if (!obj->rp->custom) return 0; obj->rp->custom->description->visible = lua_toboolean(L, 2); return 0; @@ -3458,7 +3459,7 @@ const luaL_Reg lDescription_set[] = { {"text_max", _edje_lua_description_set_text_max}, {"text_align", _edje_lua_description_set_text_align}, {"visible", _edje_lua_description_set_visible}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; const luaL_Reg lPart_get[]; @@ -3475,8 +3476,8 @@ const Edje_Lua_Reg mPart = { }; static void -_edje_lua_edje_part_del_cb(void *data, EINA_UNUSED Evas * e, Evas_Object * obj, - EINA_UNUSED void *event_info) +_edje_lua_edje_part_del_cb(void *data, EINA_UNUSED Evas *e, Evas_Object *obj, + EINA_UNUSED void *event_info) { //printf("_edje_lua_object_delete_cb\n"); lua_State *L = data; @@ -3491,7 +3492,7 @@ const Edje_Lua_Reg *cPart[] = { &mClass, &mObject, &mPart, - NULL // sentinel + NULL // sentinel }; static int @@ -3546,12 +3547,12 @@ _edje_lua_part_get_states_list(lua_State *L) int i = 1; for (ilist = slist; ilist; ilist = eina_list_next(ilist)) { - lua_pushstring(L, eina_list_data_get(ilist)); - lua_rawseti(L, -2, i++); + lua_pushstring(L, eina_list_data_get(ilist)); + lua_rawseti(L, -2, i++); } edje_edit_string_list_free(slist); return 1; -}; +} static int _edje_lua_part_get_state(lua_State *L) @@ -3566,7 +3567,7 @@ _edje_lua_part_get_state(lua_State *L) lua_pushnumber(L, val); lua_rawseti(L, -2, 2); return 1; -}; +} static int _edje_lua_part_get_text(lua_State *L) @@ -3574,16 +3575,16 @@ _edje_lua_part_get_text(lua_State *L) Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart); lua_pushstring(L, edje_object_part_text_get(obj->ed->obj, obj->key)); return 1; -}; +} static int _edje_lua_part_get_text_selection(lua_State *L) { Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart); lua_pushstring(L, - edje_object_part_text_selection_get(obj->ed->obj, obj->key)); + edje_object_part_text_selection_get(obj->ed->obj, obj->key)); return 1; -}; +} static int _edje_lua_part_get_drag_dir(lua_State *L) @@ -3655,7 +3656,7 @@ _edje_lua_part_get_text_cursor_geometry(lua_State *L) Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart); Evas_Coord x, y, w, h; edje_object_part_text_cursor_geometry_get(obj->ed->obj, obj->key, - &x, &y, &w, &h); + &x, &y, &w, &h); lua_createtable(L, 4, 0); lua_pushnumber(L, x); lua_rawseti(L, -2, 1); @@ -3723,7 +3724,7 @@ const luaL_Reg lPart_get[] = { {"geometry", _edje_lua_part_get_geometry}, {"part_col_row_size", _edje_lua_part_get_table_col_row_size}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; static int @@ -3747,7 +3748,7 @@ _edje_lua_part_set_repeat_events(lua_State *L) { Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart); edje_edit_part_repeat_events_set(obj->ed->obj, obj->key, - lua_toboolean(L, 2)); + lua_toboolean(L, 2)); return 0; } @@ -3759,8 +3760,8 @@ _edje_lua_part_set_state(lua_State *L) lua_rawgeti(L, 2, 1); lua_rawgeti(L, 2, 2); _edje_part_description_apply(obj->ed, obj->rp, - luaL_checkstring(L, -2), luaL_checknumber(L, -1), - NULL, 0.0); + luaL_checkstring(L, -2), luaL_checknumber(L, -1), + NULL, 0.0); _edje_part_pos_set(obj->ed, obj->rp, EDJE_TWEEN_MODE_LINEAR, ZERO, ZERO, ZERO, ZERO, ZERO); _edje_recalc(obj->ed); @@ -3778,10 +3779,10 @@ _edje_lua_part_set_tween_state(lua_State *L) lua_rawgeti(L, 2, 4); lua_rawgeti(L, 2, 5); _edje_part_description_apply(obj->ed, obj->rp, - luaL_checkstring(L, -4), luaL_checknumber(L, -3), - luaL_checkstring(L, -2), luaL_checknumber(L, -1)); + luaL_checkstring(L, -4), luaL_checknumber(L, -3), + luaL_checkstring(L, -2), luaL_checknumber(L, -1)); _edje_part_pos_set(obj->ed, obj->rp, EDJE_TWEEN_MODE_LINEAR, - FROM_DOUBLE(luaL_checknumber(L, -5)), ZERO, ZERO, ZERO, ZERO); + FROM_DOUBLE(luaL_checknumber(L, -5)), ZERO, ZERO, ZERO, ZERO); _edje_recalc(obj->ed); return 0; } @@ -3801,8 +3802,8 @@ _edje_lua_part_set_drag_value(lua_State *L) lua_rawgeti(L, 2, 1); lua_rawgeti(L, 2, 2); edje_object_part_drag_value_set(obj->ed->obj, obj->key, - luaL_checknumber(L, -2), - luaL_checknumber(L, -1)); + luaL_checknumber(L, -2), + luaL_checknumber(L, -1)); return 0; } @@ -3813,8 +3814,8 @@ _edje_lua_part_set_drag_size(lua_State *L) lua_rawgeti(L, 2, 1); lua_rawgeti(L, 2, 2); edje_object_part_drag_size_set(obj->ed->obj, obj->key, - luaL_checknumber(L, -2), - luaL_checknumber(L, -1)); + luaL_checknumber(L, -2), + luaL_checknumber(L, -1)); return 0; } @@ -3825,8 +3826,8 @@ _edje_lua_part_set_drag_step(lua_State *L) lua_rawgeti(L, 2, 1); lua_rawgeti(L, 2, 2); edje_object_part_drag_step_set(obj->ed->obj, obj->key, - luaL_checknumber(L, -2), - luaL_checknumber(L, -1)); + luaL_checknumber(L, -2), + luaL_checknumber(L, -1)); return 0; } @@ -3837,8 +3838,8 @@ _edje_lua_part_set_drag_page(lua_State *L) lua_rawgeti(L, 2, 1); lua_rawgeti(L, 2, 2); edje_object_part_drag_page_set(obj->ed->obj, obj->key, - luaL_checknumber(L, -2), - luaL_checknumber(L, -1)); + luaL_checknumber(L, -2), + luaL_checknumber(L, -1)); return 0; } @@ -3854,7 +3855,7 @@ const luaL_Reg lPart_set[] = { {"state", _edje_lua_part_set_state}, {"tween_state", _edje_lua_part_set_tween_state}, {"text", _edje_lua_part_set_text}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; static int @@ -3910,29 +3911,29 @@ _edje_lua_part_fn_custom_state(lua_State *L) /* check whether this part already has a "custom" state */ if (obj->rp->custom) { - _edje_lua_get_reg(L, obj->rp->custom->description); - return 1; + _edje_lua_get_reg(L, obj->rp->custom->description); + return 1; } - name = (char *)luaL_checkstring(L, 2); // state name - val = luaL_checknumber(L, 3); // state val + name = (char *)luaL_checkstring(L, 2); // state name + val = luaL_checknumber(L, 3); // state val if (!(parent = _edje_part_description_find(obj->ed, obj->rp, name, val, EINA_TRUE))) { - lua_pushnil(L); - return 1; + lua_pushnil(L); + return 1; } /* now create the custom state */ Edje_Lua_Edje_Part_Description *tar = - lua_newuserdata(L, sizeof(Edje_Lua_Edje_Part_Description)); + lua_newuserdata(L, sizeof(Edje_Lua_Edje_Part_Description)); tar->rp = obj->rp; _edje_lua_set_class(L, -1, cDescription); _edje_lua_new_reg(L, -1, tar); // freed in edje_load.c::_edje_file_del if (!(tar->pd = calloc(1, sizeof(Edje_Part_Description)))) { - lua_pushnil(L); - return 1; + lua_pushnil(L); + return 1; } - + obj->rp->custom = eina_mempool_malloc(_edje_real_part_state_mp, sizeof (Edje_Real_Part_State)); if (!obj->rp->custom) { @@ -3941,24 +3942,24 @@ _edje_lua_part_fn_custom_state(lua_State *L) lua_pushnil(L); return 1; } - + *(tar->pd) = *parent; tar->pd->state.name = (char *)eina_stringshare_add("custom"); tar->pd->state.value = 0.0; - /* + /* * make sure all the allocated memory is getting copied, * not just referenced */ tar->pd->image.tween_list = NULL; EINA_LIST_FOREACH(parent->image.tween_list, l, iid) - { - Edje_Part_Image_Id *iid_new; - iid_new = calloc(1, sizeof(Edje_Part_Image_Id)); - iid_new->id = iid->id; + { + Edje_Part_Image_Id *iid_new; + iid_new = calloc(1, sizeof(Edje_Part_Image_Id)); + iid_new->id = iid->id; - tar->pd->image.tween_list = - eina_list_append(tar->pd->image.tween_list, iid_new); - } + tar->pd->image.tween_list = + eina_list_append(tar->pd->image.tween_list, iid_new); + } #define DUP(x) x ? (char *)eina_stringshare_add(x) : NULL tar->pd->color_class = DUP(tar->pd->color_class); tar->pd->text.text = DUP(tar->pd->text.text); @@ -3977,11 +3978,11 @@ _edje_lua_part_fn_table_pack(lua_State *L) Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart); Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject); lua_pushboolean(L, - edje_object_part_table_pack(obj->ed->obj, obj->key, tar->eo, - luaL_checkint(L, 3), - luaL_checkint(L, 4), - luaL_checkint(L, 5), - luaL_checkint(L, 6))); + edje_object_part_table_pack(obj->ed->obj, obj->key, tar->eo, + luaL_checkint(L, 3), + luaL_checkint(L, 4), + luaL_checkint(L, 5), + luaL_checkint(L, 6))); return 1; } @@ -3991,7 +3992,7 @@ _edje_lua_part_fn_table_unpack(lua_State *L) Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart); Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject); lua_pushboolean(L, - edje_object_part_table_unpack(obj->ed->obj, obj->key, tar->eo)); + edje_object_part_table_unpack(obj->ed->obj, obj->key, tar->eo)); return 1; } @@ -4000,7 +4001,7 @@ _edje_lua_part_fn_table_clear(lua_State *L) { Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart); lua_pushboolean(L, - edje_object_part_table_clear(obj->ed->obj, obj->key, lua_toboolean(L, 2))); + edje_object_part_table_clear(obj->ed->obj, obj->key, lua_toboolean(L, 2))); return 1; } @@ -4010,7 +4011,7 @@ _edje_lua_part_fn_box_append(lua_State *L) Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart); Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject); lua_pushboolean(L, - edje_object_part_box_append(obj->ed->obj, obj->key, tar->eo)); + edje_object_part_box_append(obj->ed->obj, obj->key, tar->eo)); return 1; } @@ -4020,7 +4021,7 @@ _edje_lua_part_fn_box_prepend(lua_State *L) Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart); Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject); lua_pushboolean(L, - edje_object_part_box_prepend(obj->ed->obj, obj->key, tar->eo)); + edje_object_part_box_prepend(obj->ed->obj, obj->key, tar->eo)); return 1; } @@ -4031,7 +4032,7 @@ _edje_lua_part_fn_box_insert_before(lua_State *L) Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject); Edje_Lua_Evas_Object *ref = _edje_lua_checkudata(L, 3, &mObject); lua_pushboolean(L, - edje_object_part_box_insert_before(obj->ed->obj, obj->key, tar->eo, ref->eo)); + edje_object_part_box_insert_before(obj->ed->obj, obj->key, tar->eo, ref->eo)); return 1; } @@ -4041,7 +4042,7 @@ _edje_lua_part_fn_box_insert_at(lua_State *L) Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart); Edje_Lua_Evas_Object *tar = _edje_lua_checkudata(L, 2, &mObject); lua_pushboolean(L, - edje_object_part_box_insert_at(obj->ed->obj, obj->key, tar->eo, luaL_checkint(L, 3))); + edje_object_part_box_insert_at(obj->ed->obj, obj->key, tar->eo, luaL_checkint(L, 3))); return 1; } @@ -4068,7 +4069,7 @@ _edje_lua_part_fn_box_remove_all(lua_State *L) { Edje_Lua_Edje_Part_Object *obj = _edje_lua_checkudata(L, 1, &mPart); lua_pushboolean(L, - edje_object_part_box_remove_all(obj->ed->obj, obj->key, lua_toboolean(L, 2))); + edje_object_part_box_remove_all(obj->ed->obj, obj->key, lua_toboolean(L, 2))); return 1; } @@ -4093,7 +4094,7 @@ const luaL_Reg lPart_fn[] = { {"box_remove", _edje_lua_part_fn_box_remove}, {"box_remove_at", _edje_lua_part_fn_box_remove_at}, {"box_remove_all", _edje_lua_part_fn_box_remove_all}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; const luaL_Reg lGroup_mt[]; @@ -4115,7 +4116,7 @@ const Edje_Lua_Reg *cGroup[] = { &mClass, &mObject, &mGroup, - NULL // sentinel + NULL // sentinel }; static int @@ -4125,53 +4126,53 @@ _edje_lua_group_mt_index(lua_State *L) lua_getmetatable(L, 1); if (!_edje_lua_look_fn(L)) { - // look in lGroup_fn - if (!_edje_lua_look_get(L)) - { - // look in lGroup_get - const char *key = luaL_checkstring(L, 2); - Edje *ed = _edje_fetch(obj->eo); - Edje_Real_Part *rp = _edje_real_part_recursive_get(ed, key); - if (rp) - { - // check if lua userdata exists - Evas_Object *part = (Evas_Object *) edje_object_part_object_get(obj->eo, key); - _edje_lua_get_reg(L, part); - if (lua_isnil(L, -1)) - { - // create it - lua_pop(L, 1); - Edje_Lua_Edje_Part_Object *tar = - lua_newuserdata(L, sizeof(Edje_Lua_Edje_Part_Object)); - tar->eo = part; - tar->ed = ed; - tar->key = key; - tar->L = L; - tar->rp = rp; - _edje_lua_set_class(L, -1, cPart); - _edje_lua_new_reg(L, -1, tar); // freed in _edje_lua_edje_part_del_cb - _edje_lua_new_reg(L, -1, part); // freed in _edje_lua_edje_part_del_cb - evas_object_event_callback_add(tar->eo, - EVAS_CALLBACK_DEL, - _edje_lua_edje_part_del_cb, - L); - } - } - else - { - // look in obj environment table - lua_getfenv(L, 1); - lua_pushvalue(L, 2); // key - lua_rawget(L, -2); - } - } + // look in lGroup_fn + if (!_edje_lua_look_get(L)) + { + // look in lGroup_get + const char *key = luaL_checkstring(L, 2); + Edje *ed = _edje_fetch(obj->eo); + Edje_Real_Part *rp = _edje_real_part_recursive_get(ed, key); + if (rp) + { + // check if lua userdata exists + Evas_Object *part = (Evas_Object *)edje_object_part_object_get(obj->eo, key); + _edje_lua_get_reg(L, part); + if (lua_isnil(L, -1)) + { + // create it + lua_pop(L, 1); + Edje_Lua_Edje_Part_Object *tar = + lua_newuserdata(L, sizeof(Edje_Lua_Edje_Part_Object)); + tar->eo = part; + tar->ed = ed; + tar->key = key; + tar->L = L; + tar->rp = rp; + _edje_lua_set_class(L, -1, cPart); + _edje_lua_new_reg(L, -1, tar); // freed in _edje_lua_edje_part_del_cb + _edje_lua_new_reg(L, -1, part); // freed in _edje_lua_edje_part_del_cb + evas_object_event_callback_add(tar->eo, + EVAS_CALLBACK_DEL, + _edje_lua_edje_part_del_cb, + L); + } + } + else + { + // look in obj environment table + lua_getfenv(L, 1); + lua_pushvalue(L, 2); // key + lua_rawget(L, -2); + } + } } return 1; } const luaL_Reg lGroup_mt[] = { {"__index", _edje_lua_group_mt_index}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; static int @@ -4295,7 +4296,7 @@ const luaL_Reg lGroup_get[] = { {"play", _edje_lua_group_get_play}, {"animation", _edje_lua_group_get_animation}, {"frametime", _edje_lua_group_get_frametime}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; static int @@ -4360,7 +4361,7 @@ _edje_lua_group_set_animation(lua_State *L) } static void -_edje_lua_group_text_change_cb(void* data, Evas_Object *obj, const char* part) +_edje_lua_group_text_change_cb(void *data, Evas_Object *obj, const char *part) { Edje_Lua_Ref *ref = data; lua_State *L = ref->L; @@ -4388,6 +4389,7 @@ _edje_lua_group_set_frametime(lua_State *L) edje_frametime_set(luaL_checknumber(L, 2)); return 0; } + const luaL_Reg lGroup_set[] = { {"group", _edje_lua_group_set_group}, {"size_min", _edje_lua_group_set_size_min}, @@ -4397,47 +4399,47 @@ const luaL_Reg lGroup_set[] = { {"animation", _edje_lua_group_set_animation}, {"text_change_cb", _edje_lua_group_set_text_change_cb}, {"frametime", _edje_lua_group_set_frametime}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; static int _edje_lua_group_fn_timer(lua_State *L) { Edje_Lua_Timer *tar = lua_newuserdata(L, sizeof(Edje_Lua_Timer)); - + _edje_lua_set_class(L, -1, cTimer); /* ^^^^^^^^^^^^^^^^(L, index, class) - lua_newtable(L); - if (index < 0) + lua_newtable(L); + if (index < 0) lua_setfenv(L, index - 1); - else + else lua_setfenv(L, index); - _edje_lua_get_metatable(L, class); - if (index < 0) + _edje_lua_get_metatable(L, class); + if (index < 0) lua_setmetatable(L, index - 1); - else + else lua_setmetatable(L, index); */ - + tar->et = ecore_timer_add(luaL_checknumber(L, 2), _edje_lua_timer_cb, tar); tar->L = L; - + _edje_lua_new_reg(L, -1, tar); // freed in _edje_lua_timer_cb/del - /* ^^^^^^^^^^^^^^(L, index, ptr) - lua_pushvalue(L, index); - lua_pushlightuserdata(L, ptr); - lua_insert(L, -2); - lua_rawset(L, LUA_REGISTRYINDEX); // freed in _edje_lua_free_reg + /* ^^^^^^^^^^^^^^(L, index, ptr) + lua_pushvalue(L, index); + lua_pushlightuserdata(L, ptr); + lua_insert(L, -2); + lua_rawset(L, LUA_REGISTRYINDEX); // freed in _edje_lua_free_reg */ - + tar->cb = _edje_lua_new_ref(L, 3); // freed in _edje_lua_timer_cb/del /* ^^^^^^^^^^^^^^^^^^^^^^^^(L, index) - lua_pushvalue(L, index); - Edje_Lua_Ref *ref = malloc(sizeof(Edje_Lua_Ref)); - ref->id = luaL_ref(L, LUA_REGISTRYINDEX); - ref->L = L; - return ref; + lua_pushvalue(L, index); + Edje_Lua_Ref *ref = malloc(sizeof(Edje_Lua_Ref)); + ref->id = luaL_ref(L, LUA_REGISTRYINDEX); + ref->L = L; + return ref; */ return 1; } @@ -4461,16 +4463,16 @@ _edje_lua_group_fn_poller(lua_State *L) Edje_Lua_Poller *tar; tar = lua_newuserdata(L, sizeof(Edje_Lua_Poller)); _edje_lua_set_class(L, -1, cPoller); - + interval = luaL_checknumber(L, 2); if ((interval <= 0) || ((interval & 1) != 0)) { - return 0; + return 0; } // Only 1 type of poller currently implemented in ecore tar->ep = ecore_poller_add(ECORE_POLLER_CORE, interval, - _edje_lua_poller_cb, tar); + _edje_lua_poller_cb, tar); tar->L = L; _edje_lua_new_reg(L, -1, tar); // freed in _edje_lua_poller_cb/del tar->cb = _edje_lua_new_ref(L, 3); // freed in _edje_lua_poller_cb/del @@ -4482,7 +4484,7 @@ static int _edje_lua_group_fn_transform(lua_State *L) { Edje_Lua_Transform *tar = lua_newuserdata(L, sizeof(Edje_Lua_Transform)); - evas_transform_identity_set (&(tar->et)); + evas_transform_identity_set(&(tar->et)); _edje_lua_set_class(L, -1, cTransform); tar->L = L; return 1; @@ -4493,26 +4495,26 @@ _edje_lua_group_fn_signal_emit(lua_State *L) { Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup); edje_object_signal_emit(obj->eo, - luaL_checkstring(L, 2), luaL_checkstring(L, 3)); + luaL_checkstring(L, 2), luaL_checkstring(L, 3)); return 0; } static Edje_Program * -_edje_lua_program_get_byname(Evas_Object * obj, const char *prog_name) +_edje_lua_program_get_byname(Evas_Object *obj, const char *prog_name) { Edje_Program *epr; int i; Edje *ed; ed = _edje_fetch(obj); if (!ed) - return NULL; + return NULL; if (!prog_name) - return NULL; + return NULL; for (i = 0; i < ed->table_programs_size; i++) { - epr = ed->table_programs[i]; - if ((epr->name) && (strcmp(epr->name, prog_name) == 0)) - return epr; + epr = ed->table_programs[i]; + if ((epr->name) && (strcmp(epr->name, prog_name) == 0)) + return epr; } return NULL; } @@ -4522,9 +4524,9 @@ _edje_lua_group_fn_program_run(lua_State *L) { Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup); Edje_Program *pr = - _edje_lua_program_get_byname(obj->eo, luaL_checkstring(L, 2)); + _edje_lua_program_get_byname(obj->eo, luaL_checkstring(L, 2)); if (pr) - _edje_program_run(obj->ed, pr, 0, "", ""); + _edje_program_run(obj->ed, pr, 0, "", ""); return 0; } @@ -4533,14 +4535,14 @@ _edje_lua_group_fn_program_stop(lua_State *L) { Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup); Edje_Program *pr = - _edje_lua_program_get_byname(obj->eo, luaL_checkstring(L, 2)); + _edje_lua_program_get_byname(obj->eo, luaL_checkstring(L, 2)); int program_id = pr->id; Edje_Running_Program *runp; Eina_List *l; obj->ed->walking_actions = EINA_TRUE; EINA_LIST_FOREACH(obj->ed->actions, l, runp) - if (program_id == runp->program->id) - _edje_program_end(obj->ed, runp); + if (program_id == runp->program->id) + _edje_program_end(obj->ed, runp); obj->ed->walking_actions = EINA_FALSE; return 0; } @@ -4555,170 +4557,182 @@ _edje_lua_group_fn_message_send(lua_State *L) int size; switch (type) { - case EDJE_MESSAGE_NONE: - break; - case EDJE_MESSAGE_SIGNAL: - break; - case EDJE_MESSAGE_STRING: - { - Edje_Message_String *msg_string = - malloc(sizeof(Edje_Message_String)); - msg_string->str = (char *)luaL_checkstring(L, 4); - msg = msg_string; - } - break; - case EDJE_MESSAGE_INT: - { - Edje_Message_Int *msg_int = malloc(sizeof(Edje_Message_Int)); + case EDJE_MESSAGE_NONE: + break; - msg_int->val = luaL_checkint(L, 4); - msg = msg_int; - } - break; - case EDJE_MESSAGE_FLOAT: - { - Edje_Message_Float *msg_float = malloc(sizeof(Edje_Message_Float)); + case EDJE_MESSAGE_SIGNAL: + break; - msg_float->val = luaL_checknumber(L, 4); - msg = msg_float; - } - break; - case EDJE_MESSAGE_STRING_SET: - { - if (lua_type(L, 4) != LUA_TTABLE) - break; - size = lua_objlen(L, 4); - Edje_Message_String_Set *msg_string_set = - malloc(sizeof(Edje_Message_String_Set) + - (size - 1) * sizeof(char *)); - msg_string_set->count = size; - for (i = 0; i < size; i++) - { - lua_rawgeti(L, 4, i + 1); - msg_string_set->str[i] = (char *)luaL_checkstring(L, -1); - lua_pop(L, 1); - } - msg = msg_string_set; - } - break; - case EDJE_MESSAGE_INT_SET: - { - if (lua_type(L, 4) != LUA_TTABLE) - break; - size = lua_objlen(L, 4); - Edje_Message_Int_Set *msg_int_set = - malloc(sizeof(Edje_Message_Int_Set) + (size - 1) * sizeof(int)); - msg_int_set->count = size; - for (i = 0; i < size; i++) - { - lua_rawgeti(L, 4, i + 1); - msg_int_set->val[i] = luaL_checkint(L, -1); - lua_pop(L, 1); - } - msg = msg_int_set; - } - break; - case EDJE_MESSAGE_FLOAT_SET: - { - if (lua_type(L, 4) != LUA_TTABLE) - break; - size = lua_objlen(L, 4); - Edje_Message_Float_Set *msg_float_set = - malloc(sizeof(Edje_Message_Float_Set) + - (size - 1) * sizeof(double)); - msg_float_set->count = size; - for (i = 0; i < size; i++) - { - lua_rawgeti(L, 4, i + 1); - msg_float_set->val[i] = luaL_checknumber(L, -1); - lua_pop(L, 1); - } - msg = msg_float_set; - } - break; - case EDJE_MESSAGE_STRING_INT: - { - Edje_Message_String_Int *msg_string_int = - malloc(sizeof(Edje_Message_String_Int)); - msg_string_int->str = (char *)luaL_checkstring(L, 4); - msg_string_int->val = luaL_checkint(L, 5); - msg = msg_string_int; - } - break; - case EDJE_MESSAGE_STRING_FLOAT: - { - Edje_Message_String_Float *msg_string_float = - malloc(sizeof(Edje_Message_String_Float)); - msg_string_float->str = (char *)luaL_checkstring(L, 4); - msg_string_float->val = luaL_checknumber(L, 5); - msg = msg_string_float; - } - break; - case EDJE_MESSAGE_STRING_INT_SET: - { - if (lua_type(L, 5) != LUA_TTABLE) - break; - size = lua_objlen(L, 5); - Edje_Message_String_Int_Set *msg_string_int_set = - malloc(sizeof(Edje_Message_String_Int_Set) + - (size - 1) * sizeof(int)); - msg_string_int_set->str = (char *)luaL_checkstring(L, 4); - msg_string_int_set->count = size; - for (i = 0; i < size; i++) - { - lua_rawgeti(L, 5, i + 1); - msg_string_int_set->val[i] = luaL_checkint(L, -1); - lua_pop(L, 1); - } - msg = msg_string_int_set; - } - break; - case EDJE_MESSAGE_STRING_FLOAT_SET: - { - if (lua_type(L, 5) != LUA_TTABLE) - break; - size = lua_objlen(L, 5); - Edje_Message_String_Float_Set *msg_string_float_set = - malloc(sizeof(Edje_Message_String_Float_Set) + - (size - 1) * sizeof(double)); - msg_string_float_set->str = (char *)luaL_checkstring(L, 4); - msg_string_float_set->count = size; - for (i = 0; i < size; i++) - { - lua_rawgeti(L, 5, i + 1); - msg_string_float_set->val[i] = luaL_checknumber(L, -1); - lua_pop(L, 1); - } - msg = msg_string_float_set; - } - break; - default: - break; + case EDJE_MESSAGE_STRING: + { + Edje_Message_String *msg_string = + malloc(sizeof(Edje_Message_String)); + msg_string->str = (char *)luaL_checkstring(L, 4); + msg = msg_string; + } + break; + + case EDJE_MESSAGE_INT: + { + Edje_Message_Int *msg_int = malloc(sizeof(Edje_Message_Int)); + + msg_int->val = luaL_checkint(L, 4); + msg = msg_int; + } + break; + + case EDJE_MESSAGE_FLOAT: + { + Edje_Message_Float *msg_float = malloc(sizeof(Edje_Message_Float)); + + msg_float->val = luaL_checknumber(L, 4); + msg = msg_float; + } + break; + + case EDJE_MESSAGE_STRING_SET: + { + if (lua_type(L, 4) != LUA_TTABLE) + break; + size = lua_objlen(L, 4); + Edje_Message_String_Set *msg_string_set = + malloc(sizeof(Edje_Message_String_Set) + + (size - 1) * sizeof(char *)); + msg_string_set->count = size; + for (i = 0; i < size; i++) + { + lua_rawgeti(L, 4, i + 1); + msg_string_set->str[i] = (char *)luaL_checkstring(L, -1); + lua_pop(L, 1); + } + msg = msg_string_set; + } + break; + + case EDJE_MESSAGE_INT_SET: + { + if (lua_type(L, 4) != LUA_TTABLE) + break; + size = lua_objlen(L, 4); + Edje_Message_Int_Set *msg_int_set = + malloc(sizeof(Edje_Message_Int_Set) + (size - 1) * sizeof(int)); + msg_int_set->count = size; + for (i = 0; i < size; i++) + { + lua_rawgeti(L, 4, i + 1); + msg_int_set->val[i] = luaL_checkint(L, -1); + lua_pop(L, 1); + } + msg = msg_int_set; + } + break; + + case EDJE_MESSAGE_FLOAT_SET: + { + if (lua_type(L, 4) != LUA_TTABLE) + break; + size = lua_objlen(L, 4); + Edje_Message_Float_Set *msg_float_set = + malloc(sizeof(Edje_Message_Float_Set) + + (size - 1) * sizeof(double)); + msg_float_set->count = size; + for (i = 0; i < size; i++) + { + lua_rawgeti(L, 4, i + 1); + msg_float_set->val[i] = luaL_checknumber(L, -1); + lua_pop(L, 1); + } + msg = msg_float_set; + } + break; + + case EDJE_MESSAGE_STRING_INT: + { + Edje_Message_String_Int *msg_string_int = + malloc(sizeof(Edje_Message_String_Int)); + msg_string_int->str = (char *)luaL_checkstring(L, 4); + msg_string_int->val = luaL_checkint(L, 5); + msg = msg_string_int; + } + break; + + case EDJE_MESSAGE_STRING_FLOAT: + { + Edje_Message_String_Float *msg_string_float = + malloc(sizeof(Edje_Message_String_Float)); + msg_string_float->str = (char *)luaL_checkstring(L, 4); + msg_string_float->val = luaL_checknumber(L, 5); + msg = msg_string_float; + } + break; + + case EDJE_MESSAGE_STRING_INT_SET: + { + if (lua_type(L, 5) != LUA_TTABLE) + break; + size = lua_objlen(L, 5); + Edje_Message_String_Int_Set *msg_string_int_set = + malloc(sizeof(Edje_Message_String_Int_Set) + + (size - 1) * sizeof(int)); + msg_string_int_set->str = (char *)luaL_checkstring(L, 4); + msg_string_int_set->count = size; + for (i = 0; i < size; i++) + { + lua_rawgeti(L, 5, i + 1); + msg_string_int_set->val[i] = luaL_checkint(L, -1); + lua_pop(L, 1); + } + msg = msg_string_int_set; + } + break; + + case EDJE_MESSAGE_STRING_FLOAT_SET: + { + if (lua_type(L, 5) != LUA_TTABLE) + break; + size = lua_objlen(L, 5); + Edje_Message_String_Float_Set *msg_string_float_set = + malloc(sizeof(Edje_Message_String_Float_Set) + + (size - 1) * sizeof(double)); + msg_string_float_set->str = (char *)luaL_checkstring(L, 4); + msg_string_float_set->count = size; + for (i = 0; i < size; i++) + { + lua_rawgeti(L, 5, i + 1); + msg_string_float_set->val[i] = luaL_checknumber(L, -1); + lua_pop(L, 1); + } + msg = msg_string_float_set; + } + break; + + default: + break; } if (msg) { - edje_object_message_send(obj->eo, type, luaL_checkint(L, 3), msg); - free(msg); + edje_object_message_send(obj->eo, type, luaL_checkint(L, 3), msg); + free(msg); } return 0; } static void -_edje_lua_group_signal_callback(void *data, Evas_Object * edj, - const char *signal, const char *source) +_edje_lua_group_signal_callback(void *data, Evas_Object *edj, + const char *signal, const char *source) { Edje_Lua_Ref *cb = data; lua_State *L = cb->L; - _edje_lua_get_ref(L, cb); // signal callback function + _edje_lua_get_ref(L, cb); // signal callback function if (lua_isfunction(L, -1)) { - int err_code; + int err_code; - _edje_lua_get_reg(L, edj); - lua_pushstring(L, signal); // signal - lua_pushstring(L, source); // source + _edje_lua_get_reg(L, edj); + lua_pushstring(L, signal); // signal + lua_pushstring(L, source); // source if ((err_code = lua_pcall(L, 3, 0, 0))) _edje_lua_error(L, err_code); @@ -4731,13 +4745,13 @@ _edje_lua_group_fn_signal_callback_add(lua_State *L) Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup); if (lua_type(L, 4) == LUA_TFUNCTION) { - Edje_Lua_Ref *ref = _edje_lua_new_ref(L, 4); - obj->cb = eina_list_append(obj->cb, ref); - edje_object_signal_callback_add(obj->eo, - luaL_checkstring(L, 2), - luaL_checkstring(L, 3), - _edje_lua_group_signal_callback, - ref); // freed in _edje_lua_group_fn_signal_callback_del + Edje_Lua_Ref *ref = _edje_lua_new_ref(L, 4); + obj->cb = eina_list_append(obj->cb, ref); + edje_object_signal_callback_add(obj->eo, + luaL_checkstring(L, 2), + luaL_checkstring(L, 3), + _edje_lua_group_signal_callback, + ref); // freed in _edje_lua_group_fn_signal_callback_del } return 0; } @@ -4747,9 +4761,9 @@ _edje_lua_group_fn_signal_callback_del(lua_State *L) { Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mGroup); Edje_Lua_Ref *ref = edje_object_signal_callback_del(obj->eo, - luaL_checkstring(L, 2), - luaL_checkstring(L, 3), - _edje_lua_group_signal_callback); + luaL_checkstring(L, 2), + luaL_checkstring(L, 3), + _edje_lua_group_signal_callback); obj->cb = eina_list_remove(obj->cb, ref); _edje_lua_free_ref(L, ref); // created in _edje_lua_group_fn_signal_callback_add return 0; @@ -4784,7 +4798,7 @@ const luaL_Reg lGroup_fn[] = { {"signal_callback_del", _edje_lua_group_fn_signal_callback_del}, {"freeze", _edje_lua_group_fn_freeze}, {"thaw", _edje_lua_group_fn_thaw}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; /* @@ -4809,57 +4823,57 @@ const Edje_Lua_Reg *cScript[] = { &mObject, &mGroup, &mScript, - NULL // sentinel + NULL // sentinel }; /* * macro for adding an evas_object in the lua_script_only object */ -#define _EDJE_LUA_SCRIPT_FN_ADD(DEF, CLASS, FUNC) \ - static int \ - DEF (lua_State *L) \ - { \ - int set = lua_gettop (L) == 2; \ - Edje_Lua_Evas_Object *obj = _edje_lua_checkudata (L, 1, &mScript); \ - Edje_Lua_Evas_Object *tar = lua_newuserdata (L, sizeof (Edje_Lua_Evas_Object)); \ - _edje_lua_set_class (L, -1, CLASS); \ - tar->eo = FUNC (obj->ed->evas); \ - tar->ed = obj->ed; \ - tar->L = L; \ - tar->cb = NULL; \ - evas_object_move (tar->eo, obj->ed->x, obj->ed->y); \ - _edje_lua_new_reg (L, -1, tar); /* freed in _edje_lua_object_del_cb */ \ - _edje_lua_new_reg (L, -1, tar->eo); /* freed in _edje_lua_object_del_cb */ \ - evas_object_smart_member_add (tar->eo, obj->eo); \ - evas_object_clip_set (tar->eo, obj->ed->clipper); \ - evas_object_event_callback_add (tar->eo, EVAS_CALLBACK_DEL, _edje_lua_object_del_cb, L); \ - if (set) \ - { \ - int err_code; \ - lua_getfield (L, -1, "set"); \ - lua_pushvalue (L, -2); \ - lua_pushvalue (L, 2); \ - if ((err_code = lua_pcall (L, 2, 0, 0))) \ - _edje_lua_error (L, err_code); \ - } \ - return 1; \ +#define _EDJE_LUA_SCRIPT_FN_ADD(DEF, CLASS, FUNC) \ + static int \ + DEF(lua_State * L) \ + { \ + int set = lua_gettop(L) == 2; \ + Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mScript); \ + Edje_Lua_Evas_Object *tar = lua_newuserdata(L, sizeof (Edje_Lua_Evas_Object)); \ + _edje_lua_set_class(L, -1, CLASS); \ + tar->eo = FUNC(obj->ed->evas); \ + tar->ed = obj->ed; \ + tar->L = L; \ + tar->cb = NULL; \ + evas_object_move(tar->eo, obj->ed->x, obj->ed->y); \ + _edje_lua_new_reg(L, -1, tar); /* freed in _edje_lua_object_del_cb */ \ + _edje_lua_new_reg(L, -1, tar->eo); /* freed in _edje_lua_object_del_cb */ \ + evas_object_smart_member_add(tar->eo, obj->eo); \ + evas_object_clip_set(tar->eo, obj->ed->clipper); \ + evas_object_event_callback_add(tar->eo, EVAS_CALLBACK_DEL, _edje_lua_object_del_cb, L); \ + if (set) \ + { \ + int err_code; \ + lua_getfield(L, -1, "set"); \ + lua_pushvalue(L, -2); \ + lua_pushvalue(L, 2); \ + if ((err_code = lua_pcall(L, 2, 0, 0))) \ + _edje_lua_error(L, err_code); \ + } \ + return 1; \ } _EDJE_LUA_SCRIPT_FN_ADD(_edje_lua_script_fn_rectangle, - cRectangle, - evas_object_rectangle_add) + cRectangle, + evas_object_rectangle_add) _EDJE_LUA_SCRIPT_FN_ADD(_edje_lua_script_fn_image, - cImage, - evas_object_image_add) + cImage, + evas_object_image_add) _EDJE_LUA_SCRIPT_FN_ADD(_edje_lua_script_fn_table, - cTable, - evas_object_table_add) + cTable, + evas_object_table_add) _EDJE_LUA_SCRIPT_FN_ADD(_edje_lua_script_fn_line, - cLine, - evas_object_line_add) + cLine, + evas_object_line_add) _EDJE_LUA_SCRIPT_FN_ADD(_edje_lua_script_fn_polygon, - cPolygon, - evas_object_polygon_add) + cPolygon, + evas_object_polygon_add) _EDJE_LUA_SCRIPT_FN_ADD(_edje_lua_script_fn_group, cGroup, edje_object_add) const luaL_Reg lScript_fn[] = { @@ -4869,22 +4883,22 @@ const luaL_Reg lScript_fn[] = { {"line", _edje_lua_script_fn_line}, {"polygon", _edje_lua_script_fn_polygon}, {"group", _edje_lua_script_fn_group}, - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; const luaL_Reg lScript_get[] = { - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; const luaL_Reg lScript_set[] = { - {NULL, NULL} // sentinel + {NULL, NULL} // sentinel }; /* * creates and exports a lua_script_only object */ void -_edje_lua_script_fn_new(Edje * ed) +_edje_lua_script_fn_new(Edje *ed) { lua_State *L = ed->L; Edje_Lua_Evas_Object *tar = lua_newuserdata(L, sizeof(Edje_Lua_Evas_Object)); @@ -4897,14 +4911,14 @@ _edje_lua_script_fn_new(Edje * ed) _edje_lua_new_reg(L, -1, ed); // freed in edje_load.c::_edje_file_del _edje_lua_new_reg(L, -1, ed->obj); // freed in _edje_lua_object_del_cb evas_object_event_callback_add(tar->eo, EVAS_CALLBACK_DEL, - _edje_lua_object_del_cb, L); + _edje_lua_object_del_cb, L); } /* * creates and exports an Edje group with associated Lua scripts in the parts and programs sections */ void -_edje_lua_group_fn_new(Edje * ed) +_edje_lua_group_fn_new(Edje *ed) { lua_State *L = ed->L; Edje_Lua_Evas_Object *tar = lua_newuserdata(L, sizeof(Edje_Lua_Evas_Object)); @@ -4917,7 +4931,7 @@ _edje_lua_group_fn_new(Edje * ed) _edje_lua_new_reg(L, -1, ed); // freed in edje_load.c::_edje_file_del _edje_lua_new_reg(L, -1, ed->obj); // freed in _edje_lua_object_del_cb evas_object_event_callback_add(tar->eo, EVAS_CALLBACK_DEL, - _edje_lua_object_del_cb, L); + _edje_lua_object_del_cb, L); } /* @@ -5033,18 +5047,18 @@ _edje_lua_alloc(void *ud, void *ptr, size_t osize, size_t nsize) { Edje_Lua_Alloc *ela = ud; void *ptr2; - + ela->cur += nsize - osize; if (ela->cur > ela->max) { ERR("Edje Lua memory limit of %zu bytes reached (%zu allocated)", - ela->max, ela->cur); - return NULL; + ela->max, ela->cur); + return NULL; } if (nsize == 0) { - free(ptr); /* ANSI requires that free(NULL) has no effect */ - return NULL; + free(ptr); /* ANSI requires that free(NULL) has no effect */ + return NULL; } /* ANSI requires that realloc(NULL, size) == malloc(size) */ @@ -5061,16 +5075,16 @@ _edje_lua_init(void) /* * create main Lua state with the custom memory allocation function */ - static Edje_Lua_Alloc ela = { 1e7, 0 }; // TODO make the memory limit configurable? + static Edje_Lua_Alloc ela = { 1e7, 0 }; // TODO make the memory limit configurable? Ledje = lua_newstate(_edje_lua_alloc, &ela); if (!Ledje) { - ERR("Lua error: Lua state could not be initialized"); - exit(-1); + ERR("Lua error: Lua state could not be initialized"); + exit(-1); } lua_atpanic(Ledje, _edje_lua_custom_panic); - + /* * configure Lua garbage collector * TODO optimize garbage collector for typical edje use or make it configurable @@ -5129,7 +5143,7 @@ _edje_lua_init(void) * so that deleted and unused objects can be garbage collected */ lua_createtable(Ledje, 1, 0); - //lua_pushstring(Ledje, "v"); + //lua_pushstring(Ledje, "v"); lua_pushstring(Ledje, ""); lua_setfield(Ledje, -2, "__mode"); lua_setmetatable(Ledje, LUA_REGISTRYINDEX); diff --git a/src/lib/edje/edje_lua2.c b/src/lib/edje/edje_lua2.c index bed76f2c33..e64b989b56 100644 --- a/src/lib/edje/edje_lua2.c +++ b/src/lib/edje/edje_lua2.c @@ -1,15 +1,13 @@ // FIXME: Some error checking would be nice. - #include "edje_private.h" #include #define RASTER_FORGOT_WHY "this is here." - //--------------------------------------------------------------------------// -#define MAX_LUA_MEM (4 * (1024 * 1024)) -#define ELO "|-ELO" +#define MAX_LUA_MEM (4 * (1024 * 1024)) +#define ELO "|-ELO" #define LC(...) EINA_LOG_DOM_CRIT(_log_domain, __VA_ARGS__) #define LE(...) EINA_LOG_DOM_ERR(_log_domain, __VA_ARGS__) @@ -18,45 +16,45 @@ #define LD(...) EINA_LOG_DOM_DBG(_log_domain, __VA_ARGS__) /** -@page luaref Edje Lua scripting + @page luaref Edje Lua scripting -@section intro Introduction + @section intro Introduction -Lua is intended for script-only objects at this point (with embryo left -for augmenting standard programs). Since script-only objects effectively -define objects entirely via Lua script (resize handling, event handling -etc. etc.) this places many more demands on them, and thus a more powerful -language is in order. Lua is that language. + Lua is intended for script-only objects at this point (with embryo left + for augmenting standard programs). Since script-only objects effectively + define objects entirely via Lua script (resize handling, event handling + etc. etc.) this places many more demands on them, and thus a more powerful + language is in order. Lua is that language. -To get you started, here's an example that uses most of this lua API: -@ref lua_script.edc + To get you started, here's an example that uses most of this lua API: + @ref lua_script.edc -Most of these lua functions are wrappers around various evas, ecore, and edje C -functions. Refer to their documentation for more in depth details and up to -date documentation. A lot of this documentation is simple copied from the C -functions it wraps. + Most of these lua functions are wrappers around various evas, ecore, and edje C + functions. Refer to their documentation for more in depth details and up to + date documentation. A lot of this documentation is simple copied from the C + functions it wraps. -@section args Lua function argument and return syntax + @section args Lua function argument and return syntax -Some of the lua functions can accept a table as well as separate arguments. -Some of them return tables. + Some of the lua functions can accept a table as well as separate arguments. + Some of them return tables. -@section classes Lua classes + @section classes Lua classes -*/ + */ /* -Lua functions stack usage. + Lua functions stack usage. -In the definition of the lua functions provided, always mention the stack usage, -using the same notation that is used in the Lua 5.1 Reference Manual. -http://www.lua.org/manual/5.1/manual.html#3.7 describes that notation. + In the definition of the lua functions provided, always mention the stack usage, + using the same notation that is used in the Lua 5.1 Reference Manual. + http://www.lua.org/manual/5.1/manual.html#3.7 describes that notation. -On the other hand, lua discards excess stack entries when control passes back to -it, but it's good to maintain proper discipline. + On the other hand, lua discards excess stack entries when control passes back to + it, but it's good to maintain proper discipline. -Should do the same for the support functions. These ARE more important to check. -*/ + Should do the same for the support functions. These ARE more important to check. + */ //--------------------------------------------------------------------------// typedef struct _Edje_Lua_Alloc Edje_Lua_Alloc; @@ -76,57 +74,56 @@ struct _Edje_Lua_Alloc struct _Edje_Lua_Allocator { Edje_Lua_Alloc *ela; - void *(*func) (void *ud, void *ptr, size_t osize, size_t nsize); - void *ud; - int ref; + void *(*func)(void *ud, void *ptr, size_t osize, size_t nsize); + void *ud; + int ref; }; struct _Edje_Lua_Obj { EINA_INLIST; - Edje *ed; - void (*free_func) (void *obj); - const char *meta; + Edje *ed; + void (*free_func)(void *obj); + const char *meta; }; struct _Edje_Lua_Animator { - Edje_Lua_Obj obj; - Ecore_Animator *animator; - int fn_ref; + Edje_Lua_Obj obj; + Ecore_Animator *animator; + int fn_ref; }; struct _Edje_Lua_Timer { - Edje_Lua_Obj obj; - Ecore_Timer *timer; - int fn_ref; + Edje_Lua_Obj obj; + Ecore_Timer *timer; + int fn_ref; }; struct _Edje_Lua_Transition { - Edje_Lua_Obj obj; - Ecore_Animator *animator; - double transition, start; - int fn_ref; + Edje_Lua_Obj obj; + Ecore_Animator *animator; + double transition, start; + int fn_ref; }; struct _Edje_Lua_Evas_Object { - Edje_Lua_Obj obj; - Evas_Object *evas_obj; - int x, y; + Edje_Lua_Obj obj; + Evas_Object *evas_obj; + int x, y; }; struct _Edje_Lua_Map { - Edje_Lua_Obj obj; - Evas_Map *map; + Edje_Lua_Obj obj; + Evas_Map *map; }; - -static void _elua_add_functions(lua_State *L, const char *api, const luaL_Reg *funcs, const char *meta, const char *parent, const char *base); +static void _elua_add_functions(lua_State *L, const char *api, const luaL_Reg *funcs, const char *meta, const char *parent, const char *base); static Eina_Bool _elua_isa(Edje_Lua_Obj *obj, const char *type); //--------------------------------------------------------------------------// @@ -136,8 +133,8 @@ static lua_State *lstate = NULL; static const char *_elua_key = "key"; static const char *_elua_objs = "objs"; /* This is not needed, pcalls don't longjmp(), that's why they are protected. -static jmp_buf panic_jmp; -*/ + static jmp_buf panic_jmp; + */ static int panics = 0; static int _log_domain = -1; static int _log_count = 0; @@ -191,23 +188,23 @@ static int _elua_obj_gc(lua_State *L); static const struct luaL_Reg _elua_edje_gc_funcs [] = { - {"__gc", _elua_obj_gc}, // garbage collector func for edje objects + {"__gc", _elua_obj_gc}, // garbage collector func for edje objects - {NULL, NULL} // end + {NULL, NULL} // end }; static const luaL_Reg _elua_libs[] = { - {"", luaopen_base}, + {"", luaopen_base}, // {LUA_LOADLIBNAME, luaopen_package}, // disable this lib - don't want - {LUA_TABLIBNAME, luaopen_table}, + {LUA_TABLIBNAME, luaopen_table}, // {LUA_IOLIBNAME, luaopen_io}, // disable this lib - don't want // {LUA_OSLIBNAME, luaopen_os}, // FIXME: audit os lib - maybe not provide or only provide specific calls - {LUA_STRLIBNAME, luaopen_string}, - {LUA_MATHLIBNAME, luaopen_math}, + {LUA_STRLIBNAME, luaopen_string}, + {LUA_MATHLIBNAME, luaopen_math}, // {LUA_DBLIBNAME, luaopen_debug}, // disable this lib - don't want - {NULL, NULL} // end + {NULL, NULL} // end }; //--------------------------------------------------------------------------// @@ -215,8 +212,8 @@ static void * _elua_alloc(void *ud, void *ptr, size_t osize, size_t nsize) { size_t dif; - Edje_Lua_Allocator *al = ud; - Edje_Lua_Alloc *ela = al->ela; + Edje_Lua_Allocator *al = ud; + Edje_Lua_Alloc *ela = al->ela; // in lua 5.2 osize encodes the type of data allocted if ptr is NULL // LUA_TSTRING, LUA_TTABLE, LUA_TFUNCTION, LUA_TUSERDATA, or LUA_TTHREAD @@ -253,7 +250,7 @@ _elua_alloc(void *ud, void *ptr, size_t osize, size_t nsize) } static int -_elua_custom_panic(lua_State *L) // Stack usage [-0, +0, m] +_elua_custom_panic(lua_State *L) // Stack usage [-0, +0, m] { // If we somehow manage to have multiple panics, it's likely due to being out // of memory in the following lua_tostring() call. @@ -265,7 +262,7 @@ _elua_custom_panic(lua_State *L) // Stack usage [-0, +0, m] else { EINA_LOG_DOM_CRIT(_edje_default_log_dom, - "Lua PANIC!!!!!: %s", lua_tostring(L, -1)); // Stack usage [-0, +0, m] + "Lua PANIC!!!!!: %s", lua_tostring(L, -1)); // Stack usage [-0, +0, m] } // The docs say that this will cause an exit(EXIT_FAILURE) if we return, // and that we we should long jump some where to avoid that. This is only @@ -290,20 +287,20 @@ _elua_table_ptr_get(lua_State *L, const void *key) // Stack usage [-2, +2, e] const void *ptr; lua_pushlightuserdata(L, (void *)key); // Stack usage [-0, +1, -] lua_gettable(L, LUA_REGISTRYINDEX); // Stack usage [-1, +1, e] - ptr = lua_topointer(L, -1); // Stack usage [-0, +0, -] - lua_pop(L, 1); // Stack usage [-n, +0, -] + ptr = lua_topointer(L, -1); // Stack usage [-0, +0, -] + lua_pop(L, 1); // Stack usage [-n, +0, -] return ptr; } /* XXX: not used -static void -_elua_table_ptr_del(lua_State *L, const void *key) // Stack usage [-2, +2, e] -{ + static void + _elua_table_ptr_del(lua_State *L, const void *key) // Stack usage [-2, +2, e] + { lua_pushlightuserdata(L, (void *)key); // Stack usage [-0, +1, -] lua_pushnil(L); // Stack usage [-0, +1, -] lua_settable(L, LUA_REGISTRYINDEX); // Stack usage [-2, +0, e] -} -*/ + } + */ /* * Cori: Assumes object to be saved on top of stack @@ -312,11 +309,11 @@ static void _elua_ref_set(lua_State *L, void *key) // Stack usage [-4, +4, m] { lua_pushlightuserdata(L, &_elua_objs); // Stack usage [-0, +1, -] - lua_rawget(L, LUA_REGISTRYINDEX); // Stack usage [-1, +1, -] - lua_pushlightuserdata(L, key); // Stack usage [-0, +1, -] - lua_pushvalue(L,-3); // Stack usage [-0, +1, -] - lua_rawset(L, -3); // Stack usage [-2, +0, m] - lua_pop(L, 1); // Stack usage [-n, +0, -] + lua_rawget(L, LUA_REGISTRYINDEX); // Stack usage [-1, +1, -] + lua_pushlightuserdata(L, key); // Stack usage [-0, +1, -] + lua_pushvalue(L, -3); // Stack usage [-0, +1, -] + lua_rawset(L, -3); // Stack usage [-2, +0, m] + lua_pop(L, 1); // Stack usage [-n, +0, -] } /* @@ -326,11 +323,11 @@ static void * _elua_ref_get(lua_State *L, void *key) // Stack usage [-3, +4, -] { lua_pushlightuserdata(L, &_elua_objs); // Stack usage [-0, +1, -] - lua_rawget(L, LUA_REGISTRYINDEX); // Stack usage [-1, +1, -] - lua_pushlightuserdata(L, key); // Stack usage [-0, +1, -] - lua_rawget(L, -2); // Stack usage [-1, +1, -] - lua_remove(L, -2); // Stack usage [-1, +0, -] - return lua_touserdata(L, -2); // Stack usage [-0, +0, -] + lua_rawget(L, LUA_REGISTRYINDEX); // Stack usage [-1, +1, -] + lua_pushlightuserdata(L, key); // Stack usage [-0, +1, -] + lua_rawget(L, -2); // Stack usage [-1, +1, -] + lua_remove(L, -2); // Stack usage [-1, +0, -] + return lua_touserdata(L, -2); // Stack usage [-0, +0, -] } static Edje_Lua_Obj * @@ -342,12 +339,12 @@ _elua_obj_new(lua_State *L, Edje *ed, int size, const char *metatable) // Stack memset(obj, 0, size); ed->lua_objs = eina_inlist_append(ed->lua_objs, EINA_INLIST_GET(obj)); - luaL_getmetatable(L, metatable); // Stack usage [-0, +1, -] - lua_setmetatable(L, -2); // Stack usage [-1, +0, -] + luaL_getmetatable(L, metatable); // Stack usage [-0, +1, -] + lua_setmetatable(L, -2); // Stack usage [-1, +0, -] obj->ed = ed; obj->meta = metatable; - _elua_ref_set(L, obj); // Stack usage [-4, +4, m] + _elua_ref_set(L, obj); // Stack usage [-4, +4, m] return obj; } @@ -357,8 +354,8 @@ _elua_obj_free(lua_State *L, Edje_Lua_Obj *obj) if (!obj->free_func) return; // Free the reference, so it will actually get gc'd. // It seems that being a completely weak table isn't enough. - lua_pushnil(L); // Stack usage [-0, +1, -] - _elua_ref_set(L, obj); // Stack usage [-4, +4, m] + lua_pushnil(L); // Stack usage [-0, +1, -] + _elua_ref_set(L, obj); // Stack usage [-4, +4, m] obj->free_func(obj); obj->ed->lua_objs = eina_inlist_remove(obj->ed->lua_objs, EINA_INLIST_GET(obj)); obj->free_func = NULL; @@ -408,24 +405,24 @@ _elua_push_name(lua_State *L, char *q, int idx) // Stack usage [-0, +1, e or m] // A simplistic scan through an identifier, it's wrong, but it's quick, // and we don't mind that it's wrong, coz this is only internal. while (isalnum((int)*q)) - q++; + q++; temp = *q; *q = '\0'; if (idx > 0) - lua_getfield(L, idx, p); // Stack usage [-0, +1, e] + lua_getfield(L, idx, p); // Stack usage [-0, +1, e] else - lua_pushstring(L, p); // Stack usage [-0, +1, m] + lua_pushstring(L, p); // Stack usage [-0, +1, m] *q = temp; return q; } static int -_elua_scan_params(lua_State *L, int i, char *params, ...) // Stack usage - +_elua_scan_params(lua_State *L, int i, char *params, ...) // Stack usage - // if i is a table - // [-n, +n, e] + // [-n, +n, e] // else - // [-0, +0, -] + // [-0, +0, -] { va_list vl; char *f = strdup(params); @@ -436,7 +433,7 @@ _elua_scan_params(lua_State *L, int i, char *params, ...) // Stac if (!f) return -1; va_start(vl, params); - if (lua_istable(L, i)) // Stack usage [-0, +0, -] + if (lua_istable(L, i)) // Stack usage [-0, +0, -] { j = -1; table = EINA_TRUE; @@ -448,79 +445,83 @@ _elua_scan_params(lua_State *L, int i, char *params, ...) // Stac Eina_Bool get = EINA_TRUE; while (isspace((int)*p)) - p++; + p++; q = p + 1; switch (*p) { - case '%': - { - if (table) - { - q = _elua_push_name(L, q, i); // Stack usage [-0, +1, e] - } - if (lua_isnumber(L, j)) // Stack usage [-0, +0, -] - { - int *v = va_arg(vl, int *); - *v = lua_tointeger(L, j); // Stack usage [-0, +0, -] - n++; - } - break; - } - case '#': - { - if (table) - { - q = _elua_push_name(L, q, i); // Stack usage [-0, +1, e] - } - if (lua_isnumber(L, j)) // Stack usage [-0, +0, -] - { - double *v = va_arg(vl, double *); - *v = lua_tonumber(L, j); // Stack usage [-0, +0, -] - n++; - } - break; - } - case '$': - { - if (table) - { - q = _elua_push_name(L, q, i); // Stack usage [-0, +1, e] - } - if (lua_isstring(L, j)) // Stack usage [-0, +0, -] - { - char **v = va_arg(vl, char **); - size_t len; - char *temp = (char *) lua_tolstring(L, j, &len); // Stack usage [-0, +0, m] + case '%': + { + if (table) + { + q = _elua_push_name(L, q, i); // Stack usage [-0, +1, e] + } + if (lua_isnumber(L, j)) // Stack usage [-0, +0, -] + { + int *v = va_arg(vl, int *); + *v = lua_tointeger(L, j); // Stack usage [-0, +0, -] + n++; + } + break; + } - len++; // Cater for the null at the end. - *v = malloc(len); - if (*v) - { - memcpy(*v, temp, len); - n++; - } - } - break; - } - case '!': - { - if (table) - { - q = _elua_push_name(L, q, i); // Stack usage [-0, +1, e] - } - if (lua_isboolean(L, j)) // Stack usage [-0, +0, -] - { - int *v = va_arg(vl, int *); - *v = lua_toboolean(L, j); // Stack usage [-0, +0, -] - n++; - } - break; - } - default: - { - get = EINA_FALSE; - break; - } + case '#': + { + if (table) + { + q = _elua_push_name(L, q, i); // Stack usage [-0, +1, e] + } + if (lua_isnumber(L, j)) // Stack usage [-0, +0, -] + { + double *v = va_arg(vl, double *); + *v = lua_tonumber(L, j); // Stack usage [-0, +0, -] + n++; + } + break; + } + + case '$': + { + if (table) + { + q = _elua_push_name(L, q, i); // Stack usage [-0, +1, e] + } + if (lua_isstring(L, j)) // Stack usage [-0, +0, -] + { + char **v = va_arg(vl, char **); + size_t len; + char *temp = (char *)lua_tolstring(L, j, &len); // Stack usage [-0, +0, m] + + len++; // Cater for the null at the end. + *v = malloc(len); + if (*v) + { + memcpy(*v, temp, len); + n++; + } + } + break; + } + + case '!': + { + if (table) + { + q = _elua_push_name(L, q, i); // Stack usage [-0, +1, e] + } + if (lua_isboolean(L, j)) // Stack usage [-0, +0, -] + { + int *v = va_arg(vl, int *); + *v = lua_toboolean(L, j); // Stack usage [-0, +0, -] + n++; + } + break; + } + + default: + { + get = EINA_FALSE; + break; + } } if (get) @@ -528,11 +529,11 @@ _elua_scan_params(lua_State *L, int i, char *params, ...) // Stac if (table) { // If this is a table, then we pushed a value on the stack, pop it off. - lua_pop(L, 1); // Stack usage [-n, +0, -] + lua_pop(L, 1); // Stack usage [-n, +0, -] } - else - j++; - count++; + else + j++; + count++; } p = q; } @@ -540,14 +541,14 @@ _elua_scan_params(lua_State *L, int i, char *params, ...) // Stac free(f); va_end(vl); if (count > n) - n = 0; + n = 0; else if (table) n = 1; return n; } static int -_elua_ret(lua_State *L, char *params, ...) // Stack usage [-(2*n), +(2*n+1), em] +_elua_ret(lua_State *L, char *params, ...) // Stack usage [-(2*n), +(2*n+1), em] { va_list vl; char *f = strdup(params); @@ -556,7 +557,7 @@ _elua_ret(lua_State *L, char *params, ...) // Stack usage [-(2*n) if (!f) return -1; - lua_newtable(L); // Stack usage [-0, +1, m] + lua_newtable(L); // Stack usage [-0, +1, m] va_start(vl, params); while (*p) @@ -565,44 +566,48 @@ _elua_ret(lua_State *L, char *params, ...) // Stack usage [-(2*n) Eina_Bool set = EINA_TRUE; while (isspace((int)*p)) - p++; + p++; q = p + 1; switch (*p) { - case '%': - { - q = _elua_push_name(L, q, -1); // Stack usage [-0, +1, m] - lua_pushinteger(L, va_arg(vl, int)); // Stack usage [-0, +1, -] - break; - } - case '#': - { - q = _elua_push_name(L, q, -1); // Stack usage [-0, +1, m] - lua_pushnumber(L, va_arg(vl, double)); // Stack usage [-0, +1, -] - break; - } - case '$': - { - q = _elua_push_name(L, q, -1); // Stack usage [-0, +1, m] - lua_pushstring(L, va_arg(vl, char *)); // Stack usage [-0, +1, m] - break; - } - case '!': - { - q = _elua_push_name(L, q, -1); // Stack usage [-0, +1, m] - lua_pushboolean(L, va_arg(vl, int)); // Stack usage [-0, +1, -] - break; - } - default: - { - set = EINA_FALSE; - break; - } + case '%': + { + q = _elua_push_name(L, q, -1); // Stack usage [-0, +1, m] + lua_pushinteger(L, va_arg(vl, int)); // Stack usage [-0, +1, -] + break; + } + + case '#': + { + q = _elua_push_name(L, q, -1); // Stack usage [-0, +1, m] + lua_pushnumber(L, va_arg(vl, double)); // Stack usage [-0, +1, -] + break; + } + + case '$': + { + q = _elua_push_name(L, q, -1); // Stack usage [-0, +1, m] + lua_pushstring(L, va_arg(vl, char *)); // Stack usage [-0, +1, m] + break; + } + + case '!': + { + q = _elua_push_name(L, q, -1); // Stack usage [-0, +1, m] + lua_pushboolean(L, va_arg(vl, int)); // Stack usage [-0, +1, -] + break; + } + + default: + { + set = EINA_FALSE; + break; + } } if (set) { - lua_settable(L, -3); // Stack usage [-2, +0, e] + lua_settable(L, -3); // Stack usage [-2, +0, e] n++; } p = q; @@ -624,14 +629,14 @@ _elua_color_fix(int *r, int *g, int *b, int *a) //--------------------------------------------------------------------------// /** -@page luaref -@subsection edje Edje class. + @page luaref + @subsection edje Edje class. -The lua edje class includes functions for dealing with the lua script only group -as an edje object, basic functions, and functions to create other objects. + The lua edje class includes functions for dealing with the lua script only group + as an edje object, basic functions, and functions to create other objects. -In the following, "edje" is the actual global table used to access these edje functions. -*/ + In the following, "edje" is the actual global table used to access these edje functions. + */ static int _elua_echo(lua_State *L); @@ -667,59 +672,59 @@ static const char *_elua_edje_api = "edje"; static const struct luaL_Reg _elua_edje_funcs [] = { // add an echo too to make it more shelly - {"echo", _elua_echo}, // test func - echo (i know we have print. test) + {"echo", _elua_echo}, // test func - echo (i know we have print. test) // FIXME: add logging functions here, probably to it's own domain, or even a script defined domain. // system information (time, date blah blah) - {"date", _elua_date}, // get date in a table - {"looptime", _elua_looptime}, // get loop time - {"seconds", _elua_seconds}, // get seconds - {"version", _elua_version}, // edje version + {"date", _elua_date}, // get date in a table + {"looptime", _elua_looptime}, // get loop time + {"seconds", _elua_seconds}, // get seconds + {"version", _elua_version}, // edje version // query edje - size, pos - {"geom", _elua_objgeom}, // get while edje object geometry in canvas - {"pos", _elua_objpos}, // get while edje object pos in canvas - {"size", _elua_objsize}, // get while edje object pos in canvas + {"geom", _elua_objgeom}, // get while edje object geometry in canvas + {"pos", _elua_objpos}, // get while edje object pos in canvas + {"size", _elua_objsize}, // get while edje object pos in canvas // talk to application/caller - {"emit", _elua_emit}, // emit signal + src - {"messagesend", _elua_messagesend}, // send a structured message + {"emit", _elua_emit}, // emit signal + src + {"messagesend", _elua_messagesend}, // send a structured message // time based "callback" systems - {"animator", _elua_animator}, // add animator - {"timer", _elua_timer}, // add timer - {"transition", _elua_transition}, // add transition + {"animator", _elua_animator}, // add animator + {"timer", _elua_timer}, // add timer + {"transition", _elua_transition}, // add transition // FIXME: need poller // set and query color / text class - {"color_class", _elua_color_class}, - {"text_class", _elua_text_class}, + {"color_class", _elua_color_class}, + {"text_class", _elua_text_class}, // create new objects - {"edje", _elua_edje}, - {"image", _elua_image}, // defaults to a filled image. - {"line", _elua_line}, - {"map", _elua_map}, - {"polygon", _elua_polygon}, - {"rect", _elua_rect}, - {"text", _elua_text}, + {"edje", _elua_edje}, + {"image", _elua_image}, // defaults to a filled image. + {"line", _elua_line}, + {"map", _elua_map}, + {"polygon", _elua_polygon}, + {"rect", _elua_rect}, + {"text", _elua_text}, // {"textblock", _elua_textblock}, /* XXX: disabled until there are enough textblock functions implemented to make it actually useful // FIXME: add the new sound stuff. - {NULL, NULL} // end + {NULL, NULL} // end }; /** -@page luaref -@subsubsection edje_echo edje.echo(text) + @page luaref + @subsubsection edje_echo edje.echo(text) -Make lua a bit shelly. Prints a string to the console + Make lua a bit shelly. Prints a string to the console -@param text The string to print. -*/ + @param text The string to print. + */ static int -_elua_echo(lua_State *L) // Stack usage [-0, +0, v] +_elua_echo(lua_State *L) // Stack usage [-0, +0, v] { const char *string = luaL_checkstring(L, 1); // Stack usage [-0, +0, v] LD("%s", string); @@ -728,14 +733,14 @@ _elua_echo(lua_State *L) // Stack usage [-0, +0, v] //------------- /** -@page luaref -@subsubsection edje_date edje.date() + @page luaref + @subsubsection edje_date edje.date() -Retrieves the current time and date. + Retrieves the current time and date. -Wraps gettimeofday(), as passed through localtime(). + Wraps gettimeofday(), as passed through localtime(). -@return A table with these fields: + @return A table with these fields: - integer year: Year. - integer month: Month of the year. - integer day: Day of the month. @@ -745,14 +750,14 @@ Wraps gettimeofday(), as passed through localtime(). - integer min: Minute of the hour. - number sec: Seconds as a number. -*/ + */ static int _elua_date(lua_State *L) // Stack usage [-16, +17, em] { - static time_t last_tzset = 0; - struct timeval timev; - struct tm *tm; - time_t tt; + static time_t last_tzset = 0; + struct timeval timev; + struct tm *tm; + time_t tt; gettimeofday(&timev, NULL); tt = (time_t)(timev.tv_sec); @@ -762,63 +767,61 @@ _elua_date(lua_State *L) // Stack usage [-16, +17, em] tzset(); } tm = localtime(&tt); - if (tm) - { // Stack usage [-16, +17, em] + if (tm) // Stack usage [-16, +17, em] + { _elua_ret(L, "%year %month %day %yearday %weekday %hour %min #sec", - (int)(tm->tm_year + 1900), - (int)(tm->tm_mon + 1), - (int)(tm->tm_mday), - (int)(tm->tm_yday), - (int)((tm->tm_wday + 6) % 7), - (int)(tm->tm_hour), - (int)(tm->tm_min), - (double)((double)tm->tm_sec + (((double)timev.tv_usec) / 1000000)) - ); - - + (int)(tm->tm_year + 1900), + (int)(tm->tm_mon + 1), + (int)(tm->tm_mday), + (int)(tm->tm_yday), + (int)((tm->tm_wday + 6) % 7), + (int)(tm->tm_hour), + (int)(tm->tm_min), + (double)((double)tm->tm_sec + (((double)timev.tv_usec) / 1000000)) + ); } return 1; } /** -@page luaref -@subsubsection edje_looptime edje.looptime() + @page luaref + @subsubsection edje_looptime edje.looptime() -Retrieves the time at which the last loop stopped waiting for timeouts or events. + Retrieves the time at which the last loop stopped waiting for timeouts or events. -This gets the time that the main loop ceased waiting for timouts and/or events -to come in or for signals or any other interrupt source. This should be -considered a reference point for all time based activity that should calculate -its timepoint from the return of edje.looptime(). Use this UNLESS you absolutely -must get the current actual timepoint - then use edje.seconds(). Note that this -time is meant to be used as relative to other times obtained on this run. + This gets the time that the main loop ceased waiting for timouts and/or events + to come in or for signals or any other interrupt source. This should be + considered a reference point for all time based activity that should calculate + its timepoint from the return of edje.looptime(). Use this UNLESS you absolutely + must get the current actual timepoint - then use edje.seconds(). Note that this + time is meant to be used as relative to other times obtained on this run. -Wraps ecore_loop_time_get(). + Wraps ecore_loop_time_get(). -@returns A number of seconds. -*/ + @returns A number of seconds. + */ static int _elua_looptime(lua_State *L) // Stack usage [-0, +1, -] { double t = ecore_loop_time_get(); - lua_pushnumber(L, t); // Stack usage [-0, +1, -] + lua_pushnumber(L, t); // Stack usage [-0, +1, -] return 1; } /** -@page luaref -@subsubsection edje_seconds edje.seconds() + @page luaref + @subsubsection edje_seconds edje.seconds() -Retrieves the current system time as a floating point value in seconds. + Retrieves the current system time as a floating point value in seconds. -This uses a monotonic clock and thus never goes back in time while machine is -live (even if user changes time or timezone changes, however it may be reset -whenever the machine is restarted). + This uses a monotonic clock and thus never goes back in time while machine is + live (even if user changes time or timezone changes, however it may be reset + whenever the machine is restarted). -Wraps ecore_time_get(). + Wraps ecore_time_get(). -@returns A number of seconds. -*/ + @returns A number of seconds. + */ static int _elua_seconds(lua_State *L) // Stack usage [-0, +1, -] { @@ -828,39 +831,39 @@ _elua_seconds(lua_State *L) // Stack usage [-0, +1, -] } /** -@page luaref -@subsubsection edje_version edje.version() + @page luaref + @subsubsection edje_version edje.version() -Retrieves the current edje version number. + Retrieves the current edje version number. -@returns A table with these fields: + @returns A table with these fields: - integer major: The edje version major number. - integer minor: The edje version minor number. -@since 1.2.0 -*/ + @since 1.2.0 + */ static int -_elua_version(lua_State *L) // Stack usage [-4, +5, em] +_elua_version(lua_State *L) // Stack usage [-4, +5, em] { _elua_ret(L, "%major %minor", EDJE_VERSION_MAJOR, EDJE_VERSION_MINOR); // Stack usage [-4, +5, em] - return 1; + return 1; } //------------- /** -@page luaref -@subsubsection edje_geom edje.geom() + @page luaref + @subsubsection edje_geom edje.geom() -Retrieves the position and size of the edje object that this lua group is in. + Retrieves the position and size of the edje object that this lua group is in. -@returns A table with these fields: + @returns A table with these fields: - integer x: The edjes X position. - integer y: The edjes Y position. - integer w: The edjes width. - integer h: The edjes height. -*/ + */ static int -_elua_objgeom(lua_State *L) // Stack usage [-10, +11, em] +_elua_objgeom(lua_State *L) // Stack usage [-10, +11, em] { Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e] _elua_ret(L, "%x %y %w %h", ed->x, ed->y, ed->w, ed->h); // Stack usage [-8, +9, em] @@ -868,90 +871,90 @@ _elua_objgeom(lua_State *L) // Stack usage [-10 } /** -@page luaref -@subsubsection edje_pos edje.pos() + @page luaref + @subsubsection edje_pos edje.pos() -Retrieves the position of the edje object that this lua group is in. + Retrieves the position of the edje object that this lua group is in. -@returns A table with these fields: + @returns A table with these fields: - integer x: The edjes X position. - integer y: The edjes Y position. -*/ + */ static int -_elua_objpos(lua_State *L) // Stack usage [-6, +7, em] +_elua_objpos(lua_State *L) // Stack usage [-6, +7, em] { Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e] - _elua_ret(L, "%x %y", ed->x, ed->y); // Stack usage [-4, +5, em] + _elua_ret(L, "%x %y", ed->x, ed->y); // Stack usage [-4, +5, em] return 1; } /** -@page luaref -@subsubsection edje_size edje.size() + @page luaref + @subsubsection edje_size edje.size() -Retrieves the size of the edje object that this lua group is in. + Retrieves the size of the edje object that this lua group is in. -@returns A table with these fields: + @returns A table with these fields: - integer w: The edjes width. - integer h: The edjes height. -*/ + */ static int -_elua_objsize(lua_State *L) // Stack usage [-6, +7, em] +_elua_objsize(lua_State *L) // Stack usage [-6, +7, em] { Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e] - _elua_ret(L, "%w %h", ed->w, ed->h); // Stack usage [-4, +5, em] + _elua_ret(L, "%w %h", ed->w, ed->h); // Stack usage [-4, +5, em] return 1; } //------------- /** -@page luaref -@subsubsection edje_emit edje.emit(signal, source) + @page luaref + @subsubsection edje_emit edje.emit(signal, source) -Emit a signal. + Emit a signal. -Wraps edje_object_signal_emit(). + Wraps edje_object_signal_emit(). -@param signal The signal string to send. -@param source The source string of the signal. + @param signal The signal string to send. + @param source The source string of the signal. -NOTE: The source string will have a name and a colon prepended to in when it is -delivered to things that are not this edje, like C and other edje groups. -If this edje is a top level edje, then it will be the name of the group (I think). -If this edje is swallowed into some other part, then it will be the name of the -part: + NOTE: The source string will have a name and a colon prepended to in when it is + delivered to things that are not this edje, like C and other edje groups. + If this edje is a top level edje, then it will be the name of the group (I think). + If this edje is swallowed into some other part, then it will be the name of the + part: group_name:source -FIXME: I actually have no idea what happens if it's swallowed into another lua -edje group. -*/ + FIXME: I actually have no idea what happens if it's swallowed into another lua + edje group. + */ static int -_elua_emit(lua_State *L) // Stack usage [-2, +2, ev] +_elua_emit(lua_State *L) // Stack usage [-2, +2, ev] { Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e] - const char *sig = luaL_checkstring(L, 1); // Stack usage [-0, +0, v] - const char *src = luaL_checkstring(L, 2); // Stack usage [-0, +0, v] + const char *sig = luaL_checkstring(L, 1); // Stack usage [-0, +0, v] + const char *src = luaL_checkstring(L, 2); // Stack usage [-0, +0, v] if ((!sig) || (!src)) return 0; _edje_emit(ed, sig, src); return 0; } /** -@page luaref -@subsubsection edje_message_send edje.messagesend(id, type, ...) + @page luaref + @subsubsection edje_message_send edje.messagesend(id, type, ...) -Send a message to this edje, and all it's child objects. + Send a message to this edje, and all it's child objects. -Wraps edje_object_message_send(). + Wraps edje_object_message_send(). -@param id An identification integer for the message. -@param type The type of message to send. -@param ... Zero or more things to send as part of the message, depending on the type. + @param id An identification integer for the message. + @param type The type of message to send. + @param ... Zero or more things to send as part of the message, depending on the type. -The type can be one of: + The type can be one of: - none: No msg. - sig: The msg is two strings (signal, source), sent as a signal. - str: The msg is a C string. @@ -965,14 +968,14 @@ The type can be one of: - strintset: The message is a C string and an array of C integers. - strfloatset: The message is a G string and an array of C floats. -For the array types, the lua caller passes a table. -*/ + For the array types, the lua caller passes a table. + */ static int _elua_messagesend(lua_State *L) // Stack usage [-2, +2, ev] plus [-2, +2] for every element if it's an array message. { Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e] - int id = luaL_checkinteger(L, 1); // Stack usage [-0, +0, v] - const char *type = luaL_checkstring(L, 2); // Stack usage [-0, +0, v] + int id = luaL_checkinteger(L, 1); // Stack usage [-0, +0, v] + const char *type = luaL_checkstring(L, 2); // Stack usage [-0, +0, v] if (!type) return 0; if (!strcmp(type, "none")) { @@ -980,14 +983,14 @@ _elua_messagesend(lua_State *L) // Stack usage [-2, +2, ev] plus [-2, +2] for e } else if (!strcmp(type, "sig")) { - const char *sig = luaL_checkstring(L, 3); // Stack usage [-0, +0, v] - const char *src = luaL_checkstring(L, 4); // Stack usage [-0, +0, v] + const char *sig = luaL_checkstring(L, 3); // Stack usage [-0, +0, v] + const char *src = luaL_checkstring(L, 4); // Stack usage [-0, +0, v] _edje_emit(ed, sig, src); } else if (!strcmp(type, "str")) { Edje_Message_String *emsg; - const char *str = luaL_checkstring(L, 3); // Stack usage [-0, +0, v] + const char *str = luaL_checkstring(L, 3); // Stack usage [-0, +0, v] emsg = alloca(sizeof(Edje_Message_String)); emsg->str = (char *)str; _edje_util_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_STRING, id, emsg); @@ -995,7 +998,7 @@ _elua_messagesend(lua_State *L) // Stack usage [-2, +2, ev] plus [-2, +2] for e else if (!strcmp(type, "int")) { Edje_Message_Int *emsg; - int val = luaL_checkinteger(L, 3); // Stack usage [-0, +0, v] + int val = luaL_checkinteger(L, 3); // Stack usage [-0, +0, v] emsg = alloca(sizeof(Edje_Message_Int)); emsg->val = val; _edje_util_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_INT, id, emsg); @@ -1003,7 +1006,7 @@ _elua_messagesend(lua_State *L) // Stack usage [-2, +2, ev] plus [-2, +2] for e else if (!strcmp(type, "float")) { Edje_Message_Float *emsg; - float val = luaL_checknumber(L, 3); // Stack usage [-0, +0, v] + float val = luaL_checknumber(L, 3); // Stack usage [-0, +0, v] emsg = alloca(sizeof(Edje_Message_Float)); emsg->val = val; _edje_util_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_FLOAT, id, emsg); @@ -1013,20 +1016,20 @@ _elua_messagesend(lua_State *L) // Stack usage [-2, +2, ev] plus [-2, +2] for e Edje_Message_String_Set *emsg; int i, n; const char *str; - luaL_checktype(L, 3, LUA_TTABLE); // Stack usage [-0, +0, v] + luaL_checktype(L, 3, LUA_TTABLE); // Stack usage [-0, +0, v] #if LUA_VERSION_NUM >= 502 - n = lua_rawlen(L, 3); // Stack usage [-0, +0, -] + n = lua_rawlen(L, 3); // Stack usage [-0, +0, -] #else - n = lua_objlen(L, 3); // Stack usage [-0, +0, -] + n = lua_objlen(L, 3); // Stack usage [-0, +0, -] #endif emsg = alloca(sizeof(Edje_Message_String_Set) + ((n - 1) * sizeof(char *))); emsg->count = n; - for (i = 1; i <= n; i ++) + for (i = 1; i <= n; i++) { - lua_pushinteger(L, i); // Stack usage [-0, +1, -] - lua_gettable(L, 3); // Stack usage [-1, +1, e] - str = lua_tostring(L, -1); // Stack usage [-0, +0, m] - lua_pop(L, 1); // Stack usage [-n, +0, -] + lua_pushinteger(L, i); // Stack usage [-0, +1, -] + lua_gettable(L, 3); // Stack usage [-1, +1, e] + str = lua_tostring(L, -1); // Stack usage [-0, +0, m] + lua_pop(L, 1); // Stack usage [-n, +0, -] emsg->str[i - 1] = (char *)str; } _edje_util_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_STRING_SET, id, emsg); @@ -1035,20 +1038,20 @@ _elua_messagesend(lua_State *L) // Stack usage [-2, +2, ev] plus [-2, +2] for e { Edje_Message_Int_Set *emsg; int i, n; - luaL_checktype(L, 3, LUA_TTABLE); // Stack usage [-0, +0, v] + luaL_checktype(L, 3, LUA_TTABLE); // Stack usage [-0, +0, v] #if LUA_VERSION_NUM >= 502 - n = lua_rawlen(L, 3); // Stack usage [-0, +0, -] + n = lua_rawlen(L, 3); // Stack usage [-0, +0, -] #else - n = lua_objlen(L, 3); // Stack usage [-0, +0, -] + n = lua_objlen(L, 3); // Stack usage [-0, +0, -] #endif emsg = alloca(sizeof(Edje_Message_Int_Set) + ((n - 1) * sizeof(int))); emsg->count = n; - for (i = 1; i <= n; i ++) + for (i = 1; i <= n; i++) { - lua_pushinteger(L, i); // Stack usage [-0, +1, -] - lua_gettable(L, 3); // Stack usage [-1, +1, e] - emsg->val[i - 1] = lua_tointeger(L, -1); // Stack usage [-0, +0, -] - lua_pop(L, 1); // Stack usage [-n, +0, -] + lua_pushinteger(L, i); // Stack usage [-0, +1, -] + lua_gettable(L, 3); // Stack usage [-1, +1, e] + emsg->val[i - 1] = lua_tointeger(L, -1); // Stack usage [-0, +0, -] + lua_pop(L, 1); // Stack usage [-n, +0, -] } _edje_util_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_INT_SET, id, emsg); } @@ -1056,62 +1059,62 @@ _elua_messagesend(lua_State *L) // Stack usage [-2, +2, ev] plus [-2, +2] for e { Edje_Message_Float_Set *emsg; int i, n; - luaL_checktype(L, 3, LUA_TTABLE); // Stack usage [-0, +0, v] + luaL_checktype(L, 3, LUA_TTABLE); // Stack usage [-0, +0, v] #if LUA_VERSION_NUM >= 502 - n = lua_rawlen(L, 3); // Stack usage [-0, +0, -] + n = lua_rawlen(L, 3); // Stack usage [-0, +0, -] #else - n = lua_objlen(L, 3); // Stack usage [-0, +0, -] + n = lua_objlen(L, 3); // Stack usage [-0, +0, -] #endif emsg = alloca(sizeof(Edje_Message_Float_Set) + ((n - 1) * sizeof(double))); emsg->count = n; - for (i = 1; i <= n; i ++) + for (i = 1; i <= n; i++) { - lua_pushinteger(L, i); // Stack usage [-0, +1, -] - lua_gettable(L, 3); // Stack usage [-1, +1, e] - emsg->val[i - 1] = lua_tonumber(L, -1); // Stack usage [-0, +0, -] - lua_pop(L, 1); // Stack usage [-n, +0, -] + lua_pushinteger(L, i); // Stack usage [-0, +1, -] + lua_gettable(L, 3); // Stack usage [-1, +1, e] + emsg->val[i - 1] = lua_tonumber(L, -1); // Stack usage [-0, +0, -] + lua_pop(L, 1); // Stack usage [-n, +0, -] } _edje_util_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_FLOAT_SET, id, emsg); } else if (!strcmp(type, "strint")) { Edje_Message_String_Int *emsg; - const char *str = luaL_checkstring(L, 3); // Stack usage [-0, +0, v] + const char *str = luaL_checkstring(L, 3); // Stack usage [-0, +0, v] emsg = alloca(sizeof(Edje_Message_String_Int)); emsg->str = (char *)str; - emsg->val = luaL_checkinteger(L, 4); // Stack usage [-0, +0, v] + emsg->val = luaL_checkinteger(L, 4); // Stack usage [-0, +0, v] _edje_util_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_STRING_INT, id, emsg); } else if (!strcmp(type, "strfloat")) { Edje_Message_String_Float *emsg; - const char *str = luaL_checkstring(L, 3); // Stack usage [-0, +0, v] + const char *str = luaL_checkstring(L, 3); // Stack usage [-0, +0, v] emsg = alloca(sizeof(Edje_Message_String_Float)); emsg->str = (char *)str; - emsg->val = luaL_checknumber(L, 4); // Stack usage [-0, +0, v] + emsg->val = luaL_checknumber(L, 4); // Stack usage [-0, +0, v] _edje_util_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_STRING_FLOAT, id, emsg); } else if (!strcmp(type, "strintset")) { Edje_Message_String_Int_Set *emsg; int i, n; - const char *str = luaL_checkstring(L, 3); // Stack usage [-0, +0, v] + const char *str = luaL_checkstring(L, 3); // Stack usage [-0, +0, v] if (!str) return 0; - luaL_checktype(L, 4, LUA_TTABLE); // Stack usage [-0, +0, v] + luaL_checktype(L, 4, LUA_TTABLE); // Stack usage [-0, +0, v] #if LUA_VERSION_NUM >= 502 - n = lua_rawlen(L, 4); // Stack usage [-0, +0, -] + n = lua_rawlen(L, 4); // Stack usage [-0, +0, -] #else - n = lua_objlen(L, 4); // Stack usage [-0, +0, -] + n = lua_objlen(L, 4); // Stack usage [-0, +0, -] #endif emsg = alloca(sizeof(Edje_Message_String_Int_Set) + ((n - 1) * sizeof(int))); emsg->str = (char *)str; emsg->count = n; - for (i = 1; i <= n; i ++) + for (i = 1; i <= n; i++) { - lua_pushinteger(L, i); // Stack usage [-0, +1, -] - lua_gettable(L, 4); // Stack usage [-1, +1, e] - emsg->val[i - 1] = lua_tointeger(L, -1); // Stack usage [-0, +0, -] - lua_pop(L, 1); // Stack usage [-n, +0, -] + lua_pushinteger(L, i); // Stack usage [-0, +1, -] + lua_gettable(L, 4); // Stack usage [-1, +1, e] + emsg->val[i - 1] = lua_tointeger(L, -1); // Stack usage [-0, +0, -] + lua_pop(L, 1); // Stack usage [-n, +0, -] } _edje_util_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_STRING_INT_SET, id, emsg); } @@ -1119,23 +1122,23 @@ _elua_messagesend(lua_State *L) // Stack usage [-2, +2, ev] plus [-2, +2] for e { Edje_Message_String_Float_Set *emsg; int i, n; - const char *str = luaL_checkstring(L, 3); // Stack usage [-0, +0, v] + const char *str = luaL_checkstring(L, 3); // Stack usage [-0, +0, v] if (!str) return 0; - luaL_checktype(L, 4, LUA_TTABLE); // Stack usage [-0, +0, v] + luaL_checktype(L, 4, LUA_TTABLE); // Stack usage [-0, +0, v] #if LUA_VERSION_NUM >= 502 - n = lua_rawlen(L, 4); // Stack usage [-0, +0, -] + n = lua_rawlen(L, 4); // Stack usage [-0, +0, -] #else n = lua_objlen(L, 4); #endif emsg = alloca(sizeof(Edje_Message_String_Float_Set) + ((n - 1) * sizeof(double))); emsg->str = (char *)str; emsg->count = n; - for (i = 1; i <= n; i ++) + for (i = 1; i <= n; i++) { - lua_pushinteger(L, i); // Stack usage [-0, +1, -] - lua_gettable(L, 4); // Stack usage [-1, +1, e] - emsg->val[i - 1] = lua_tonumber(L, -1); // Stack usage [-0, +0, -] - lua_pop(L, 1); // Stack usage [-n, +0, -] + lua_pushinteger(L, i); // Stack usage [-0, +1, -] + lua_gettable(L, 4); // Stack usage [-1, +1, e] + emsg->val[i - 1] = lua_tonumber(L, -1); // Stack usage [-0, +0, -] + lua_pop(L, 1); // Stack usage [-n, +0, -] } _edje_util_message_send(ed, EDJE_QUEUE_APP, EDJE_MESSAGE_STRING_FLOAT_SET, id, emsg); } @@ -1144,7 +1147,7 @@ _elua_messagesend(lua_State *L) // Stack usage [-2, +2, ev] plus [-2, +2] for e //------------- static Eina_Bool -_elua_animator_cb(void *data) // Stack usage [-2, +2, em] +_elua_animator_cb(void *data) // Stack usage [-2, +2, em] { Edje_Lua_Animator *ela = data; lua_State *L; @@ -1154,84 +1157,84 @@ _elua_animator_cb(void *data) // Stack usage [-2, L = ela->obj.ed->L; if (!L) return 0; /* This is not needed, pcalls don't longjmp(), that's why they are protected. - if (setjmp(panic_jmp) == 1) - { + if (setjmp(panic_jmp) == 1) + { LE("Animator callback panic"); _edje_lua2_error(L, err); // Stack usage [-0, +0, m] _elua_obj_free(L, (Edje_Lua_Obj *)ela); _elua_gc(L); // Stack usage [-0, +0, e] return 0; - } + } */ - lua_rawgeti(L, LUA_REGISTRYINDEX, ela->fn_ref); // Stack usage [-0, +1, -] - if ((err = lua_pcall(L, 0, 1, 0))) // Stack usage [-1, +1, -] + lua_rawgeti(L, LUA_REGISTRYINDEX, ela->fn_ref); // Stack usage [-0, +1, -] + if ((err = lua_pcall(L, 0, 1, 0))) // Stack usage [-1, +1, -] { - _edje_lua2_error(L, err); // Stack usage [-0, +0, m] + _edje_lua2_error(L, err); // Stack usage [-0, +0, m] _elua_obj_free(L, (Edje_Lua_Obj *)ela); - _elua_gc(L); // Stack usage [-0, +0, e] + _elua_gc(L); // Stack usage [-0, +0, e] return 0; } - ret = lua_toboolean(L, -1); // Stack usage [-0, +0, -] - lua_pop(L, 1); // Stack usage [-n, +0, -] + ret = lua_toboolean(L, -1); // Stack usage [-0, +0, -] + lua_pop(L, 1); // Stack usage [-n, +0, -] if (ret == 0) _elua_obj_free(L, (Edje_Lua_Obj *)ela); - _elua_gc(L); // Stack usage [-0, +0, e] + _elua_gc(L); // Stack usage [-0, +0, e] return ret; } static void -_elua_animator_free(void *obj) // Stack usage [-0, +0, -] +_elua_animator_free(void *obj) // Stack usage [-0, +0, -] { Edje_Lua_Animator *ela = obj; lua_State *L; if (!ela->obj.ed) return; L = ela->obj.ed->L; - luaL_unref(L, LUA_REGISTRYINDEX, ela->fn_ref); // Stack usage [-0, +0, -] - ela->fn_ref = 0; + luaL_unref(L, LUA_REGISTRYINDEX, ela->fn_ref); // Stack usage [-0, +0, -] + ela->fn_ref = 0; ecore_animator_del(ela->animator); ela->animator = NULL; } /** -@page luaref -@subsubsection edje_animator edje.animator(func) + @page luaref + @subsubsection edje_animator edje.animator(func) -This function adds an animator and returns its handle on success and NULL on -failure. The function func will be called every frame tick. Note that setting -the frame tick is not available as a lua function, so has to be done from C. -The default tick is 1/30 second. + This function adds an animator and returns its handle on success and NULL on + failure. The function func will be called every frame tick. Note that setting + the frame tick is not available as a lua function, so has to be done from C. + The default tick is 1/30 second. -When the animator func is called, it must return a value of either true or false. -If it returns true it will be called again at the next tick, or if it returns -false it will be deleted automatically making any references/handles for it -invalid. + When the animator func is called, it must return a value of either true or false. + If it returns true it will be called again at the next tick, or if it returns + false it will be deleted automatically making any references/handles for it + invalid. -Wraps ecore_animator_add(). + Wraps ecore_animator_add(). -@param func The function to call when the animator triggers. + @param func The function to call when the animator triggers. -@returns A userdata that is an ecore animator. -*/ + @returns A userdata that is an ecore animator. + */ static int -_elua_animator(lua_State *L) // Stack usage [-8, +9, emv] +_elua_animator(lua_State *L) // Stack usage [-8, +9, emv] { Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e] Edje_Lua_Animator *ela; - luaL_checkany(L, 1); // Stack usage [-0, +0, v] + luaL_checkany(L, 1); // Stack usage [-0, +0, v] // FIXME: Allow lua to set a data to be sent back with the callback. ela = (Edje_Lua_Animator *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Animator), _elua_ecore_animator_meta); - // Stack usage [-5, +6, m] + // Stack usage [-5, +6, m] ela->obj.free_func = _elua_animator_free; ela->animator = ecore_animator_add(_elua_animator_cb, ela); - lua_pushvalue(L, 1); // Stack usage [-0, +1, -] - ela->fn_ref = luaL_ref(L, LUA_REGISTRYINDEX); // Stack usage [-1, +0, m] - _elua_gc(L); // Stack usage [-0, +0, e] + lua_pushvalue(L, 1); // Stack usage [-0, +1, -] + ela->fn_ref = luaL_ref(L, LUA_REGISTRYINDEX); // Stack usage [-1, +0, m] + _elua_gc(L); // Stack usage [-0, +0, e] return 1; } static Eina_Bool -_elua_timer_cb(void *data) // Stack usage [-2, +2, em] +_elua_timer_cb(void *data) // Stack usage [-2, +2, em] { Edje_Lua_Timer *elt = data; lua_State *L; @@ -1241,84 +1244,84 @@ _elua_timer_cb(void *data) // Stack usage [-2, L = elt->obj.ed->L; if (!L) return 0; /* This is not needed, pcalls don't longjmp(), that's why they are protected. - if (setjmp(panic_jmp) == 1) - { + if (setjmp(panic_jmp) == 1) + { LE("Timer callback panic"); _edje_lua2_error(L, err); // Stack usage [-0, +0, m] _elua_obj_free(L, (Edje_Lua_Obj *)elt); _elua_gc(L); // Stack usage [-0, +0, e] return 0; - } - */ - lua_rawgeti(L, LUA_REGISTRYINDEX, elt->fn_ref); // Stack usage [-0, +1, -] - if ((err = lua_pcall(L, 0, 1, 0))) // Stack usage [-1, +1, -] + } + */ + lua_rawgeti(L, LUA_REGISTRYINDEX, elt->fn_ref); // Stack usage [-0, +1, -] + if ((err = lua_pcall(L, 0, 1, 0))) // Stack usage [-1, +1, -] { _edje_lua2_error(L, err); - _elua_obj_free(L, (Edje_Lua_Obj *)elt); // Stack usage [-0, +0, m] - _elua_gc(L); // Stack usage [-0, +0, e] + _elua_obj_free(L, (Edje_Lua_Obj *)elt); // Stack usage [-0, +0, m] + _elua_gc(L); // Stack usage [-0, +0, e] return 0; } - ret = lua_toboolean(L, -1); // Stack usage [-0, +0, -] - lua_pop(L, 1); // Stack usage [-n, +0, -] + ret = lua_toboolean(L, -1); // Stack usage [-0, +0, -] + lua_pop(L, 1); // Stack usage [-n, +0, -] if (ret == 0) _elua_obj_free(L, (Edje_Lua_Obj *)elt); - _elua_gc(L); // Stack usage [-0, +0, e] + _elua_gc(L); // Stack usage [-0, +0, e] return ret; } static void -_elua_timer_free(void *obj) // Stack usage [-0, +0, -] +_elua_timer_free(void *obj) // Stack usage [-0, +0, -] { Edje_Lua_Timer *elt = obj; lua_State *L; if (!elt->obj.ed) return; L = elt->obj.ed->L; - luaL_unref(L, LUA_REGISTRYINDEX, elt->fn_ref); // Stack usage [-0, +0, -] - elt->fn_ref = 0; + luaL_unref(L, LUA_REGISTRYINDEX, elt->fn_ref); // Stack usage [-0, +0, -] + elt->fn_ref = 0; ecore_timer_del(elt->timer); elt->timer = NULL; } /** -@page luaref -@subsubsection edje_timer edje.timer(tick, func) + @page luaref + @subsubsection edje_timer edje.timer(tick, func) -This function adds a timer and returns its handle on success and NULL on failure. -The function func will be called every tick seconds. + This function adds a timer and returns its handle on success and NULL on failure. + The function func will be called every tick seconds. -When the timer func is called, it must return a value of either true or false. -If it returns true, it will be called again at the next tick, or if it returns -false it will be deleted automatically making any references/handles for it -invalid. + When the timer func is called, it must return a value of either true or false. + If it returns true, it will be called again at the next tick, or if it returns + false it will be deleted automatically making any references/handles for it + invalid. -Wraps ecore_timer_add(). + Wraps ecore_timer_add(). -@param tick How often, in seconds, to call the function. -@param func The function to call when the timer triggers. + @param tick How often, in seconds, to call the function. + @param func The function to call when the timer triggers. -@returns A userdata that is an ecore timer. -*/ + @returns A userdata that is an ecore timer. + */ static int -_elua_timer(lua_State *L) // Stack usage [-8, +9, emv] +_elua_timer(lua_State *L) // Stack usage [-8, +9, emv] { Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e] Edje_Lua_Timer *elt; double val; - val = luaL_checknumber(L, 1); // Stack usage [-0, +0, v] - luaL_checkany(L, 2); // Stack usage [-0, +0, v] + val = luaL_checknumber(L, 1); // Stack usage [-0, +0, v] + luaL_checkany(L, 2); // Stack usage [-0, +0, v] elt = (Edje_Lua_Timer *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Timer), _elua_ecore_timer_meta); - // Stack usage [-5, +6, m] + // Stack usage [-5, +6, m] elt->obj.free_func = _elua_timer_free; elt->timer = ecore_timer_add(val, _elua_timer_cb, elt); - lua_pushvalue(L, 2); // Stack usage [-0, +1, -] - elt->fn_ref = luaL_ref(L, LUA_REGISTRYINDEX); // Stack usage [-1, +0, m] - _elua_gc(L); // Stack usage [-0, +0, e] + lua_pushvalue(L, 2); // Stack usage [-0, +1, -] + elt->fn_ref = luaL_ref(L, LUA_REGISTRYINDEX); // Stack usage [-1, +0, m] + _elua_gc(L); // Stack usage [-0, +0, e] return 1; } static Eina_Bool -_elua_transition_cb(void *data) // Stack usage [-3, +3, em] +_elua_transition_cb(void *data) // Stack usage [-3, +3, em] { Edje_Lua_Transition *elt = data; lua_State *L; @@ -1331,120 +1334,120 @@ _elua_transition_cb(void *data) // Stack usage [-3, t = (ecore_loop_time_get() - elt->start) / elt->transition; if (t > 1.0) t = 1.0; /* This is not needed, pcalls don't longjmp(), that's why they are protected. - if (setjmp(panic_jmp) == 1) - { + if (setjmp(panic_jmp) == 1) + { LE("Transition callback panic"); _edje_lua2_error(L, err); // Stack usage [-0, +0, m] _elua_obj_free(L, (Edje_Lua_Obj *)elt); _elua_gc(L); // Stack usage [-0, +0, e] return 0; - } - */ - lua_rawgeti(L, LUA_REGISTRYINDEX, elt->fn_ref); // Stack usage [-0, +1, -] - lua_pushnumber(L, t); // Stack usage [-0, +1, -] - if ((err = lua_pcall(L, 1, 1, 0))) // Stack usage [-2, +1, -] + } + */ + lua_rawgeti(L, LUA_REGISTRYINDEX, elt->fn_ref); // Stack usage [-0, +1, -] + lua_pushnumber(L, t); // Stack usage [-0, +1, -] + if ((err = lua_pcall(L, 1, 1, 0))) // Stack usage [-2, +1, -] { _edje_lua2_error(L, err); - _elua_obj_free(L, (Edje_Lua_Obj *)elt); // Stack usage [-0, +0, m] - _elua_gc(L); // Stack usage [-0, +0, e] + _elua_obj_free(L, (Edje_Lua_Obj *)elt); // Stack usage [-0, +0, m] + _elua_gc(L); // Stack usage [-0, +0, e] return 0; } - ret = lua_toboolean(L, -1); // Stack usage [-0, +0, -] - lua_pop(L, 1); // Stack usage [-n, +0, -] + ret = lua_toboolean(L, -1); // Stack usage [-0, +0, -] + lua_pop(L, 1); // Stack usage [-n, +0, -] if (t >= 1.0) ret = 0; if (ret == 0) _elua_obj_free(L, (Edje_Lua_Obj *)elt); - _elua_gc(L); // Stack usage [-0, +0, e] + _elua_gc(L); // Stack usage [-0, +0, e] return ret; } static void -_elua_transition_free(void *obj) // Stack usage [-0, +0, -] +_elua_transition_free(void *obj) // Stack usage [-0, +0, -] { Edje_Lua_Transition *elt = obj; lua_State *L; if (!elt->obj.ed) return; L = elt->obj.ed->L; - luaL_unref(L, LUA_REGISTRYINDEX, elt->fn_ref); // Stack usage [-0, +0, -] - elt->fn_ref = 0; + luaL_unref(L, LUA_REGISTRYINDEX, elt->fn_ref); // Stack usage [-0, +0, -] + elt->fn_ref = 0; ecore_animator_del(elt->animator); elt->animator = NULL; } /** -@page luaref -@subsubsection edje_transition edje.transition(div, func) + @page luaref + @subsubsection edje_transition edje.transition(div, func) -Just like edje.animator(), except that the callback function gets called with an -argument. The argument is the amount of time since the transition was created, -divided by the div parameter. + Just like edje.animator(), except that the callback function gets called with an + argument. The argument is the amount of time since the transition was created, + divided by the div parameter. -@param div A number to divide the time since creation by. -@param func The function to call when the transition triggers. + @param div A number to divide the time since creation by. + @param func The function to call when the transition triggers. -@returns A userdata that is a transition (ecore animator, plus other info). -*/ + @returns A userdata that is a transition (ecore animator, plus other info). + */ static int -_elua_transition(lua_State *L) // Stack usage [-8, +9, emv] +_elua_transition(lua_State *L) // Stack usage [-8, +9, emv] { Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e] Edje_Lua_Transition *elt; double val; - val = luaL_checknumber(L, 1); // Stack usage [-0, +0, v] - luaL_checkany(L, 2); // Stack usage [-0, +0, v] + val = luaL_checknumber(L, 1); // Stack usage [-0, +0, v] + luaL_checkany(L, 2); // Stack usage [-0, +0, v] elt = (Edje_Lua_Transition *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Transition), _elua_ecore_animator_meta); - // Stack usage [-5, +6, m] + // Stack usage [-5, +6, m] elt->obj.free_func = _elua_transition_free; elt->animator = ecore_animator_add(_elua_transition_cb, elt); if (val < 0.0000001) val = 0.0000001; elt->transition = val; elt->start = ecore_loop_time_get(); - lua_pushvalue(L, 2); // Stack usage [-0, +1, -] - elt->fn_ref = luaL_ref(L, LUA_REGISTRYINDEX); // Stack usage [-1, +0, m] - _elua_gc(L); // Stack usage [-0, +0, e] + lua_pushvalue(L, 2); // Stack usage [-0, +1, -] + elt->fn_ref = luaL_ref(L, LUA_REGISTRYINDEX); // Stack usage [-1, +0, m] + _elua_gc(L); // Stack usage [-0, +0, e] return 1; } //------------- /** -@page luaref -@subsubsection edje_colour_class edje.color_class(class, r, g, b, a) + @page luaref + @subsubsection edje_colour_class edje.color_class(class, r, g, b, a) -Gets, (and optionally sets) the colours for a color class. + Gets, (and optionally sets) the colours for a color class. -Wraps edje_object_color_class_set(). + Wraps edje_object_color_class_set(). -@param class A color class name. -@param r The new red value. -@param g The new green value. -@param b The new blue value. -@param a The new alpha value. + @param class A color class name. + @param r The new red value. + @param g The new green value. + @param b The new blue value. + @param a The new alpha value. -Note that the r, g, b, and a arguments are optional, without them this function -just queries the current values. The r, g, b, and a arguments can be separate -values, or named fields in a table. + Note that the r, g, b, and a arguments are optional, without them this function + just queries the current values. The r, g, b, and a arguments can be separate + values, or named fields in a table. -@return A table with these fields: + @return A table with these fields: - integer r: The red value. - integer g: The green value. - integer b: The blue value. - integer a: The alpha value. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_color_class(lua_State *L) // Stack usage [-(10|14), +(11|15), ?] +_elua_color_class(lua_State *L) // Stack usage [-(10|14), +(11|15), ?] { Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e] Edje_Color_Class *c_class; - const char *class = luaL_checkstring(L, 1); // Stack usage [-0, +0, v] + const char *class = luaL_checkstring(L, 1); // Stack usage [-0, +0, v] int r, g, b, a; if (!class) return 0; - if (_elua_scan_params(L, 2, "%r %g %b %a", &r, &g, &b, &a) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e] + if (_elua_scan_params(L, 2, "%r %g %b %a", &r, &g, &b, &a) > 0) // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e] + { _elua_color_fix(&r, &g, &b, &a); // This is the way that embryo does it - //edje_object_color_class_set(ed->obj, class, r, g, b, a, r, g, b, a, r, g, b, a); @@ -1459,39 +1462,39 @@ _elua_color_class(lua_State *L) // Stack usage [-(1 if (!c_class) return 0; _elua_ret(L, "%r %g %b %a", c_class->r, c_class->g, c_class->b, c_class->a); - // Stack usage [-8, +9, em] + // Stack usage [-8, +9, em] return 1; } /** -@page luaref -@subsubsection edje_text_class edje.text_class(class, font, size) + @page luaref + @subsubsection edje_text_class edje.text_class(class, font, size) -Gets, (and optionally sets) the details for a text class. + Gets, (and optionally sets) the details for a text class. -Wraps edje_object_text_class_set(). + Wraps edje_object_text_class_set(). -@param class A text class name. -@param font The new font name. -@param size The new font size. + @param class A text class name. + @param font The new font name. + @param size The new font size. -Note that the font and size arguments are optional, without them this function -just queries the current values. The font and size arguments can be separate -values, or named fields in a table. The font name can refer to a font in the -edje file, or an external font. + Note that the font and size arguments are optional, without them this function + just queries the current values. The font and size arguments can be separate + values, or named fields in a table. The font name can refer to a font in the + edje file, or an external font. -@return A table with these fields: + @return A table with these fields: - string font: The font name. - integer size: The font size. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_text_class(lua_State *L) // Stack usage [-(6|8), +(7|9), emv] +_elua_text_class(lua_State *L) // Stack usage [-(6|8), +(7|9), emv] { Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); // Stack usage [-2, +2, e] Edje_Text_Class *t_class; - const char *class = luaL_checkstring(L, 1); // Stack usage [-0, +0, v] + const char *class = luaL_checkstring(L, 1); // Stack usage [-0, +0, v] char *font = NULL; Evas_Font_Size size = 0; @@ -1500,14 +1503,14 @@ _elua_text_class(lua_State *L) // Stack usage [-(6 // Just like color_class above, this does things differently from embryo, // for the same reason. if (_elua_scan_params(L, 2, "$font %size", &font, &size) > 0) - // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] - edje_text_class_set(class, font, size); + // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] + edje_text_class_set(class, font, size); t_class = _edje_text_class_find(ed, class); if (!t_class) return 0; _elua_ret(L, "$font %size", t_class->font, t_class->size); - // Stack usage [-4, +5, em] + // Stack usage [-4, +5, em] return 1; } @@ -1523,11 +1526,11 @@ _elua_evas_obj_free(void *obj) } // Stack usage [-7, +8, em] -#define _ELUA_PLANT_EVAS_OBJECT(type, meta, free) \ - Edje *ed = (Edje *)_elua_table_ptr_get(L, _elua_key); \ - type *elo; \ - elo = (type *)_elua_obj_new(L, ed, sizeof(type), meta); \ - elo->obj.free_func = free; +#define _ELUA_PLANT_EVAS_OBJECT(type, meta, free) \ + Edje * ed = (Edje *)_elua_table_ptr_get(L, _elua_key); \ + type *elo; \ + elo = (type *)_elua_obj_new(L, ed, sizeof(type), meta); \ + elo->obj.free_func = free; // Stack usage [-2, +2, e] // Stack usage [-5, +6, m] @@ -1542,22 +1545,22 @@ _elua_polish_evas_object(Edje *ed, Edje_Lua_Evas_Object *elo) } /** -@page luaref -@subsubsection edje_edje edje.edje() + @page luaref + @subsubsection edje_edje edje.edje() -Create an edje object, and add it to the edje. + Create an edje object, and add it to the edje. -Wraps edje_object_add(). + Wraps edje_object_add(). -@returns A userdata that is an edje object. + @returns A userdata that is an edje object. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_edje(lua_State *L) // Stack usage [-7, +8, em] +_elua_edje(lua_State *L) // Stack usage [-7, +8, em] { _ELUA_PLANT_EVAS_OBJECT(Edje_Lua_Evas_Object, _elua_evas_edje_meta, _elua_evas_obj_free) - // Stack usage [-7, +8, em] + // Stack usage [-7, +8, em] elo->evas_obj = edje_object_add(evas_object_evas_get(ed->obj)); _edje_subobj_register(ed, elo->evas_obj); _elua_polish_evas_object(ed, elo); @@ -1565,44 +1568,44 @@ _elua_edje(lua_State *L) // Stack usage [-7, } /** -@page luaref -@subsubsection edje_image edje.image() + @page luaref + @subsubsection edje_image edje.image() -Create an evas image, and add it to the edje. + Create an evas image, and add it to the edje. -Wraps evas_object_image_add(). + Wraps evas_object_image_add(). -@returns A userdata that is an evas image. + @returns A userdata that is an evas image. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_image(lua_State *L) // Stack usage [-7, +8, em] +_elua_image(lua_State *L) // Stack usage [-7, +8, em] { _ELUA_PLANT_EVAS_OBJECT(Edje_Lua_Evas_Object, _elua_evas_image_meta, _elua_evas_obj_free) - // Stack usage [-7, +8, em] + // Stack usage [-7, +8, em] elo->evas_obj = evas_object_image_filled_add(evas_object_evas_get(ed->obj)); _elua_polish_evas_object(ed, elo); return 1; } /** -@page luaref -@subsubsection edje_line edje.line() + @page luaref + @subsubsection edje_line edje.line() -Create an evas line, and add it to the edje. + Create an evas line, and add it to the edje. -Wraps evas_object_line_add(). + Wraps evas_object_line_add(). -@returns A userdata that is an evas line. + @returns A userdata that is an evas line. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_line(lua_State *L) // Stack usage [-7, +8, em] +_elua_line(lua_State *L) // Stack usage [-7, +8, em] { _ELUA_PLANT_EVAS_OBJECT(Edje_Lua_Evas_Object, _elua_evas_line_meta, _elua_evas_obj_free) - // Stack usage [-7, +8, em] + // Stack usage [-7, +8, em] elo->evas_obj = evas_object_line_add(evas_object_evas_get(ed->obj)); _elua_polish_evas_object(ed, elo); return 1; @@ -1618,115 +1621,115 @@ _elua_map_free(void *obj) } /** -@page luaref -@subsubsection edje_map edje.map() + @page luaref + @subsubsection edje_map edje.map() -Create an evas map. + Create an evas map. -Wraps evas_map_new(). + Wraps evas_map_new(). -@returns A userdata that is an evas map. + @returns A userdata that is an evas map. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_map(lua_State *L) // Stack usage [-7, +8, emv] +_elua_map(lua_State *L) // Stack usage [-7, +8, emv] { _ELUA_PLANT_EVAS_OBJECT(Edje_Lua_Map, _elua_evas_map_meta, _elua_map_free) - // Stack usage [-7, +8, em] - elo->map = evas_map_new(luaL_checkinteger(L, 1)); // Stack usage [-0, +0, v] + // Stack usage [-7, +8, em] + elo->map = evas_map_new(luaL_checkinteger(L, 1)); // Stack usage [-0, +0, v] return 1; } /** -@page luaref -@subsubsection edje_polygon edje.polygon() + @page luaref + @subsubsection edje_polygon edje.polygon() -Create an evas polygon, and add it to the edje. + Create an evas polygon, and add it to the edje. -Wraps evas_object_polygon_add(). + Wraps evas_object_polygon_add(). -@returns A userdata that is an evas polygon. + @returns A userdata that is an evas polygon. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_polygon(lua_State *L) // Stack usage [-7, +8, em] +_elua_polygon(lua_State *L) // Stack usage [-7, +8, em] { _ELUA_PLANT_EVAS_OBJECT(Edje_Lua_Evas_Object, _elua_evas_polygon_meta, _elua_evas_obj_free) - // Stack usage [-7, +8, em] + // Stack usage [-7, +8, em] elo->evas_obj = evas_object_polygon_add(evas_object_evas_get(ed->obj)); _elua_polish_evas_object(ed, elo); return 1; } /** -@page luaref -@subsubsection edje_rect edje.rect() + @page luaref + @subsubsection edje_rect edje.rect() -Create an evas rectangle, and add it to the edje. + Create an evas rectangle, and add it to the edje. -Wraps evas_object_rectangle_add(). + Wraps evas_object_rectangle_add(). -@returns A userdata that is an evas rectangle. -*/ + @returns A userdata that is an evas rectangle. + */ static int -_elua_rect(lua_State *L) // Stack usage [-7, +8, em] +_elua_rect(lua_State *L) // Stack usage [-7, +8, em] { _ELUA_PLANT_EVAS_OBJECT(Edje_Lua_Evas_Object, _elua_evas_meta, _elua_evas_obj_free) - // Stack usage [-7, +8, em] + // Stack usage [-7, +8, em] elo->evas_obj = evas_object_rectangle_add(evas_object_evas_get(ed->obj)); _elua_polish_evas_object(ed, elo); return 1; } /** -@page luaref -@subsubsection edje_text edje.text() + @page luaref + @subsubsection edje_text edje.text() -Create an evas text object, and add it to the edje. + Create an evas text object, and add it to the edje. -Wraps evas_object_text_add(). + Wraps evas_object_text_add(). -@returns A userdata that is an evas text object. + @returns A userdata that is an evas text object. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_text(lua_State *L) // Stack usage [-7, +8, em] +_elua_text(lua_State *L) // Stack usage [-7, +8, em] { _ELUA_PLANT_EVAS_OBJECT(Edje_Lua_Evas_Object, _elua_evas_text_meta, _elua_evas_obj_free) - // Stack usage [-7, +8, em] + // Stack usage [-7, +8, em] elo->evas_obj = evas_object_text_add(evas_object_evas_get(ed->obj)); _elua_polish_evas_object(ed, elo); return 1; } /* XXX: disabled until there are enough textblock functions implemented to make it actually useful -_elua_textblock(lua_State *L) // Stack usage [-7, +8, em] -{ + _elua_textblock(lua_State *L) // Stack usage [-7, +8, em] + { _ELUA_PLANT_EVAS_OBJECT(Edje_Lua_Evas_Object, _elua_evas_textblock_meta, _elua_evas_obj_free) // Stack usage [-7, +8, em] elo->evas_obj = evas_object_textblock_add(evas_object_evas_get(ed->obj)); _elua_polish_evas_object(ed, elo); return 1; -} -*/ + } + */ //------------- //------------- /** -@page luaref -@subsection evas Evas class. + @page luaref + @subsection evas Evas class. -The lua evas class includes functions for dealing with evas objects. The evas -objects must have been previously created by lua using one of the lua evas -object creation functions from the lua edje class. + The lua evas class includes functions for dealing with evas objects. The evas + objects must have been previously created by lua using one of the lua evas + object creation functions from the lua edje class. -In the following, "evas_object" is a place holder for any lua variable that -holds a reference to an evas object. -*/ + In the following, "evas_object" is a place holder for any lua variable that + holds a reference to an evas object. + */ static int _elua_hide(lua_State *L); static int _elua_show(lua_State *L); @@ -1763,36 +1766,36 @@ static int _elua_obj_map_enable(lua_State *L); static const char *_elua_evas_api = "evas"; static const struct luaL_Reg _elua_evas_funcs [] = { - {"del", _elua_obj_del}, // generic del any object created for edje (evas objects, timers, animators, transitions... everything) + {"del", _elua_obj_del}, // generic del any object created for edje (evas objects, timers, animators, transitions... everything) - {"hide", _elua_hide}, // hide, return current visibility - {"show", _elua_show}, // show, return current visibility - {"visible", _elua_visible}, // get object visibility + {"hide", _elua_hide}, // hide, return current visibility + {"show", _elua_show}, // show, return current visibility + {"visible", _elua_visible}, // get object visibility - {"above", _elua_above}, // get object above or stack obj above given obj - {"below", _elua_below}, // get object below or stack obj below given obj - {"bottom", _elua_bottom}, // get bottom - {"lower", _elua_lower}, // lower to bottom - {"raise", _elua_raise}, // raise to top - {"top", _elua_top}, // get top + {"above", _elua_above}, // get object above or stack obj above given obj + {"below", _elua_below}, // get object below or stack obj below given obj + {"bottom", _elua_bottom}, // get bottom + {"lower", _elua_lower}, // lower to bottom + {"raise", _elua_raise}, // raise to top + {"top", _elua_top}, // get top - {"geom", _elua_geom}, // move and resize and return current geometry - {"move", _elua_move}, // move, return current position - {"pos", _elua_pos}, // move, return current position - {"resize", _elua_resize}, // resize, return current size - {"size", _elua_size}, // resize, return current size + {"geom", _elua_geom}, // move and resize and return current geometry + {"move", _elua_move}, // move, return current position + {"pos", _elua_pos}, // move, return current position + {"resize", _elua_resize}, // resize, return current size + {"size", _elua_size}, // resize, return current size - {"clip", _elua_clip}, // set clip obj, return clip object - {"clipees", _elua_clipees}, // get clip children - {"unclip", _elua_unclip}, // clear clip obj + {"clip", _elua_clip}, // set clip obj, return clip object + {"clipees", _elua_clipees}, // get clip children + {"unclip", _elua_unclip}, // clear clip obj - {"type", _elua_type}, // get object type + {"type", _elua_type}, // get object type - {"pass", _elua_pass}, // set pass events, get pass events - {"precise", _elua_precise}, // set precise inside flag, get precise - {"repeat", _elua_repeat}, // set repeat events, get repeat events + {"pass", _elua_pass}, // set pass events, get pass events + {"precise", _elua_precise}, // set precise inside flag, get precise + {"repeat", _elua_repeat}, // set repeat events, get repeat events - {"color", _elua_color}, // set color, return color + {"color", _elua_color}, // set color, return color // {"color_class", _elua_object_color_class}, // get or set object color class // FIXME: set callbacks (mouse down, up, blah blah blah) @@ -1803,25 +1806,25 @@ static const struct luaL_Reg _elua_evas_funcs [] = // FIXME: later - set render op, anti-alias, pointer mode (autograb, nograb) // map api here - {"map", _elua_obj_map}, - {"map_enable", _elua_obj_map_enable}, + {"map", _elua_obj_map}, + {"map_enable", _elua_obj_map_enable}, - {NULL, NULL} // end + {NULL, NULL} // end }; //------------- /** -@page luaref -@subsubsection evas_hide evas_object:hide() + @page luaref + @subsubsection evas_hide evas_object:hide() -Hides the object. + Hides the object. -Wraps evas_object_hide(). + Wraps evas_object_hide(). -@returns A boolean representing the current visibility. -*/ + @returns A boolean representing the current visibility. + */ static int -_elua_hide(lua_State *L) // Stack usage [-0, +1, -] +_elua_hide(lua_State *L) // Stack usage [-0, +1, -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; @@ -1832,17 +1835,17 @@ _elua_hide(lua_State *L) // Stack usage [ } /** -@page luaref -@subsubsection evas_show evas_object:show() + @page luaref + @subsubsection evas_show evas_object:show() -Shows the object. + Shows the object. -Wraps evas_object_show(). + Wraps evas_object_show(). -@returns A boolean representing the current visibility. -*/ + @returns A boolean representing the current visibility. + */ static int -_elua_show(lua_State *L) // Stack usage [-0, +1, -] +_elua_show(lua_State *L) // Stack usage [-0, +1, -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; @@ -1853,34 +1856,34 @@ _elua_show(lua_State *L) // Stack usage [ } /** -@page luaref -@subsubsection evas_visible evas_object:visible(visibility) + @page luaref + @subsubsection evas_visible evas_object:visible(visibility) -Gets (and optionally sets) this objects visibility. + Gets (and optionally sets) this objects visibility. -Wraps evas_object_hide() or evas_object_show(). + Wraps evas_object_hide() or evas_object_show(). -@param visibility The new visibility you want to change it to. + @param visibility The new visibility you want to change it to. -Note that the argument is optional, without it this function just queries the -current value. + Note that the argument is optional, without it this function just queries the + current value. -@returns A boolean representing the current visibility. -*/ + @returns A boolean representing the current visibility. + */ static int -_elua_visible(lua_State *L) // Stack usage [-0, +1, -] +_elua_visible(lua_State *L) // Stack usage [-0, +1, -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; int n; if (!_elua_isa(obj, _elua_evas_meta)) return 0; - n = lua_gettop(L); // Stack usage [-0, +0, -] + n = lua_gettop(L); // Stack usage [-0, +0, -] if (n == 2) { - if (lua_isboolean(L, 2)) // Stack usage [-0, +0, -] + if (lua_isboolean(L, 2)) // Stack usage [-0, +0, -] { if (lua_toboolean(L, 2)) evas_object_show(elo->evas_obj); - // Stack usage [-0, +0, -] + // Stack usage [-0, +0, -] else evas_object_hide(elo->evas_obj); } } @@ -1890,19 +1893,19 @@ _elua_visible(lua_State *L) // Stack usage [ //------------- /** -@page luaref -@subsubsection evas_above evas_object:above() + @page luaref + @subsubsection evas_above evas_object:above() -Figure out what, if anything, is above us. + Figure out what, if anything, is above us. -Wraps evas_object_above_get(). + Wraps evas_object_above_get(). -Note that it may not return any value. + Note that it may not return any value. -@returns A reference to the object above this one. -*/ + @returns A reference to the object above this one. + */ static int -_elua_above(lua_State *L) // Stack usage [-3, +4, -] +_elua_above(lua_State *L) // Stack usage [-3, +4, -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; @@ -1911,24 +1914,24 @@ _elua_above(lua_State *L) // Stack usage [ if (!_elua_isa(obj, _elua_evas_meta)) return 0; if (!(o = evas_object_above_get(elo->evas_obj))) return 0; if (!(elo2 = evas_object_data_get(o, ELO))) return 0; - _elua_ref_get(L, elo2); // Stack usage [-3, +4, -] + _elua_ref_get(L, elo2); // Stack usage [-3, +4, -] return 1; } /** -@page luaref -@subsubsection evas_below evas_object:below() + @page luaref + @subsubsection evas_below evas_object:below() -Figure out what, if anything, is below us. + Figure out what, if anything, is below us. -Wraps evas_object_below_get(). + Wraps evas_object_below_get(). -Note that it may not return any value. + Note that it may not return any value. -@returns A reference to the object below this one. -*/ + @returns A reference to the object below this one. + */ static int -_elua_below(lua_State *L) // Stack usage [-3, +4, -] +_elua_below(lua_State *L) // Stack usage [-3, +4, -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; @@ -1937,22 +1940,22 @@ _elua_below(lua_State *L) // Stack usage [ if (!_elua_isa(obj, _elua_evas_meta)) return 0; if (!(o = evas_object_below_get(elo->evas_obj))) return 0; if (!(elo2 = evas_object_data_get(o, ELO))) return 0; - _elua_ref_get(L, elo2); // Stack usage [-3, +4, -] + _elua_ref_get(L, elo2); // Stack usage [-3, +4, -] return 1; } /** -@page luaref -@subsubsection evas_bottom evas_object:bottom() + @page luaref + @subsubsection evas_bottom evas_object:bottom() -Figure out what, if anything, is waaaay below us. + Figure out what, if anything, is waaaay below us. -Note that it may not return any value. + Note that it may not return any value. -@returns A reference to the object at the bottom. -*/ + @returns A reference to the object at the bottom. + */ static int -_elua_bottom(lua_State *L) // Stack usage [-(0|3), +(0|4), -] +_elua_bottom(lua_State *L) // Stack usage [-(0|3), +(0|4), -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo2; @@ -1965,7 +1968,7 @@ _elua_bottom(lua_State *L) // Stack usage [ o = l->data; if ((elo2 = evas_object_data_get(o, ELO))) { - _elua_ref_get(L, elo2); // Stack usage [-3, +4, -] + _elua_ref_get(L, elo2); // Stack usage [-3, +4, -] return 1; } } @@ -1973,15 +1976,15 @@ _elua_bottom(lua_State *L) // Stack usage [ } /** -@page luaref -@subsubsection evas_lower evas_object:lower() + @page luaref + @subsubsection evas_lower evas_object:lower() -Lower this object to the bottom. + Lower this object to the bottom. -Wraps evas_object_lower(). -*/ + Wraps evas_object_lower(). + */ static int -_elua_lower(lua_State *L) // Stack usage [-0, +0, -] +_elua_lower(lua_State *L) // Stack usage [-0, +0, -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; @@ -1991,15 +1994,15 @@ _elua_lower(lua_State *L) // Stack usage [ } /** -@page luaref -@subsubsection evas_raise evas_object:raise() + @page luaref + @subsubsection evas_raise evas_object:raise() -Raise this object to the top. + Raise this object to the top. -Wraps evas_object_raise(). -*/ + Wraps evas_object_raise(). + */ static int -_elua_raise(lua_State *L) // Stack usage [-0, +0, -] +_elua_raise(lua_State *L) // Stack usage [-0, +0, -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; @@ -2009,17 +2012,17 @@ _elua_raise(lua_State *L) // Stack usage [ } /** -@page luaref -@subsubsection evas_top evas_object:top() + @page luaref + @subsubsection evas_top evas_object:top() -Figure out what, if anything, is waaaay above us. + Figure out what, if anything, is waaaay above us. -Note that it may not return any value. + Note that it may not return any value. -@returns A reference to the object at the top. -*/ + @returns A reference to the object at the top. + */ static int -_elua_top(lua_State *L) // Stack usage [-(0|3), +(0|4), -] +_elua_top(lua_State *L) // Stack usage [-(0|3), +(0|4), -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-(0, +0, -] Edje_Lua_Evas_Object *elo2; @@ -2033,7 +2036,7 @@ _elua_top(lua_State *L) // Stack usage [ o = l->data; if ((elo2 = evas_object_data_get(o, ELO))) { - _elua_ref_get(L, elo2); // Stack usage [-3, +4, -] + _elua_ref_get(L, elo2); // Stack usage [-3, +4, -] return 1; } } @@ -2042,30 +2045,30 @@ _elua_top(lua_State *L) // Stack usage [ //------------- /** -@page luaref -@subsubsection evas_geom evas_object:geom(x, y, w, h) + @page luaref + @subsubsection evas_geom evas_object:geom(x, y, w, h) -Gets (and optionally sets) this objects geometry. + Gets (and optionally sets) this objects geometry. -Wraps evas_object_move() and evas_object_resize. + Wraps evas_object_move() and evas_object_resize. -@param x The new X coordinate. -@param y The new Y coordinate. -@param w The new width. -@param h The new height. + @param x The new X coordinate. + @param y The new Y coordinate. + @param w The new width. + @param h The new height. -Note that the arguments are optional, without them this function just queries -the current values. The arguments can be separate values, or named fields in a -table. + Note that the arguments are optional, without them this function just queries + the current values. The arguments can be separate values, or named fields in a + table. -@return A table with these fields: + @return A table with these fields: - integer x: X coordinate. - integer x: Y coordinate. - integer w: Width. - integer w: Height. -*/ + */ static int -_elua_geom(lua_State *L) // Stack usage [-(8|12), +(9|13), em] +_elua_geom(lua_State *L) // Stack usage [-(8|12), +(9|13), em] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; @@ -2074,8 +2077,8 @@ _elua_geom(lua_State *L) // Stack usage [ if (!_elua_isa(obj, _elua_evas_meta)) return 0; evas_object_geometry_get(elo->evas_obj, &ox, &oy, &ow, &oh); - if (_elua_scan_params(L, 2, "%x %y %w %h", &x, &y, &w, &h) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e] + if (_elua_scan_params(L, 2, "%x %y %w %h", &x, &y, &w, &h) > 0) // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e] + { if ((x != (ox - obj->ed->x)) || (y != (oy - obj->ed->y))) { evas_object_move(elo->evas_obj, @@ -2091,31 +2094,31 @@ _elua_geom(lua_State *L) // Stack usage [ elo->y = oy - obj->ed->y; } _elua_ret(L, "%x %y %w %h", elo->x, elo->y, ow, oh); - // Stack usage [-8, +9, em] + // Stack usage [-8, +9, em] return 1; } /** -@page luaref -@subsubsection evas_move evas_object:move(x, y) + @page luaref + @subsubsection evas_move evas_object:move(x, y) -Gets (and optionally sets) this objects position. + Gets (and optionally sets) this objects position. -Wraps evas_object_move(). + Wraps evas_object_move(). -@param x The new X coordinate. -@param y The new Y coordinate. + @param x The new X coordinate. + @param y The new Y coordinate. -Note that the arguments are optional, without them this function just queries -the current values. The arguments can be separate values, or named fields in a -table. + Note that the arguments are optional, without them this function just queries + the current values. The arguments can be separate values, or named fields in a + table. -@return A table with these fields: + @return A table with these fields: - integer x: X coordinate. - integer x: Y coordinate. -*/ + */ static int -_elua_move(lua_State *L) // Stack usage [-(4|6), +(5|7), em] +_elua_move(lua_State *L) // Stack usage [-(4|6), +(5|7), em] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; @@ -2124,8 +2127,8 @@ _elua_move(lua_State *L) // Stack usage [ if (!_elua_isa(obj, _elua_evas_meta)) return 0; evas_object_geometry_get(elo->evas_obj, &ox, &oy, NULL, NULL); - if (_elua_scan_params(L, 2, "%x %y", &x, &y) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] + if (_elua_scan_params(L, 2, "%x %y", &x, &y) > 0) // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] + { if ((x != (ox - obj->ed->x)) || (y != (oy - obj->ed->y))) { evas_object_move(elo->evas_obj, @@ -2137,43 +2140,43 @@ _elua_move(lua_State *L) // Stack usage [ elo->y = oy - obj->ed->y; } _elua_ret(L, "%x %y", elo->x, elo->y); - // Stack usage [-4, +5, em] + // Stack usage [-4, +5, em] return 1; } /** -@page luaref -@subsubsection evas_pos evas_object:pos(x, y) + @page luaref + @subsubsection evas_pos evas_object:pos(x, y) -An alias for evas_object:move(). -*/ + An alias for evas_object:move(). + */ static int -_elua_pos(lua_State *L) // Stack usage [-(4|6), +(5|7), em] +_elua_pos(lua_State *L) // Stack usage [-(4|6), +(5|7), em] { return _elua_move(L); } /** -@page luaref -@subsubsection evas_resize evas_object:resize(w, h) + @page luaref + @subsubsection evas_resize evas_object:resize(w, h) -Gets (and optionally sets) this objects size. + Gets (and optionally sets) this objects size. -Wraps evas_object_resize(). + Wraps evas_object_resize(). -@param w The new width. -@param h The new height. + @param w The new width. + @param h The new height. -Note that the arguments are optional, without them this function just queries -the current values. The arguments can be separate values, or named fields in a -table. + Note that the arguments are optional, without them this function just queries + the current values. The arguments can be separate values, or named fields in a + table. -@return A table with these fields: + @return A table with these fields: - integer w: Width. - integer w: Height. -*/ + */ static int -_elua_resize(lua_State *L) // Stack usage [-(4|6), +(5|7), em] +_elua_resize(lua_State *L) // Stack usage [-(4|6), +(5|7), em] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; @@ -2182,8 +2185,8 @@ _elua_resize(lua_State *L) // Stack usage [ if (!_elua_isa(obj, _elua_evas_meta)) return 0; evas_object_geometry_get(elo->evas_obj, NULL, NULL, &ow, &oh); - if (_elua_scan_params(L, 2, "%w %h", &w, &h) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] + if (_elua_scan_params(L, 2, "%w %h", &w, &h) > 0) // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] + { if ((w != ow) || (h != oh)) { evas_object_resize(elo->evas_obj, w, h); @@ -2191,47 +2194,47 @@ _elua_resize(lua_State *L) // Stack usage [ } } _elua_ret(L, "%w %h", ow, oh); - // Stack usage [-4, +5, em] + // Stack usage [-4, +5, em] return 1; } /** -@page luaref -@subsubsection evas_size evas_object:size() + @page luaref + @subsubsection evas_size evas_object:size() -An alias for evas_object:resize(). -*/ + An alias for evas_object:resize(). + */ static int -_elua_size(lua_State *L) // Stack usage [-(4|6), +(5|7), em] +_elua_size(lua_State *L) // Stack usage [-(4|6), +(5|7), em] { return _elua_resize(L); } //------------- /** -@page luaref -@subsubsection evas_clip evas_object:clip(evas_object2) + @page luaref + @subsubsection evas_clip evas_object:clip(evas_object2) -Get (and optionally set) the object that clips this object. + Get (and optionally set) the object that clips this object. -Note that the argument is optional, without it this function just queries the -current value. + Note that the argument is optional, without it this function just queries the + current value. -Wraps evas_object_clip_set(). + Wraps evas_object_clip_set(). -@param evas_object2 A reference to the object to clip this object with. + @param evas_object2 A reference to the object to clip this object with. -@returns A reference to the object clipping this object, if any. -*/ + @returns A reference to the object clipping this object, if any. + */ static int -_elua_clip(lua_State *L) // Stack usage [-3, +4, -] +_elua_clip(lua_State *L) // Stack usage [-3, +4, -] { - Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] + Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo2, *elo = (Edje_Lua_Evas_Object *)obj; Evas_Object *o; int n; if (!_elua_isa(obj, _elua_evas_meta)) return 0; - n = lua_gettop(L); // Stack usage [-0, +0, -] + n = lua_gettop(L); // Stack usage [-0, +0, -] if (n == 2) { Edje_Lua_Obj *obj2 = (Edje_Lua_Obj *)lua_touserdata(L, 2); // Stack usage [-0, +0, -] @@ -2242,23 +2245,23 @@ _elua_clip(lua_State *L) // Stack usa o = evas_object_clip_get(elo->evas_obj); if (!o) return 0; if (!(elo2 = evas_object_data_get(o, ELO))) return 0; - _elua_ref_get(L, elo2); // Stack usage [-3, +4, -] + _elua_ref_get(L, elo2); // Stack usage [-3, +4, -] return 1; } /** -@page luaref -@subsubsection evas_clipees evas_object:clipees() + @page luaref + @subsubsection evas_clipees evas_object:clipees() -Gets the list of objects this objects clips. + Gets the list of objects this objects clips. -Wraps evas_object_clipees_get(). + Wraps evas_object_clipees_get(). -@return A table, that holds all the objects this clips, if any, + @return A table, that holds all the objects this clips, if any, otherwise an empty table. -*/ + */ static int -_elua_clipees(lua_State *L) // Stack usage [-0, +1, me] plus [-5, +5] for each clipee. +_elua_clipees(lua_State *L) // Stack usage [-0, +1, me] plus [-5, +5] for each clipee. { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo2, *elo = (Edje_Lua_Evas_Object *)obj; @@ -2267,28 +2270,28 @@ _elua_clipees(lua_State *L) // Stack usage [ int n = 0; if (!_elua_isa(obj, _elua_evas_meta)) return 0; list = (Eina_List *)evas_object_clipees_get(elo->evas_obj); - lua_newtable(L); // Stack usage [-0, +1, m] + lua_newtable(L); // Stack usage [-0, +1, m] EINA_LIST_FOREACH(list, l, o) { if (!(elo2 = evas_object_data_get(o, ELO))) continue; - lua_pushinteger(L, n + 1); // Stack usage [-0, +1, -] - _elua_ref_get(L, elo2); // Stack usage [-3, +4, -] - lua_settable(L, -3); // Stack usage [-2, +0, e] + lua_pushinteger(L, n + 1); // Stack usage [-0, +1, -] + _elua_ref_get(L, elo2); // Stack usage [-3, +4, -] + lua_settable(L, -3); // Stack usage [-2, +0, e] n++; } return 1; } /** -@page luaref -@subsubsection evas_unclip evas_object:unclip() + @page luaref + @subsubsection evas_unclip evas_object:unclip() -Remove any clipping on this object. + Remove any clipping on this object. -Wraps evas_object_clip_unset(). -*/ + Wraps evas_object_clip_unset(). + */ static int -_elua_unclip(lua_State *L) // Stack usage [-0, +0, -] +_elua_unclip(lua_State *L) // Stack usage [-0, +0, -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; @@ -2299,18 +2302,18 @@ _elua_unclip(lua_State *L) // Stack usage [ //------------- /** -@page luaref -@subsubsection evas_type evas_object:type() + @page luaref + @subsubsection evas_type evas_object:type() -Get the type of this object. See the documentation of the evas_object_type_get() -C function for details. + Get the type of this object. See the documentation of the evas_object_type_get() + C function for details. -Wraps evas_object_type_get(). + Wraps evas_object_type_get(). -@return A string with this objects type in it. -*/ + @return A string with this objects type in it. + */ static int -_elua_type(lua_State *L) // Stack usage [-0, +1, m] +_elua_type(lua_State *L) // Stack usage [-0, +1, m] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; @@ -2318,179 +2321,179 @@ _elua_type(lua_State *L) // Stack usage [ if (!_elua_isa(obj, _elua_evas_meta)) return 0; t = evas_object_type_get(elo->evas_obj); if (!t) return 0; - lua_pushstring(L, t); // Stack usage [-0, +1, m] + lua_pushstring(L, t); // Stack usage [-0, +1, m] return 1; } //------------- /** -@page luaref -@subsubsection evas_pass evas_object:pass(pass) + @page luaref + @subsubsection evas_pass evas_object:pass(pass) -Get (and optionally set) whether this object ignores events, passing them to the -next object underneath it. + Get (and optionally set) whether this object ignores events, passing them to the + next object underneath it. -Wraps evas_object_pass_events_set(). + Wraps evas_object_pass_events_set(). -@param pass A boolean saying if this object passes events. + @param pass A boolean saying if this object passes events. -Note that the argument is optional, without it this function just queries the -current value. + Note that the argument is optional, without it this function just queries the + current value. -@return A boolean saying if this object passes events. -*/ + @return A boolean saying if this object passes events. + */ static int -_elua_pass(lua_State *L) // Stack usage [-0, +1, -] +_elua_pass(lua_State *L) // Stack usage [-0, +1, -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; int n; if (!_elua_isa(obj, _elua_evas_meta)) return 0; - n = lua_gettop(L); // Stack usage [-0, +0, -] + n = lua_gettop(L); // Stack usage [-0, +0, -] if (n == 2) { - if (lua_isboolean(L, 2)) // Stack usage [-0, +0, -] + if (lua_isboolean(L, 2)) // Stack usage [-0, +0, -] { evas_object_pass_events_set(elo->evas_obj, lua_toboolean(L, 2)); - // Stack usage [-0, +0, -] + // Stack usage [-0, +0, -] } } lua_pushboolean(L, evas_object_pass_events_get(elo->evas_obj)); - // Stack usage [-0, +1, -] + // Stack usage [-0, +1, -] return 1; } /** -@page luaref -@subsubsection evas_precise evas_object:precise(precise) + @page luaref + @subsubsection evas_precise evas_object:precise(precise) -Get (and optionally set) whether to use precise (usually expensive) point -collision detection for this object. + Get (and optionally set) whether to use precise (usually expensive) point + collision detection for this object. -Wraps evas_object_precise_is_inside_set(). + Wraps evas_object_precise_is_inside_set(). -@param precise A boolean saying if this object is precisely detected. + @param precise A boolean saying if this object is precisely detected. -Note that the argument is optional, without it this function just queries the -current value. + Note that the argument is optional, without it this function just queries the + current value. -@return A boolean saying if this object is precisely detected. -*/ + @return A boolean saying if this object is precisely detected. + */ static int -_elua_precise(lua_State *L) // Stack usage [-0, +1, -] +_elua_precise(lua_State *L) // Stack usage [-0, +1, -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; int n; if (!_elua_isa(obj, _elua_evas_meta)) return 0; - n = lua_gettop(L); // Stack usage [-0, +0, -] + n = lua_gettop(L); // Stack usage [-0, +0, -] if (n == 2) { - if (lua_isboolean(L, 2)) // Stack usage [-0, +0, -] + if (lua_isboolean(L, 2)) // Stack usage [-0, +0, -] { evas_object_precise_is_inside_set(elo->evas_obj, lua_toboolean(L, 2)); - // Stack usage [-0, +0, -] + // Stack usage [-0, +0, -] } } lua_pushboolean(L, evas_object_precise_is_inside_get(elo->evas_obj)); - // Stack usage [-0, +1, -] + // Stack usage [-0, +1, -] return 1; } /** -@page luaref -@subsubsection evas_repeat evas_object:repeat(repeat) + @page luaref + @subsubsection evas_repeat evas_object:repeat(repeat) -Get (and optionally set) whether this object repeats events. + Get (and optionally set) whether this object repeats events. -Wraps evas_object_repeat_events_set(). + Wraps evas_object_repeat_events_set(). -@param repeat A boolean saying if this object repeats events to lower objects. + @param repeat A boolean saying if this object repeats events to lower objects. -Note that the argument is optional, without it this function just queries the -current value. + Note that the argument is optional, without it this function just queries the + current value. -@return A boolean saying if this object repeats events. -*/ + @return A boolean saying if this object repeats events. + */ static int -_elua_repeat(lua_State *L) // Stack usage [-0, +1, -] +_elua_repeat(lua_State *L) // Stack usage [-0, +1, -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; int n; if (!_elua_isa(obj, _elua_evas_meta)) return 0; - n = lua_gettop(L); // Stack usage [-0, +0, -] + n = lua_gettop(L); // Stack usage [-0, +0, -] if (n == 2) { - if (lua_isboolean(L, 2)) // Stack usage [-0, +0, -] + if (lua_isboolean(L, 2)) // Stack usage [-0, +0, -] { evas_object_repeat_events_set(elo->evas_obj, lua_toboolean(L, 2)); - // Stack usage [-0, +0, -] + // Stack usage [-0, +0, -] } } lua_pushboolean(L, evas_object_repeat_events_get(elo->evas_obj)); - // Stack usage [-0, +1, -] + // Stack usage [-0, +1, -] return 1; } //------------- /** -@page luaref -@subsubsection evas_colour evas_object:color(r, g, b, a) + @page luaref + @subsubsection evas_colour evas_object:color(r, g, b, a) -Gets (and optionally sets) this objects colour. + Gets (and optionally sets) this objects colour. -Wraps evas_object_color_set(). + Wraps evas_object_color_set(). -@param r The new red value. -@param g The new green value. -@param b The new blue value. -@param a The new alpha value. + @param r The new red value. + @param g The new green value. + @param b The new blue value. + @param a The new alpha value. -Note that the arguments are optional, without them this function just queries -the current values. The arguments can be separate values, or named fields in a -table. + Note that the arguments are optional, without them this function just queries + the current values. The arguments can be separate values, or named fields in a + table. -@return A table with these fields: + @return A table with these fields: - integer r: The red value. - integer g: The green value. - integer b: The blue value. - integer a: The alpha value. -*/ + */ static int -_elua_color(lua_State *L) // Stack usage [-(8|12), +(9|13), em] +_elua_color(lua_State *L) // Stack usage [-(8|12), +(9|13), em] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; int r, g, b, a; if (!_elua_isa(obj, _elua_evas_meta)) return 0; - if (_elua_scan_params(L, 2, "%r %g %b %a", &r, &g, &b, &a) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e] + if (_elua_scan_params(L, 2, "%r %g %b %a", &r, &g, &b, &a) > 0) // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e] + { _elua_color_fix(&r, &g, &b, &a); evas_object_color_set(elo->evas_obj, r, g, b, a); } evas_object_color_get(elo->evas_obj, &r, &g, &b, &a); _elua_ret(L, "%r %g %b %a", r, g, b, a); - // Stack usage [-8, +9, em] + // Stack usage [-8, +9, em] return 1; } //------------- /** -@page luaref -@subsubsection evas_map evas_object:map(map) + @page luaref + @subsubsection evas_map evas_object:map(map) -Attach a map to this object. + Attach a map to this object. -Wraps evas_object_map_set(). + Wraps evas_object_map_set(). -@param map The map to attach. + @param map The map to attach. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_obj_map(lua_State *L) // Stack usage [-0, +0, -] +_elua_obj_map(lua_State *L) // Stack usage [-0, +0, -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; @@ -2505,93 +2508,93 @@ _elua_obj_map(lua_State *L) // Stack usage [ } /** -@page luaref -@subsubsection evas_map_enable evas_object:map_enable(enable) + @page luaref + @subsubsection evas_map_enable evas_object:map_enable(enable) -Enable or disable the map attached to this object. + Enable or disable the map attached to this object. -Wraps evas_object_map_enable_set(). + Wraps evas_object_map_enable_set(). -@param enable A booleon that controls if the attached map is enabled or not. + @param enable A booleon that controls if the attached map is enabled or not. -@return A boolean reflecting the map enabled status of this object. + @return A boolean reflecting the map enabled status of this object. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_obj_map_enable(lua_State *L) // Stack usage [-0, +1, -] +_elua_obj_map_enable(lua_State *L) // Stack usage [-0, +1, -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; int n; if (!_elua_isa(obj, _elua_evas_meta)) return 0; - n = lua_gettop(L); // Stack usage [-0, +0, -] + n = lua_gettop(L); // Stack usage [-0, +0, -] if (n == 2) { evas_object_map_enable_set(elo->evas_obj, lua_toboolean(L, 2)); - // Stack usage [-0, +0, -] + // Stack usage [-0, +0, -] } lua_pushboolean(L, evas_object_map_enable_get(elo->evas_obj)); - // Stack usage [-0, +1, -] + // Stack usage [-0, +1, -] return 1; } //------------- //------------- /** -@page luaref -@subsection ecore_animator Ecore animator class. + @page luaref + @subsection ecore_animator Ecore animator class. -The lua ecore animator class includes functions for dealing with ecore animator objects. -The ecore animator objects must have been previously created by lua using the lua -edje object creation function edje.animator() or edje.transition(). + The lua ecore animator class includes functions for dealing with ecore animator objects. + The ecore animator objects must have been previously created by lua using the lua + edje object creation function edje.animator() or edje.transition(). -In the following, "animator_object" is a place holder for any lua variable that -holds a reference to an ecore animator object. -*/ + In the following, "animator_object" is a place holder for any lua variable that + holds a reference to an ecore animator object. + */ static const char *_elua_ecore_animator_api = "ecore_animator"; static const struct luaL_Reg _elua_ecore_animator_funcs [] = { - {NULL, NULL} // end + {NULL, NULL} // end }; //------------- //------------- /** -@page luaref -@subsection ecore_timer Ecore timer class. + @page luaref + @subsection ecore_timer Ecore timer class. -The lua ecore timer class includes functions for dealing with ecore timer objects. -The ecore timer objects must have been previously created by lua using the lua -edje object creation function edje.timer(). + The lua ecore timer class includes functions for dealing with ecore timer objects. + The ecore timer objects must have been previously created by lua using the lua + edje object creation function edje.timer(). -In the following, "timer_object" is a place holder for any lua variable that -holds a reference to an ecore timer object. -*/ + In the following, "timer_object" is a place holder for any lua variable that + holds a reference to an ecore timer object. + */ static const char *_elua_ecore_timer_api = "ecore_timer"; static const struct luaL_Reg _elua_ecore_timer_funcs [] = { - {NULL, NULL} // end + {NULL, NULL} // end }; //------------- //------------- /** -@page luaref -@subsection evas_edje Evas edje class. + @page luaref + @subsection evas_edje Evas edje class. -The lua evas edje class includes functions for dealing with evas edje objects. -The evas edje objects must have been previously created by lua using the lua -edje object creation function edje.edje(). + The lua evas edje class includes functions for dealing with evas edje objects. + The evas edje objects must have been previously created by lua using the lua + edje object creation function edje.edje(). -In the following, "edje_object" is a place holder for any lua variable that -holds a reference to an evas edje object. NOT the edje class specified earlier -though. + In the following, "edje_object" is a place holder for any lua variable that + holds a reference to an evas edje object. NOT the edje class specified earlier + though. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int _elua_edje_file(lua_State *L); @@ -2599,48 +2602,48 @@ static const char *_elua_evas_edje_api = "evas_edje"; static const char *_elua_evas_edje_parent = "evas_edje_parent"; static const struct luaL_Reg _elua_evas_edje_funcs [] = { - {"file", _elua_edje_file}, // get or set edje file and group + {"file", _elua_edje_file}, // get or set edje file and group - {NULL, NULL} // end + {NULL, NULL} // end }; /** -@page luaref -@subsubsection edje_file edje_object:file(file, group) + @page luaref + @subsubsection edje_file edje_object:file(file, group) -Load an edje group into this edje object. + Load an edje group into this edje object. -Wraps edje_object_file_set(). + Wraps edje_object_file_set(). -@param file An edje file name (ignored, sandboxed to the file this lua script is in). -@param group The group within the edje file to be loaded. + @param file An edje file name (ignored, sandboxed to the file this lua script is in). + @param group The group within the edje file to be loaded. -Note that the arguments are optional, without them this function just queries -the current values. The arguments can be separate values, or named fields in a -table. The file argument is optional, and ignored anyway. + Note that the arguments are optional, without them this function just queries + the current values. The arguments can be separate values, or named fields in a + table. The file argument is optional, and ignored anyway. -@return A table with these fields: + @return A table with these fields: - string file: The name of the edje file this edje's group is loaded from. - string group: The name of the group this edje is loaded from. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_edje_file(lua_State *L) // Stack usage [-(4|6), +(5|7), em] +_elua_edje_file(lua_State *L) // Stack usage [-(4|6), +(5|7), em] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; const char *file = NULL, *group = NULL; - int n = lua_gettop(L); // Stack usage [-0, +0, -] + int n = lua_gettop(L); // Stack usage [-0, +0, -] if (!_elua_isa(obj, _elua_evas_edje_meta)) return 0; n = _elua_scan_params(L, 2, "$file $group", &file, &group); - // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] + // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] if (0 >= n) { - file = (char *) obj->ed->file->path; - group = (char *) lua_tostring(L, 2); // Stack usage [-0, +0, m] + file = (char *)obj->ed->file->path; + group = (char *)lua_tostring(L, 2); // Stack usage [-0, +0, m] n = 2; } @@ -2648,47 +2651,56 @@ _elua_edje_file(lua_State *L) // Stack usage [ { // Sandbox lua - Only allow access to groups within the same file. // By the simple expedient of completely ignoring what file was requested. - file = (char *) obj->ed->file->path; + file = (char *)obj->ed->file->path; if (!edje_object_file_set(elo->evas_obj, file, group)) { Edje_Load_Error err = edje_object_load_error_get(elo->evas_obj); switch (err) { - case EDJE_LOAD_ERROR_NONE : LE("Edje file loading errer %s %s - no error happened, but you should not see this.", obj->ed->file->path, group); break; - case EDJE_LOAD_ERROR_GENERIC : LE("Edje file loading errer %s %s - generic error.", obj->ed->file->path, group); break; - case EDJE_LOAD_ERROR_DOES_NOT_EXIST : LE("Edje file loading errer %s %s - file does not exist.", obj->ed->file->path, group); break; - case EDJE_LOAD_ERROR_PERMISSION_DENIED : LE("Edje file loading errer %s %s - permission denied reading the file.", obj->ed->file->path, group); break; - case EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED : LE("Edje file loading errer %s %s - resource allocation failed.", obj->ed->file->path, group); break; - case EDJE_LOAD_ERROR_CORRUPT_FILE : LE("Edje file loading errer %s %s - corrupt file.", obj->ed->file->path, group); break; - case EDJE_LOAD_ERROR_UNKNOWN_FORMAT : LE("Edje file loading errer %s %s - unknown file format.", obj->ed->file->path, group); break; - case EDJE_LOAD_ERROR_INCOMPATIBLE_FILE : LE("Edje file loading errer %s %s - incompatible file.", obj->ed->file->path, group); break; - case EDJE_LOAD_ERROR_UNKNOWN_COLLECTION : LE("Edje file loading errer %s %s - unknown group.", obj->ed->file->path, group); break; - case EDJE_LOAD_ERROR_RECURSIVE_REFERENCE : LE("Edje file loading errer %s %s - recursive reference in group.", obj->ed->file->path, group); break; + case EDJE_LOAD_ERROR_NONE: LE("Edje file loading errer %s %s - no error happened, but you should not see this.", obj->ed->file->path, group); break; + + case EDJE_LOAD_ERROR_GENERIC: LE("Edje file loading errer %s %s - generic error.", obj->ed->file->path, group); break; + + case EDJE_LOAD_ERROR_DOES_NOT_EXIST: LE("Edje file loading errer %s %s - file does not exist.", obj->ed->file->path, group); break; + + case EDJE_LOAD_ERROR_PERMISSION_DENIED: LE("Edje file loading errer %s %s - permission denied reading the file.", obj->ed->file->path, group); break; + + case EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED: LE("Edje file loading errer %s %s - resource allocation failed.", obj->ed->file->path, group); break; + + case EDJE_LOAD_ERROR_CORRUPT_FILE: LE("Edje file loading errer %s %s - corrupt file.", obj->ed->file->path, group); break; + + case EDJE_LOAD_ERROR_UNKNOWN_FORMAT: LE("Edje file loading errer %s %s - unknown file format.", obj->ed->file->path, group); break; + + case EDJE_LOAD_ERROR_INCOMPATIBLE_FILE: LE("Edje file loading errer %s %s - incompatible file.", obj->ed->file->path, group); break; + + case EDJE_LOAD_ERROR_UNKNOWN_COLLECTION: LE("Edje file loading errer %s %s - unknown group.", obj->ed->file->path, group); break; + + case EDJE_LOAD_ERROR_RECURSIVE_REFERENCE: LE("Edje file loading errer %s %s - recursive reference in group.", obj->ed->file->path, group); break; } } } edje_object_file_get(elo->evas_obj, &file, &group); _elua_ret(L, "$file $group", file, group); - // Stack usage [-4, +5, em] + // Stack usage [-4, +5, em] return 1; } //------------- //------------- /** -@page luaref -@subsection evas_image Evas image class. + @page luaref + @subsection evas_image Evas image class. -The lua evas image class includes functions for dealing with evas image objects. -The evas image objects must have been previously created by lua using the lua -image object creation function edje.image(). + The lua evas image class includes functions for dealing with evas image objects. + The evas image objects must have been previously created by lua using the lua + image object creation function edje.image(). -In the following, "image_object" is a place holder for any lua variable that -holds a reference to an evas image object. + In the following, "image_object" is a place holder for any lua variable that + holds a reference to an evas image object. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int _elua_image_fill(lua_State *L); static int _elua_image_filled(lua_State *L); @@ -2698,41 +2710,41 @@ static const char *_elua_evas_image_api = "evas_image"; static const char *_elua_evas_image_parent = "evas_image_parent"; static const struct luaL_Reg _elua_evas_image_funcs [] = { - {"fill", _elua_image_fill}, // get or set the fill parameters - {"filled", _elua_image_filled}, // get or set the filled state (overrides fill()) - {"image", _elua_image_image}, // get or set image + {"fill", _elua_image_fill}, // get or set the fill parameters + {"filled", _elua_image_filled}, // get or set the filled state (overrides fill()) + {"image", _elua_image_image}, // get or set image - {NULL, NULL} // end + {NULL, NULL} // end }; /** -@page luaref -@subsubsection image_fill image_object:fill(x, y, w, h) + @page luaref + @subsubsection image_fill image_object:fill(x, y, w, h) -Gets (and optionally sets) how to fill this image's drawing rectangle given the -(real) image bound to it. + Gets (and optionally sets) how to fill this image's drawing rectangle given the + (real) image bound to it. -Wraps evas_object_image_fill_set(). + Wraps evas_object_image_fill_set(). -@param x The x coordinate (from the top left corner of the bound image) to start drawing from. -@param y The y coordinate (from the top left corner of the bound image) to start drawing from. -@param w The width the bound image will be displayed at. -@param h The height the bound image will be displayed at. + @param x The x coordinate (from the top left corner of the bound image) to start drawing from. + @param y The y coordinate (from the top left corner of the bound image) to start drawing from. + @param w The width the bound image will be displayed at. + @param h The height the bound image will be displayed at. -Note that the arguments are optional, without them this function just queries -the current values. The arguments can be separate values, or named fields in a -table. + Note that the arguments are optional, without them this function just queries + the current values. The arguments can be separate values, or named fields in a + table. -@return A table with these fields: + @return A table with these fields: - integer x: The x coordinate (from the top left corner of the bound image) to start drawing from. - integer y: The y coordinate (from the top left corner of the bound image) to start drawing from. - integer w: The width the bound image will be displayed at. - integer h: The height the bound image will be displayed at. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_image_fill(lua_State *L) // Stack usage [-(8|12), +(9|13), em] +_elua_image_fill(lua_State *L) // Stack usage [-(8|12), +(9|13), em] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; @@ -2740,35 +2752,35 @@ _elua_image_fill(lua_State *L) // Stack usage [ if (!_elua_isa(obj, _elua_evas_image_meta)) return 0; - if (_elua_scan_params(L, 2, "%x %y %w %h", &x, &y, &w, &h) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e] + if (_elua_scan_params(L, 2, "%x %y %w %h", &x, &y, &w, &h) > 0) // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e] + { evas_object_image_fill_set(elo->evas_obj, x, y, w, h); } evas_object_image_fill_get(elo->evas_obj, &x, &y, &w, &h); _elua_ret(L, "%x %y %w %h", x, y, w, h); - // Stack usage [-8, +9, em] + // Stack usage [-8, +9, em] return 1; } /** -@page luaref -@subsubsection image_filled image_object:filled(filled) + @page luaref + @subsubsection image_filled image_object:filled(filled) -Get (and optionally set) whether this image fills the object. + Get (and optionally set) whether this image fills the object. -Wraps evas_object_image_filled_set(). + Wraps evas_object_image_filled_set(). -@param filled A boolean saying if this image fills the object. + @param filled A boolean saying if this image fills the object. -Note that the argument is optional, without it this function just queries the -current value. + Note that the argument is optional, without it this function just queries the + current value. -@return A boolean saying if this image fills the object. + @return A boolean saying if this image fills the object. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_image_filled(lua_State *L) // Stack usage [-0, +0, -] +_elua_image_filled(lua_State *L) // Stack usage [-0, +0, -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; @@ -2776,40 +2788,40 @@ _elua_image_filled(lua_State *L) // Stack usage [ if (!_elua_isa(obj, _elua_evas_image_meta)) return 0; - n = lua_gettop(L); // Stack usage [-0, +0, -] + n = lua_gettop(L); // Stack usage [-0, +0, -] if (n == 2) { evas_object_image_filled_set(elo->evas_obj, lua_toboolean(L, 2)); - // Stack usage [-0, +0, -] + // Stack usage [-0, +0, -] } lua_pushboolean(L, evas_object_image_filled_get(elo->evas_obj)); - // Stack usage [-0, +0, -] + // Stack usage [-0, +0, -] return 1; } /** -@page luaref -@subsubsection image_image image_object:image(file, key) + @page luaref + @subsubsection image_image image_object:image(file, key) -Load an image into this edje object. + Load an image into this edje object. -Wraps evas_object_image_file_set(). + Wraps evas_object_image_file_set(). -@param file An edje file name (ignored, sandboxed to the file this lua script is in). -@param group The name of an image. + @param file An edje file name (ignored, sandboxed to the file this lua script is in). + @param group The name of an image. -Note that the arguments are optional, without them this function just queries -the current values. The arguments can be separate values, or named fields in a -table. The file argument is optional, and ignored anyway. + Note that the arguments are optional, without them this function just queries + the current values. The arguments can be separate values, or named fields in a + table. The file argument is optional, and ignored anyway. -@return A table with these fields: + @return A table with these fields: - string file: The name of the edje file the image is loaded from. - string key: The name of the image within the edje file. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_image_image(lua_State *L) // Stack usage [-(4|6), +(5|7), em] +_elua_image_image(lua_State *L) // Stack usage [-(4|6), +(5|7), em] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; @@ -2819,80 +2831,80 @@ _elua_image_image(lua_State *L) // Stack usage [ if (!_elua_isa(obj, _elua_evas_image_meta)) return 0; n = _elua_scan_params(L, 2, "$file $key", &file, &key); - // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] + // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] if (0 >= n) { - file = (char *) obj->ed->file->path; - key = (char *) lua_tostring(L, 2); // Stack usage [-0, +0, m] + file = (char *)obj->ed->file->path; + key = (char *)lua_tostring(L, 2); // Stack usage [-0, +0, m] n = 2; } if (1 < n) { if (obj->ed->file->image_dir) - { - Edje_Image_Directory_Entry *de; - unsigned int i; - char *name; + { + Edje_Image_Directory_Entry *de; + unsigned int i; + char *name; - /* Image name */ - if ((name = strrchr(key, '/'))) name++; - else name = (char *)key; + /* Image name */ + if ((name = strrchr(key, '/'))) name++; + else name = (char *)key; - /* Loop through image directory to find if image exists */ - for (i = 0; i < obj->ed->file->image_dir->entries_count; ++i) - { - de = obj->ed->file->image_dir->entries + i; + /* Loop through image directory to find if image exists */ + for (i = 0; i < obj->ed->file->image_dir->entries_count; ++i) + { + de = obj->ed->file->image_dir->entries + i; - if (de->entry) - { - if (strcmp(name, de->entry) == 0) - { - char buf[32]; + if (de->entry) + { + if (strcmp(name, de->entry) == 0) + { + char buf[32]; - id = i; - // This is copied from _edje_image_recalc_apply()), dunno if it provides any benefit over sprintf(). - /* Replace snprint("edje/images/%i") == memcpy + itoa */ + id = i; + // This is copied from _edje_image_recalc_apply()), dunno if it provides any benefit over sprintf(). + /* Replace snprint("edje/images/%i") == memcpy + itoa */ #define IMAGES "edje/images/" - memcpy(buf, IMAGES, strlen(IMAGES)); - eina_convert_itoa(id, buf + strlen(IMAGES)); /* No need to check length as 2³² need only 10 characters. */ - evas_object_image_file_set(elo->evas_obj, obj->ed->file->path, buf); - break; - } - } - } - } + memcpy(buf, IMAGES, strlen(IMAGES)); + eina_convert_itoa(id, buf + strlen(IMAGES)); /* No need to check length as 2³² need only 10 characters. */ + evas_object_image_file_set(elo->evas_obj, obj->ed->file->path, buf); + break; + } + } + } + } if (-1 == id) { LE("Image %s not found in our edje file.", key); /* Sandbox lua - Only allow access to images within the same edje file. I'm not so sure we need this level of sandboxing though. So leaving it here, just in case. - LI("Image %s not found in our edje file, trying external image file %s.", key, file); - evas_object_image_file_set(elo->evas_obj, file, key); - */ + LI("Image %s not found in our edje file, trying external image file %s.", key, file); + evas_object_image_file_set(elo->evas_obj, file, key); + */ } } evas_object_image_file_get(elo->evas_obj, &file, &key); _elua_ret(L, "$file $key", file, key); - // Stack usage [-4, +5, em] + // Stack usage [-4, +5, em] return 1; } //------------- //------------- /** -@page luaref -@subsection evas_line Evas line class. + @page luaref + @subsection evas_line Evas line class. -The lua evas line class includes functions for dealing with evas line objects. -The evas line objects must have been previously created by lua using the lua -line object creation function edje.line(). + The lua evas line class includes functions for dealing with evas line objects. + The evas line objects must have been previously created by lua using the lua + line object creation function edje.line(). -In the following, "line_object" is a place holder for any lua variable that -holds a reference to an evas line object. + In the following, "line_object" is a place holder for any lua variable that + holds a reference to an evas line object. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int _elua_line_xy(lua_State *L); @@ -2900,37 +2912,38 @@ static const char *_elua_evas_line_api = "evas_line"; static const char *_elua_evas_line_parent = "evas_line_parent"; static const struct luaL_Reg _elua_evas_line_funcs [] = { - {"xy", _elua_line_xy}, // get or set line coords + {"xy", _elua_line_xy}, // get or set line coords - {NULL, NULL} // end + {NULL, NULL} // end }; /** -@page luaref -@subsubsection line_xy line_object:xy(x1, y1, x2, y2) + @page luaref + @subsubsection line_xy line_object:xy(x1, y1, x2, y2) -Sets the end points of this line. + Sets the end points of this line. -Wraps evas_object_line_xy_set(). + Wraps evas_object_line_xy_set(). -@param x1 The X coordinate of the first line end. -@param y1 The Y coordinate of the first line end. -@param x2 The X coordinate of the other line end. -@param y2 The Y coordinate of the other line end. + @param x1 The X coordinate of the first line end. + @param y1 The Y coordinate of the first line end. + @param x2 The X coordinate of the other line end. + @param y2 The Y coordinate of the other line end. -Note that the arguments are optional, without them this function just queries -the current values. The arguments can be separate values, or named fields in a -table. + Note that the arguments are optional, without them this function just queries + the current values. The arguments can be separate values, or named fields in a + table. -@return A table with these fields: + @return A table with these fields: - integer x1: The X coordinate of the first line end. - integer y1: The Y coordinate of the first line end. - integer x2: The X coordinate of the other line end. - integer y2: The Y coordinate of the other line end. -@since 1.1.0 -*/ -static int _elua_line_xy(lua_State *L) // Stack usage [-(8|12), +(9|13), em] + @since 1.1.0 + */ +static int +_elua_line_xy(lua_State *L) // Stack usage [-(8|12), +(9|13), em] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; @@ -2938,33 +2951,33 @@ static int _elua_line_xy(lua_State *L) // Stack usage [ if (!_elua_isa(obj, _elua_evas_line_meta)) return 0; - if (_elua_scan_params(L, 2, "%x1 %y1 %x2 %y2", &x1, &y1, &x2, &y2) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e] + if (_elua_scan_params(L, 2, "%x1 %y1 %x2 %y2", &x1, &y1, &x2, &y2) > 0) // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e] + { evas_object_line_xy_set(elo->evas_obj, x1, y1, x2, y2); } evas_object_line_xy_get(elo->evas_obj, &x1, &y1, &x2, &y2); _elua_ret(L, "%x1 %y1 %x2 %y2", x1, y1, x2, y2); - // Stack usage [-8, +9, em] + // Stack usage [-8, +9, em] return 1; } //------------- //------------- /** -@page luaref -@subsection evas_object_map Evas map class. + @page luaref + @subsection evas_object_map Evas map class. -The lua evas map class includes functions for dealing with evas map objects. -The evas map objects must have been previously created by lua using the lua -map object creation function edje.map(). The evas map system is complex, rather -than repeat the copious documentation here, please refer to the evas map -documentation. It has pictures and everything. B-) + The lua evas map class includes functions for dealing with evas map objects. + The evas map objects must have been previously created by lua using the lua + map object creation function edje.map(). The evas map system is complex, rather + than repeat the copious documentation here, please refer to the evas map + documentation. It has pictures and everything. B-) -In the following, "map_object" is a place holder for any lua variable that -holds a reference to an evas map object. + In the following, "map_object" is a place holder for any lua variable that + holds a reference to an evas map object. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int _elua_map_alpha(lua_State *L); static int _elua_map_clockwise(lua_State *L); @@ -2982,43 +2995,43 @@ static int _elua_map_zoom(lua_State *L); static const char *_elua_evas_map_api = "evas_map"; static const struct luaL_Reg _elua_evas_map_funcs [] = { - {"alpha", _elua_map_alpha}, + {"alpha", _elua_map_alpha}, // {"dup", _elua_map_dup}, // not sure of proper api for this. - {"clockwise", _elua_map_clockwise}, - {"color", _elua_map_colour}, - {"coord", _elua_map_coord}, - {"lighting", _elua_map_lighting}, - {"perspective", _elua_map_perspective}, - {"populate", _elua_map_populate}, - {"rotate", _elua_map_rotate}, - {"rotate3d", _elua_map_rotate3d}, + {"clockwise", _elua_map_clockwise}, + {"color", _elua_map_colour}, + {"coord", _elua_map_coord}, + {"lighting", _elua_map_lighting}, + {"perspective", _elua_map_perspective}, + {"populate", _elua_map_populate}, + {"rotate", _elua_map_rotate}, + {"rotate3d", _elua_map_rotate3d}, // {"size", _elua_map_size}, // not sure of proper API for this - {"smooth", _elua_map_smooth}, - {"uv", _elua_map_uv}, - {"zoom", _elua_map_zoom}, + {"smooth", _elua_map_smooth}, + {"uv", _elua_map_uv}, + {"zoom", _elua_map_zoom}, - {NULL, NULL} // end + {NULL, NULL} // end }; /** -@page luaref -@subsubsection map_alpha map_object:alpha(alpha) + @page luaref + @subsubsection map_alpha map_object:alpha(alpha) -Get (and optionally set) the maps alpha mode. + Get (and optionally set) the maps alpha mode. -Wraps evas_map_alpha_set(). + Wraps evas_map_alpha_set(). -@param alpha The alpha mode. + @param alpha The alpha mode. -Note that the argument is optional, without it this function just queries the -current value. + Note that the argument is optional, without it this function just queries the + current value. -@return A boolean reflecting the alpha mode. + @return A boolean reflecting the alpha mode. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_map_alpha(lua_State *L) // Stack usage [-0, +1, -] +_elua_map_alpha(lua_State *L) // Stack usage [-0, +1, -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Map *elm = (Edje_Lua_Map *)obj; @@ -3026,30 +3039,30 @@ _elua_map_alpha(lua_State *L) // Stack usage [ if (!_elua_isa(obj, _elua_evas_map_meta)) return 0; - n = lua_gettop(L); // Stack usage [-0, +0, -] + n = lua_gettop(L); // Stack usage [-0, +0, -] if (n == 2) { evas_map_alpha_set(elm->map, lua_toboolean(L, 2)); - // Stack usage [-0, +0, -] + // Stack usage [-0, +0, -] } - lua_pushboolean(L, evas_map_alpha_get(elm->map)); // Stack usage [-0, +1, -] + lua_pushboolean(L, evas_map_alpha_get(elm->map)); // Stack usage [-0, +1, -] return 1; } /** -@page luaref -@subsubsection map_clockwise map_object:clockwise() + @page luaref + @subsubsection map_clockwise map_object:clockwise() -Get the maps clockwise state. + Get the maps clockwise state. -Wraps evas_map_util_clockwise_get(). + Wraps evas_map_util_clockwise_get(). -@return A boolean reflecting if the map is clockwise or not. + @return A boolean reflecting if the map is clockwise or not. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_map_clockwise(lua_State *L) // Stack usage [-0, +1, -] +_elua_map_clockwise(lua_State *L) // Stack usage [-0, +1, -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Map *elm = (Edje_Lua_Map *)obj; @@ -3061,36 +3074,36 @@ _elua_map_clockwise(lua_State *L) // Stack usage [ } /** -@page luaref -@subsubsection map_colour map_object:colour(index, r, g, b, a) + @page luaref + @subsubsection map_colour map_object:colour(index, r, g, b, a) -Gets or sets colour information for the map. There are two variations, with or -without the index. With the index parameter it gets (and optionally sets) the -colour of the point the index refers to, without it sets the colour for the -entire map. + Gets or sets colour information for the map. There are two variations, with or + without the index. With the index parameter it gets (and optionally sets) the + colour of the point the index refers to, without it sets the colour for the + entire map. -Wraps evas_map_point_color_set() or evas_map_util_points_color_set() + Wraps evas_map_point_color_set() or evas_map_util_points_color_set() -@param index Which point to change the colour of. -@param r The new red value. -@param g The new green value. -@param b The new blue value. -@param a The new alpha value. + @param index Which point to change the colour of. + @param r The new red value. + @param g The new green value. + @param b The new blue value. + @param a The new alpha value. -Note that the arguments are optional, without them this function just queries -the current values. The colour arguments can be separate values, or named -fields in a table. + Note that the arguments are optional, without them this function just queries + the current values. The colour arguments can be separate values, or named + fields in a table. -@return A table with these fields: + @return A table with these fields: - integer r: The red value. - integer g: The green value. - integer b: The blue value. - integer a: The alpha value. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_map_colour(lua_State *L) // Stack usage [-(8|12), +(9|13), em] +_elua_map_colour(lua_State *L) // Stack usage [-(8|12), +(9|13), em] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Map *elm = (Edje_Lua_Map *)obj; @@ -3098,63 +3111,63 @@ _elua_map_colour(lua_State *L) // Stack usage [ int n; if (!_elua_isa(obj, _elua_evas_map_meta)) return 0; - n = lua_gettop(L); // Stack usage [-0, +0, -] + n = lua_gettop(L); // Stack usage [-0, +0, -] switch (n) - { - case 5 : - { - if (_elua_scan_params(L, 2, "%r %g %b %a", &r, &g, &b, &a) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e] - evas_map_util_points_color_set(elm->map, r, g, b, a); - } - break; - } + { + case 5: + { + if (_elua_scan_params(L, 2, "%r %g %b %a", &r, &g, &b, &a) > 0) // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e] + { + evas_map_util_points_color_set(elm->map, r, g, b, a); + } + break; + } - case 1 : - case 6 : - { - if (_elua_scan_params(L, 3, "%r %g %b %a", &r, &g, &b, &a) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e] - evas_map_point_color_set(elm->map, lua_tointeger(L, 2), r, g, b, a); - // Stack usage [-0, +0, -] - } - evas_map_point_color_get(elm->map, lua_tointeger(L, 2), &r, &g, &b, &a); - // Stack usage [-0, +0, -] - _elua_ret(L, "%r %g %b %a", r, g, b, a); - // Stack usage [-8, +9, em] - return 1; - } - } + case 1: + case 6: + { + if (_elua_scan_params(L, 3, "%r %g %b %a", &r, &g, &b, &a) > 0) // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e] + { + evas_map_point_color_set(elm->map, lua_tointeger(L, 2), r, g, b, a); + // Stack usage [-0, +0, -] + } + evas_map_point_color_get(elm->map, lua_tointeger(L, 2), &r, &g, &b, &a); + // Stack usage [-0, +0, -] + _elua_ret(L, "%r %g %b %a", r, g, b, a); + // Stack usage [-8, +9, em] + return 1; + } + } return 0; } /** -@page luaref -@subsubsection map_coord map_object:coord(index, x, y, z) + @page luaref + @subsubsection map_coord map_object:coord(index, x, y, z) -Gets (and optionally sets) the 3D coordinates of a point on the map. + Gets (and optionally sets) the 3D coordinates of a point on the map. -Wraps evas_map_point_coord_set(). + Wraps evas_map_point_coord_set(). -@param x The x coordinate of the point. -@param y The y coordinate of the point. -@param z The z coordinate of the point. + @param x The x coordinate of the point. + @param y The y coordinate of the point. + @param z The z coordinate of the point. -Note that the arguments are optional, without them this function just queries -the current values. The coordinate arguments can be separate values, or named -fields in a table. + Note that the arguments are optional, without them this function just queries + the current values. The coordinate arguments can be separate values, or named + fields in a table. -@return A table with these fields: + @return A table with these fields: - integer x: The x coordinate of the point. - integer y: The y coordinate of the point. - integer z: The z coordinate of the point. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_map_coord(lua_State *L) // Stack usage [-(6|9), +(7|10), em] +_elua_map_coord(lua_State *L) // Stack usage [-(6|9), +(7|10), em] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Map *elm = (Edje_Lua_Map *)obj; @@ -3162,43 +3175,43 @@ _elua_map_coord(lua_State *L) // Stack usage [ int n; if (!_elua_isa(obj, _elua_evas_map_meta)) return 0; - n = lua_gettop(L); // Stack usage [-0, +0, -] + n = lua_gettop(L); // Stack usage [-0, +0, -] if (2 > n) return 0; - if (_elua_scan_params(L, 2, "%x %y %z", &x, &y, &z) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-3, +3, e] + if (_elua_scan_params(L, 2, "%x %y %z", &x, &y, &z) > 0) // Stack usage [-0, +0, m] unless it's in a table [-3, +3, e] + { evas_map_point_coord_set(elm->map, lua_tointeger(L, 2), x, y, z); - // Stack usage [-0, +0, -] + // Stack usage [-0, +0, -] } evas_map_point_coord_get(elm->map, lua_tointeger(L, 2), &x, &y, &z); - // Stack usage [-0, +0, -] + // Stack usage [-0, +0, -] _elua_ret(L, "%x %y %z", x, y, z); - // Stack usage [-6, +7, em] + // Stack usage [-6, +7, em] return 1; } /** -@page luaref -@subsubsection map_lighting map_object:lighting(x, y, z, r, g, b, ar, ag, ab) + @page luaref + @subsubsection map_lighting map_object:lighting(x, y, z, r, g, b, ar, ag, ab) -Set the 3D lights for the map. The three triplets can be tables. + Set the 3D lights for the map. The three triplets can be tables. -Wraps evas_map_util_3d_lighting(). + Wraps evas_map_util_3d_lighting(). -@param x The x coordinate of the light point. -@param y The y coordinate of the light point. -@param z The z coordinate of the light point. -@param r The new red value of the light point. -@param g The new green value of the light point. -@param b The new blue value of the light point. -@param ar The new red value of the ambient light. -@param ag The new green value of the ambient light. -@param ab The new blue value of the ambient light. + @param x The x coordinate of the light point. + @param y The y coordinate of the light point. + @param z The z coordinate of the light point. + @param r The new red value of the light point. + @param g The new green value of the light point. + @param b The new blue value of the light point. + @param ar The new red value of the ambient light. + @param ag The new green value of the ambient light. + @param ab The new blue value of the ambient light. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_map_lighting(lua_State *L) // Stack usage [-(0|9), +(0|9), e] +_elua_map_lighting(lua_State *L) // Stack usage [-(0|9), +(0|9), e] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Map *elm = (Edje_Lua_Map *)obj; @@ -3209,35 +3222,35 @@ _elua_map_lighting(lua_State *L) // Stack usage [ if (!_elua_isa(obj, _elua_evas_map_meta)) return 0; if ((n = _elua_scan_params(L, 2, "%x %y %z", &x, &y, &z)) > 0) - // Stack usage [-0, +0, m] unless it's in a table [-3, +3, e] + // Stack usage [-0, +0, m] unless it's in a table [-3, +3, e] if (n += _elua_scan_params(L, 2 + n, "%r %g %b", &r, &g, &b) > 0) - // Stack usage [-0, +0, m] unless it's in a table [-3, +3, e] - if (_elua_scan_params(L, 2 + n, "%r %g %b", &r1, &g1, &b1) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-3, +3, e] - evas_map_util_3d_lighting(elm->map, x, y, z, r, g, b, r1, g1, b1); - } + // Stack usage [-0, +0, m] unless it's in a table [-3, +3, e] + if (_elua_scan_params(L, 2 + n, "%r %g %b", &r1, &g1, &b1) > 0) // Stack usage [-0, +0, m] unless it's in a table [-3, +3, e] + { + evas_map_util_3d_lighting(elm->map, x, y, z, r, g, b, r1, g1, b1); + } return 0; } /** -@page luaref -@subsubsection map_perspective map_object:perspective(x, y, z, f) + @page luaref + @subsubsection map_perspective map_object:perspective(x, y, z, f) -Apply a perspective transform to the map. + Apply a perspective transform to the map. -Wraps evas_map_util_3d_perspective(). + Wraps evas_map_util_3d_perspective(). -The arguments can be separate values, or named fields in a table. + The arguments can be separate values, or named fields in a table. -@param x The perspective distance X coordinate -@param y The perspective distance Y coordinate -@param z The "0" z plane value -@param f The focal distance + @param x The perspective distance X coordinate + @param y The perspective distance Y coordinate + @param z The "0" z plane value + @param f The focal distance -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_map_perspective(lua_State *L) // Stack usage [-(0|4), +(0|4), e] +_elua_map_perspective(lua_State *L) // Stack usage [-(0|4), +(0|4), e] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Map *elm = (Edje_Lua_Map *)obj; @@ -3245,105 +3258,105 @@ _elua_map_perspective(lua_State *L) // Stack usage [ if (!_elua_isa(obj, _elua_evas_map_meta)) return 0; - if (_elua_scan_params(L, 2, "%x %y %z %f", &x, &y, &z, &f) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e] + if (_elua_scan_params(L, 2, "%x %y %z %f", &x, &y, &z, &f) > 0) // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e] + { evas_map_util_3d_perspective(elm->map, x, y, z, f); } return 0; } /** -@page luaref -@subsubsection map_populate map_object:populate(...) + @page luaref + @subsubsection map_populate map_object:populate(...) -Populate the points in a map, in one of three different methods. + Populate the points in a map, in one of three different methods. -1) Wraps evas_map_util_points_populate_from_object(). + 1) Wraps evas_map_util_points_populate_from_object(). -@param source An evas object to copy points from. + @param source An evas object to copy points from. -2) Wraps evas_map_util_paints_populate_from_object_full(). + 2) Wraps evas_map_util_paints_populate_from_object_full(). -@param source An evas object to copy points from. -@param z Common Z coordinate hint for all four points. + @param source An evas object to copy points from. + @param z Common Z coordinate hint for all four points. -3) Wraps evas_map_util_points_populate_from_geometry(). + 3) Wraps evas_map_util_points_populate_from_geometry(). -The first four arguments can be separate values, or named fields in a table. + The first four arguments can be separate values, or named fields in a table. -@param x Point X coordinate -@param y Point Y coordinate -@param w Width to use to calculate second and third points. -@param h Height to use to calculate third and fourth points. -@param z Common Z coordinate hint for all four points. + @param x Point X coordinate + @param y Point Y coordinate + @param w Width to use to calculate second and third points. + @param h Height to use to calculate third and fourth points. + @param z Common Z coordinate hint for all four points. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_map_populate(lua_State *L) // Stack usage [-(0|4), +(0|4), e] +_elua_map_populate(lua_State *L) // Stack usage [-(0|4), +(0|4), e] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Map *elm = (Edje_Lua_Map *)obj; int n; if (!_elua_isa(obj, _elua_evas_map_meta)) return 0; - n = lua_gettop(L); // Stack usage [-0, +0, -] + n = lua_gettop(L); // Stack usage [-0, +0, -] switch (n) - { - case 2 : - { - Edje_Lua_Obj *obj2 = (Edje_Lua_Obj *)lua_touserdata(L, 2); // Stack usage [-0, +0, -] - const Edje_Lua_Evas_Object *source = (Edje_Lua_Evas_Object *)obj2; + { + case 2: + { + Edje_Lua_Obj *obj2 = (Edje_Lua_Obj *)lua_touserdata(L, 2); // Stack usage [-0, +0, -] + const Edje_Lua_Evas_Object *source = (Edje_Lua_Evas_Object *)obj2; - if (!_elua_isa(obj2, _elua_evas_meta)) return 0; - evas_map_util_points_populate_from_object(elm->map, source->evas_obj); - break; - } + if (!_elua_isa(obj2, _elua_evas_meta)) return 0; + evas_map_util_points_populate_from_object(elm->map, source->evas_obj); + break; + } - case 3 : - { - Edje_Lua_Obj *obj2 = (Edje_Lua_Obj *)lua_touserdata(L, 2); // Stack usage [-0, +0, -] - const Edje_Lua_Evas_Object *source = (Edje_Lua_Evas_Object *)obj2; - Evas_Coord z = lua_tointeger(L, 3); + case 3: + { + Edje_Lua_Obj *obj2 = (Edje_Lua_Obj *)lua_touserdata(L, 2); // Stack usage [-0, +0, -] + const Edje_Lua_Evas_Object *source = (Edje_Lua_Evas_Object *)obj2; + Evas_Coord z = lua_tointeger(L, 3); - if (!_elua_isa(obj2, _elua_evas_meta)) return 0; - evas_map_util_points_populate_from_object_full(elm->map, source->evas_obj, z); - break; - } + if (!_elua_isa(obj2, _elua_evas_meta)) return 0; + evas_map_util_points_populate_from_object_full(elm->map, source->evas_obj, z); + break; + } - case 6 : - { - Evas_Coord x, y, w, h; + case 6: + { + Evas_Coord x, y, w, h; - if ((n = _elua_scan_params(L, 2, "%x %y %w %h", &x, &y, &w, &h)) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e] - evas_map_util_points_populate_from_geometry(elm->map, x, y, w, h, lua_tointeger(L, 2 + n)); - } - break; - } - } + if ((n = _elua_scan_params(L, 2, "%x %y %w %h", &x, &y, &w, &h)) > 0) // Stack usage [-0, +0, m] unless it's in a table [-4, +4, e] + { + evas_map_util_points_populate_from_geometry(elm->map, x, y, w, h, lua_tointeger(L, 2 + n)); + } + break; + } + } return 0; } /** -@page luaref -@subsubsection map_rotate map_object:rotate(degrees, x, y) + @page luaref + @subsubsection map_rotate map_object:rotate(degrees, x, y) -Rotate the maps coordinates in 2D. + Rotate the maps coordinates in 2D. -Wraps evas_map_util_rotate(). + Wraps evas_map_util_rotate(). -The coordinates can be separate values, or named fields in a table. + The coordinates can be separate values, or named fields in a table. -@param degrees Amount of degrees from 0.0 to 360.0 to rotate. -@param x Rotation's centre horizontal position. -@param y Rotation's centre vertical position. + @param degrees Amount of degrees from 0.0 to 360.0 to rotate. + @param x Rotation's centre horizontal position. + @param y Rotation's centre vertical position. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_map_rotate(lua_State *L) // Stack usage [-(0|2), +(0|2), e] +_elua_map_rotate(lua_State *L) // Stack usage [-(0|2), +(0|2), e] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Map *elm = (Edje_Lua_Map *)obj; @@ -3352,39 +3365,39 @@ _elua_map_rotate(lua_State *L) // Stack usage [ int n; if (!_elua_isa(obj, _elua_evas_map_meta)) return 0; - n = lua_gettop(L); // Stack usage [-0, +0, -] + n = lua_gettop(L); // Stack usage [-0, +0, -] if (4 != n) return 0; degrees = lua_tonumber(L, 2); - if (_elua_scan_params(L, 3, "%x %y", &x, &y) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] + if (_elua_scan_params(L, 3, "%x %y", &x, &y) > 0) // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] + { evas_map_util_rotate(elm->map, degrees, x, y); } return 0; } /** -@page luaref -@subsubsection map_rotate3d map_object:rotate3d(dx, dy, dz, x, y, z) + @page luaref + @subsubsection map_rotate3d map_object:rotate3d(dx, dy, dz, x, y, z) -Rotate the maps coordinates in 3D. + Rotate the maps coordinates in 3D. -Wraps evas_map_util_3d_rotate(). + Wraps evas_map_util_3d_rotate(). -The coordinates can be separate values, or named fields in a table. The same -with the rotation. + The coordinates can be separate values, or named fields in a table. The same + with the rotation. -@param dx Amount of degrees from 0.0 to 360.0 to rotate around X axis. -@param dy Amount of degrees from 0.0 to 360.0 to rotate around Y axis. -@param dz Amount of degrees from 0.0 to 360.0 to rotate around Z axis. -@param x Rotation's centre horizontal position. -@param y Rotation's centre vertical position. -@param z Rotation's centre vertical position. + @param dx Amount of degrees from 0.0 to 360.0 to rotate around X axis. + @param dy Amount of degrees from 0.0 to 360.0 to rotate around Y axis. + @param dz Amount of degrees from 0.0 to 360.0 to rotate around Z axis. + @param x Rotation's centre horizontal position. + @param y Rotation's centre vertical position. + @param z Rotation's centre vertical position. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_map_rotate3d(lua_State *L) // Stack usage [-(0|6), +(0|6), e] +_elua_map_rotate3d(lua_State *L) // Stack usage [-(0|6), +(0|6), e] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Map *elm = (Edje_Lua_Map *)obj; @@ -3395,33 +3408,33 @@ _elua_map_rotate3d(lua_State *L) // Stack usage [ if (!_elua_isa(obj, _elua_evas_map_meta)) return 0; if ((n = _elua_scan_params(L, 2, "#x #y #z", &zx, &zy, &zz)) > 0) - // Stack usage [-0, +0, m] unless it's in a table [-3, +3, e] - if (_elua_scan_params(L, 2 + n, "%x %y %z", &x, &y, &z) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-3, +3, e] - evas_map_util_3d_rotate(elm->map, zx, zy, zz, x, y, z); - } + // Stack usage [-0, +0, m] unless it's in a table [-3, +3, e] + if (_elua_scan_params(L, 2 + n, "%x %y %z", &x, &y, &z) > 0) // Stack usage [-0, +0, m] unless it's in a table [-3, +3, e] + { + evas_map_util_3d_rotate(elm->map, zx, zy, zz, x, y, z); + } return 0; } /** -@page luaref -@subsubsection map_smooth map_object:smooth(smooth) + @page luaref + @subsubsection map_smooth map_object:smooth(smooth) -Get (and optionally set) the maps smooth mode. + Get (and optionally set) the maps smooth mode. -Wraps evas_map_smooth_set(). + Wraps evas_map_smooth_set(). -@param smooth The smooth mode. + @param smooth The smooth mode. -Note that the argument is optional, without it this function just queries the -current value. + Note that the argument is optional, without it this function just queries the + current value. -@return A boolean reflecting the smooth mode. + @return A boolean reflecting the smooth mode. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_map_smooth(lua_State *L) // Stack usage [-0, +1, -] +_elua_map_smooth(lua_State *L) // Stack usage [-0, +1, -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Map *elm = (Edje_Lua_Map *)obj; @@ -3429,40 +3442,40 @@ _elua_map_smooth(lua_State *L) // Stack usage [ if (!_elua_isa(obj, _elua_evas_map_meta)) return 0; - n = lua_gettop(L); // Stack usage [-0, +0, -] + n = lua_gettop(L); // Stack usage [-0, +0, -] if (n == 2) { evas_map_smooth_set(elm->map, lua_toboolean(L, 2)); - // Stack usage [-0, +0, -] + // Stack usage [-0, +0, -] } - lua_pushboolean(L, evas_map_smooth_get(elm->map)); // Stack usage [-0, +1, -] + lua_pushboolean(L, evas_map_smooth_get(elm->map)); // Stack usage [-0, +1, -] return 1; } /** -@page luaref -@subsubsection map_uv map_object:uv(index, u, v) + @page luaref + @subsubsection map_uv map_object:uv(index, u, v) -Gets (and optionally sets) the texture U and V texture coordinates for this map. + Gets (and optionally sets) the texture U and V texture coordinates for this map. -Wraps evas_map_point_image_uv_set(). + Wraps evas_map_point_image_uv_set(). -@param index Index of the point to change. Must be smaller than map size. -@param u The X coordinate within the image/texture source. -@param v The Y coordinate within the image/texture source. + @param index Index of the point to change. Must be smaller than map size. + @param u The X coordinate within the image/texture source. + @param v The Y coordinate within the image/texture source. -Note that the U,V arguments are optional, without them this function just queries -the current values. The coordinate arguments can be separate values, or named -fields in a table. + Note that the U,V arguments are optional, without them this function just queries + the current values. The coordinate arguments can be separate values, or named + fields in a table. -@return A table with these fields: - - number u: The X coordinate within the image/texture source. - - number v: The Y coordinate within the image/texture source. + @return A table with these fields: + - number u: The X coordinate within the image/texture source. + - number v: The Y coordinate within the image/texture source. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_map_uv(lua_State *L) // Stack usage [-(4|6), +(5|7), em] +_elua_map_uv(lua_State *L) // Stack usage [-(4|6), +(5|7), em] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Map *elm = (Edje_Lua_Map *)obj; @@ -3470,40 +3483,40 @@ _elua_map_uv(lua_State *L) // Stack usage [ int n; if (!_elua_isa(obj, _elua_evas_map_meta)) return 0; - n = lua_gettop(L); // Stack usage [-0, +0, -] + n = lua_gettop(L); // Stack usage [-0, +0, -] if (2 > n) return 0; - if (_elua_scan_params(L, 3, "#u #v", &u, &v) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] + if (_elua_scan_params(L, 3, "#u #v", &u, &v) > 0) // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] + { evas_map_point_image_uv_set(elm->map, lua_tonumber(L, 2), u, v); - // Stack usage [-0, +0, -] + // Stack usage [-0, +0, -] } evas_map_point_image_uv_get(elm->map, lua_tonumber(L, 2), &u, &v); - // Stack usage [-0, +0, -] + // Stack usage [-0, +0, -] _elua_ret(L, "#u #v", u, v); - // Stack usage [-4, +5, em] + // Stack usage [-4, +5, em] return 1; } /** -@page luaref -@subsubsection map_zoom map_object:zoom(x, y, x, y) + @page luaref + @subsubsection map_zoom map_object:zoom(x, y, x, y) -Apply a zoom to the map. + Apply a zoom to the map. -Wraps evas_map_util_zoom(). + Wraps evas_map_util_zoom(). -The arguments can be two separate values, or named fields in a table. + The arguments can be two separate values, or named fields in a table. -@param x The horizontal zoom amount. -@param y The vertical zoom amount. -@param x The X coordinate of the centre of the zoom. -@param y The Y coordinate of the centre of the zoom. + @param x The horizontal zoom amount. + @param y The vertical zoom amount. + @param x The X coordinate of the centre of the zoom. + @param y The Y coordinate of the centre of the zoom. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_map_zoom(lua_State *L) // Stack usage [-(0|4), +(0|4), e] +_elua_map_zoom(lua_State *L) // Stack usage [-(0|4), +(0|4), e] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Map *elm = (Edje_Lua_Map *)obj; @@ -3514,29 +3527,29 @@ _elua_map_zoom(lua_State *L) // Stack usage [ if (!_elua_isa(obj, _elua_evas_map_meta)) return 0; if ((n = _elua_scan_params(L, 2, "#x #y", &zx, &zy)) > 0) - // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] - if (_elua_scan_params(L, 2 + n, "%x %y", &x, &y) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] - evas_map_util_zoom(elm->map, zx, zy, x, y); - } + // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] + if (_elua_scan_params(L, 2 + n, "%x %y", &x, &y) > 0) // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] + { + evas_map_util_zoom(elm->map, zx, zy, x, y); + } return 0; } //------------- //------------- /** -@page luaref -@subsection evas_polygon Evas polygon class. + @page luaref + @subsection evas_polygon Evas polygon class. -The lua evas polygon class includes functions for dealing with evas polygon objects. -The evas polygon objects must have been previously created by lua using the lua -polygon object creation function edje.polygon(). + The lua evas polygon class includes functions for dealing with evas polygon objects. + The evas polygon objects must have been previously created by lua using the lua + polygon object creation function edje.polygon(). -In the following, "polygon_object" is a place holder for any lua variable that -holds a reference to an evas polygon object. + In the following, "polygon_object" is a place holder for any lua variable that + holds a reference to an evas polygon object. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int _elua_polygon_clear(lua_State *L); static int _elua_polygon_point(lua_State *L); @@ -3545,24 +3558,24 @@ static const char *_elua_evas_polygon_api = "evas_polygon"; static const char *_elua_evas_polygon_parent = "evas_polygon_parent"; static const struct luaL_Reg _elua_evas_polygon_funcs [] = { - {"clear", _elua_polygon_clear}, // clear all polygon points - {"point", _elua_polygon_point}, // add a polygon point + {"clear", _elua_polygon_clear}, // clear all polygon points + {"point", _elua_polygon_point}, // add a polygon point - {NULL, NULL} // end + {NULL, NULL} // end }; /** -@page luaref -@subsubsection polygon_clear polygon_object:clear() + @page luaref + @subsubsection polygon_clear polygon_object:clear() -Clears all points from the polygon. + Clears all points from the polygon. -Wraps evas_object_polygon_points_clear(), + Wraps evas_object_polygon_points_clear(), -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_polygon_clear(lua_State *L) // Stack usage [-0, +0, -] +_elua_polygon_clear(lua_State *L) // Stack usage [-0, +0, -] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; @@ -3573,20 +3586,20 @@ _elua_polygon_clear(lua_State *L) // Stack usage [ } /** -@page luaref -@subsubsection polygon_point polygon_object:point(x, y) + @page luaref + @subsubsection polygon_point polygon_object:point(x, y) -Adds a point to this polygon. + Adds a point to this polygon. -Wraps evas_object_polygon_point_add(). + Wraps evas_object_polygon_point_add(). -@param x The X coordinate of the point. -@param y The Y coordinate of the point. + @param x The X coordinate of the point. + @param y The Y coordinate of the point. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_polygon_point(lua_State *L) // Stack usage [-(0|2), +(0|2), e] +_elua_polygon_point(lua_State *L) // Stack usage [-(0|2), +(0|2), e] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; @@ -3594,8 +3607,8 @@ _elua_polygon_point(lua_State *L) // Stack usage [ if (!_elua_isa(obj, _elua_evas_polygon_meta)) return 0; - if (_elua_scan_params(L, 2, "%x %y", &x, &y) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] + if (_elua_scan_params(L, 2, "%x %y", &x, &y) > 0) // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] + { evas_object_polygon_point_add(elo->evas_obj, x, y); } @@ -3605,18 +3618,18 @@ _elua_polygon_point(lua_State *L) // Stack usage [ //------------- //------------- /** -@page luaref -@subsection evas_text Evas text class. + @page luaref + @subsection evas_text Evas text class. -The lua evas text class includes functions for dealing with evas text objects. -The evas text objects must have been previously created by lua using the lua -text object creation function edje.text(). + The lua evas text class includes functions for dealing with evas text objects. + The evas text objects must have been previously created by lua using the lua + text object creation function edje.text(). -In the following, "text_object" is a place holder for any lua variable that -holds a reference to an evas text object. + In the following, "text_object" is a place holder for any lua variable that + holds a reference to an evas text object. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int _elua_text_font(lua_State *L); static int _elua_text_text(lua_State *L); @@ -3625,124 +3638,123 @@ static const char *_elua_evas_text_api = "evas_text"; static const char *_elua_evas_text_parent = "evas_text_parent"; static const struct luaL_Reg _elua_evas_text_funcs [] = { - {"font", _elua_text_font}, // get or set text font - {"text", _elua_text_text}, // get or set text + {"font", _elua_text_font}, // get or set text font + {"text", _elua_text_text}, // get or set text // {"text_class", _elua_object_text_class}, // get or set object text class - {NULL, NULL} // end + {NULL, NULL} // end }; /** -@page luaref -@subsubsection text_font text_object:font(font, size) + @page luaref + @subsubsection text_font text_object:font(font, size) -Gets, (and optionally sets) the font for this text object. + Gets, (and optionally sets) the font for this text object. -Wraps evas_object_text_font_set(). + Wraps evas_object_text_font_set(). -@param font The new font name. -@param size The new font size. + @param font The new font name. + @param size The new font size. -Note that the font and size arguments are optional, without them this function -just queries the current values. The font and size arguments can be separate -values, or named fields in a table. The font name can refer to a font in the -edje file, or an external font. + Note that the font and size arguments are optional, without them this function + just queries the current values. The font and size arguments can be separate + values, or named fields in a table. The font name can refer to a font in the + edje file, or an external font. -@return A table with these fields: + @return A table with these fields: - string font: The font name. - integer size: The font size. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_text_font(lua_State *L) // Stack usage [-(4|6), +(5|7), em] +_elua_text_font(lua_State *L) // Stack usage [-(4|6), +(5|7), em] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; char *font, *font2 = NULL; - Evas_Font_Size size; - int inlined_font = 0; + Evas_Font_Size size; + int inlined_font = 0; if (!_elua_isa(obj, _elua_evas_text_meta)) return 0; - if (_elua_scan_params(L, 2, "$font %size", &font, &size) > 0) - { // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] - /* Check if the font is embedded in the .edj - * This is a simple check. - * There is a much more complicated version in edje_text.c _edje_text_recalc_apply(). - * If we need to get more complicated, we can do that later, - * and maybe refactor things. - */ - if (obj->ed->file->fonts) - { - Edje_Font_Directory_Entry *fnt = eina_hash_find(obj->ed->file->fonts, font); + if (_elua_scan_params(L, 2, "$font %size", &font, &size) > 0) // Stack usage [-0, +0, m] unless it's in a table [-2, +2, e] + { + /* Check if the font is embedded in the .edj + * This is a simple check. + * There is a much more complicated version in edje_text.c _edje_text_recalc_apply(). + * If we need to get more complicated, we can do that later, + * and maybe refactor things. + */ + if (obj->ed->file->fonts) + { + Edje_Font_Directory_Entry *fnt = eina_hash_find(obj->ed->file->fonts, font); - if (fnt) - { - size_t len = strlen(font) + sizeof("edje/fonts/") + 1; - font2 = alloca(len); - sprintf(font2, "edje/fonts/%s", font); - font = font2; - inlined_font = 1; - font2 = NULL; - } - } + if (fnt) + { + size_t len = strlen(font) + sizeof("edje/fonts/") + 1; + font2 = alloca(len); + sprintf(font2, "edje/fonts/%s", font); + font = font2; + inlined_font = 1; + font2 = NULL; + } + } - if (inlined_font) evas_object_text_font_source_set(elo->evas_obj, obj->ed->path); - else evas_object_text_font_source_set(elo->evas_obj, NULL); + if (inlined_font) evas_object_text_font_source_set(elo->evas_obj, obj->ed->path); + else evas_object_text_font_source_set(elo->evas_obj, NULL); - evas_object_text_font_set(elo->evas_obj, font, size); - } + evas_object_text_font_set(elo->evas_obj, font, size); + } // When one external API says it's gotta be const, and another one says not, then one of them's gotta be cast. :-P - evas_object_text_font_get(elo->evas_obj, (const char **) &font, &size); + evas_object_text_font_get(elo->evas_obj, (const char **)&font, &size); _elua_ret(L, "$font %size", font, size); - // Stack usage [-4, +5, em] + // Stack usage [-4, +5, em] return 1; } /** -@page luaref -@subsubsection text_text text_object:text(text) + @page luaref + @subsubsection text_text text_object:text(text) -Get (and optionally set) the actual text for this text object. + Get (and optionally set) the actual text for this text object. -Wraps evas_object_text_text_set(). + Wraps evas_object_text_text_set(). -@param text The text to set for this text object. + @param text The text to set for this text object. -Note that the argument is optional, without it this function just queries the -current value. + Note that the argument is optional, without it this function just queries the + current value. -@return A string of the text on this text object. + @return A string of the text on this text object. -@since 1.1.0 -*/ + @since 1.1.0 + */ static int -_elua_text_text(lua_State *L) // Stack usage [-0, +1, m] +_elua_text_text(lua_State *L) // Stack usage [-0, +1, m] { Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1); // Stack usage [-0, +0, -] Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj; int n; if (!_elua_isa(obj, _elua_evas_text_meta)) return 0; - n = lua_gettop(L); // Stack usage [-0, +0, -] + n = lua_gettop(L); // Stack usage [-0, +0, -] if (n == 2) { if (lua_isstring(L, 2)) { const char *str; - if ((str = lua_tostring(L, 2))) // Extra parenthesis, coz Mikes compiler has a lisp. - // Stack usage [-0, +0, m] - evas_object_text_text_set(elo->evas_obj, str); + if ((str = lua_tostring(L, 2))) // Extra parenthesis, coz Mikes compiler has a lisp. + // Stack usage [-0, +0, m] + evas_object_text_text_set(elo->evas_obj, str); } } lua_pushstring(L, evas_object_text_text_get(elo->evas_obj)); // Stack usage [-0, +1, m] return 1; } - //--------------------------------------------------------------------------// // A metatable and functions so that calling non existant API does not crash Lua scripts. @@ -3752,10 +3764,10 @@ static int _elua_bogan_index(lua_State *L); static const struct luaL_Reg _elua_bogan_funcs [] = { - {"nilfunc", _elua_bogan_nilfunc}, // Just return a nil. - {"__index", _elua_bogan_index}, // Return the above func. + {"nilfunc", _elua_bogan_nilfunc}, // Just return a nil. + {"__index", _elua_bogan_index}, // Return the above func. - {NULL, NULL} // end + {NULL, NULL} // end }; static int @@ -3777,17 +3789,17 @@ _elua_bogan_index(lua_State *L) } static void -_elua_bogan_protect(lua_State *L) // Stack usage [-3, +3, m] +_elua_bogan_protect(lua_State *L) // Stack usage [-3, +3, m] { - lua_pushnil(L); // Stack usage [-0, +1, -] - luaL_newmetatable(L, "bogan"); // Stack usage [-0, +1, m] + lua_pushnil(L); // Stack usage [-0, +1, -] + luaL_newmetatable(L, "bogan"); // Stack usage [-0, +1, m] #if LUA_VERSION_NUM >= 502 - luaL_setfuncs(L, _elua_bogan_funcs, 0); // Stack usage [-0, +0, e] + luaL_setfuncs(L, _elua_bogan_funcs, 0); // Stack usage [-0, +0, e] #else - luaL_register(L, 0, _elua_bogan_funcs); // Stack usage [-1, +1, m] + luaL_register(L, 0, _elua_bogan_funcs); // Stack usage [-1, +1, m] #endif - lua_setmetatable(L, -2); // Stack usage [-1, +0, -] - lua_pop(L, 1); // Stack usage [-1, +0, -] + lua_setmetatable(L, -2); // Stack usage [-1, +0, -] + lua_pop(L, 1); // Stack usage [-1, +0, -] } //--------------------------------------------------------------------------// @@ -3800,18 +3812,18 @@ _elua_add_functions(lua_State *L, const char *api, const luaL_Reg *funcs, const { // Create an api table, fill it full of the methods. #if LUA_VERSION_NUM >= 502 - lua_newtable(L); // Stack usage [-0, +1, e] - lua_pushvalue(L, -1); // Stack usage [-0, +1, -] - lua_setglobal(L, api); // Stack usage [-1, +0, e] - luaL_setfuncs(L, funcs, 0); // Stack usage [-0, +0, e] + lua_newtable(L); // Stack usage [-0, +1, e] + lua_pushvalue(L, -1); // Stack usage [-0, +1, -] + lua_setglobal(L, api); // Stack usage [-1, +0, e] + luaL_setfuncs(L, funcs, 0); // Stack usage [-0, +0, e] #else - luaL_register(L, api, funcs); // Stack usage [-0, +1, m] + luaL_register(L, api, funcs); // Stack usage [-0, +1, m] #endif // Set the api metatable to the bogan metatable. - luaL_getmetatable(L, "bogan"); // Stack usage [-0, +1, -] - lua_setmetatable(L, -2); // Stack usage [-1, +0, -] + luaL_getmetatable(L, "bogan"); // Stack usage [-0, +1, -] + lua_setmetatable(L, -2); // Stack usage [-1, +0, -] // Creat a meta metatable. - luaL_newmetatable(L, meta); // Stack usage [-0, +1, m] + luaL_newmetatable(L, meta); // Stack usage [-0, +1, m] // Put the gc functions in the metatable. #if LUA_VERSION_NUM >= 502 luaL_setfuncs(L, _elua_edje_gc_funcs, 0); // Stack usage [-0, +0, e] @@ -3819,25 +3831,25 @@ _elua_add_functions(lua_State *L, const char *api, const luaL_Reg *funcs, const luaL_register(L, 0, _elua_edje_gc_funcs); // Stack usage [-1, +1, m] #endif // Create an __index entry in the metatable, make it point to the api table. - lua_pushliteral(L, "__index"); // Stack usage [-0, +1, m] - lua_pushvalue(L, -3); // Stack usage [-0, +1, -] - lua_rawset(L, -3); // Stack usage [-2, +0, m] + lua_pushliteral(L, "__index"); // Stack usage [-0, +1, m] + lua_pushvalue(L, -3); // Stack usage [-0, +1, -] + lua_rawset(L, -3); // Stack usage [-2, +0, m] // Later this metatable is used as the metatable for newly created objects of this class. if (base && parent) { // Inherit from base - lua_getglobal(L, base); // Stack usage [-0, +1, e] + lua_getglobal(L, base); // Stack usage [-0, +1, e] // Create a new parent metatable. - luaL_newmetatable(L, parent); // Stack usage [-0, +1, m] + luaL_newmetatable(L, parent); // Stack usage [-0, +1, m] // Create an __index entry in the metatable, make it point to the base table. - lua_pushliteral(L, "__index"); // Stack usage [-0, +1, m] - lua_pushvalue(L, -3); // Stack usage [-0, +1, -] - lua_rawset(L, -3); // Stack usage [-2, +0, m] + lua_pushliteral(L, "__index"); // Stack usage [-0, +1, m] + lua_pushvalue(L, -3); // Stack usage [-0, +1, -] + lua_rawset(L, -3); // Stack usage [-2, +0, m] // Set the metatable for the api table to the parent metatable. - lua_getglobal(L, api); // Stack usage [-0, +1, e] - luaL_getmetatable(L, parent); // Stack usage [-0, +1, -] - lua_setmetatable(L, -2); // Stack usage [-1, +0, -] + lua_getglobal(L, api); // Stack usage [-0, +1, e] + luaL_getmetatable(L, parent); // Stack usage [-0, +1, -] + lua_setmetatable(L, -2); // Stack usage [-1, +0, -] } } @@ -3849,26 +3861,26 @@ _elua_isa(Edje_Lua_Obj *obj, const char *type) if (!obj) return isa; if (obj->meta == type) - isa = EINA_TRUE; + isa = EINA_TRUE; if (_elua_evas_meta == type) { if (obj->meta == _elua_evas_image_meta) - isa = EINA_TRUE; + isa = EINA_TRUE; else if (obj->meta == _elua_evas_text_meta) - isa = EINA_TRUE; + isa = EINA_TRUE; else if (obj->meta == _elua_evas_edje_meta) - isa = EINA_TRUE; + isa = EINA_TRUE; else if (obj->meta == _elua_evas_line_meta) - isa = EINA_TRUE; + isa = EINA_TRUE; else if (obj->meta == _elua_evas_polygon_meta) - isa = EINA_TRUE; + isa = EINA_TRUE; } return isa; } #ifndef RASTER_FORGOT_WHY static void -_elua_init(void) // Stack usage [-16, +20, em] +_elua_init(void) // Stack usage [-16, +20, em] { static Edje_Lua_Alloc ela = { MAX_LUA_MEM, 0 }; Edje_Lua_Allocator *al; @@ -3879,56 +3891,57 @@ _elua_init(void) lstate = L = luaL_newstate(); al = lua_newuserdata(L, sizeof(Edje_Lua_Allocator)); - al->ref = luaL_ref(L, LUA_REGISTRYINDEX); + al->ref = luaL_ref(L, LUA_REGISTRYINDEX); al->func = lua_getallocf(L, &(al->ud)); - al->ela = &ela; - lua_setallocf(L, _elua_alloc, al); // Stack usage [-0, +0, -] - lua_atpanic(L, _elua_custom_panic); // Stack usage [-0, +0, -] + al->ela = &ela; + lua_setallocf(L, _elua_alloc, al); // Stack usage [-0, +0, -] + lua_atpanic(L, _elua_custom_panic); // Stack usage [-0, +0, -] // FIXME: figure out optimal gc settings later // lua_gc(L, LUA_GCSETPAUSE, 200); // Stack usage [-0, +0, e] // lua_gc(L, LUA_GCSETSTEPMUL, 200); // Stack usage [-0, +0, e] - for (l = _elua_libs; l->func; l++) // Currently * 4 + for (l = _elua_libs; l->func; l++) // Currently * 4 { #if LUA_VERSION_NUM >= 502 - luaL_requiref(L, l->name, l->func, 1); // Stack usage [-0, +1, e] + luaL_requiref(L, l->name, l->func, 1); // Stack usage [-0, +1, e] #else - lua_pushcfunction(L, l->func); // Stack usage [-0, +1, m] - lua_pushstring(L, l->name); // Stack usage [-0, +1, m] - lua_call(L, 1, 0); // Stack usage [-2, +0, e] + lua_pushcfunction(L, l->func); // Stack usage [-0, +1, m] + lua_pushstring(L, l->name); // Stack usage [-0, +1, m] + lua_call(L, 1, 0); // Stack usage [-2, +0, e] #endif } #if LUA_VERSION_NUM >= 502 - lua_newtable(L); // Stack usage [-0, +1, e] - lua_pushvalue(L, -1); // Stack usage [-0, +1, -] - lua_setglobal(L, _elua_edje_api); // Stack usage [-1, +0, e] - luaL_setfuncs(L, _elua_edje_funcs, 0); // Stack usage [-0, +0, e] + lua_newtable(L); // Stack usage [-0, +1, e] + lua_pushvalue(L, -1); // Stack usage [-0, +1, -] + lua_setglobal(L, _elua_edje_api); // Stack usage [-1, +0, e] + luaL_setfuncs(L, _elua_edje_funcs, 0); // Stack usage [-0, +0, e] #else - luaL_register(L, _elua_edje_api, _elua_edje_funcs); // Stack usage [-0, +1, m] + luaL_register(L, _elua_edje_api, _elua_edje_funcs); // Stack usage [-0, +1, m] #endif - luaL_newmetatable(L, _elua_edje_meta); // Stack usage [-0, +1, m] + luaL_newmetatable(L, _elua_edje_meta); // Stack usage [-0, +1, m] #if LUA_VERSION_NUM >= 502 - luaL_setfuncs(L, _elua_edje_gc_funcs, 0); // Stack usage [-0, +0, e] + luaL_setfuncs(L, _elua_edje_gc_funcs, 0); // Stack usage [-0, +0, e] #else - luaL_register(L, 0, _elua_edje_gc_funcs); // Stack usage [-1, +1, m] + luaL_register(L, 0, _elua_edje_gc_funcs); // Stack usage [-1, +1, m] #endif _elua_add_functions(L, _elua_evas_api, _elua_evas_funcs, _elua_evas_meta, NULL, NULL); // Stack usage [-3, +5, m] // weak table for our objects - lua_pushlightuserdata(L, &_elua_objs); // Stack usage [-0, +1, -] - lua_newtable(L); // Stack usage [-0, +1, m] - lua_pushstring(L, "__mode"); // Stack usage [-0, +1, m] - lua_pushstring(L, "kv"); // Stack usage [-0, +1, m] - lua_rawset(L, -3); // Stack usage [-2, +0, m] - lua_rawset(L, LUA_REGISTRYINDEX); // Stack usage [-2, +0, m] + lua_pushlightuserdata(L, &_elua_objs); // Stack usage [-0, +1, -] + lua_newtable(L); // Stack usage [-0, +1, m] + lua_pushstring(L, "__mode"); // Stack usage [-0, +1, m] + lua_pushstring(L, "kv"); // Stack usage [-0, +1, m] + lua_rawset(L, -3); // Stack usage [-2, +0, m] + lua_rawset(L, LUA_REGISTRYINDEX); // Stack usage [-2, +0, m] } + #endif void -_edje_lua2_script_init(Edje *ed) // Stack usage [-63, +99, em] +_edje_lua2_script_init(Edje *ed) // Stack usage [-63, +99, em] { static Edje_Lua_Alloc ela = { MAX_LUA_MEM, 0 }; Edje_Lua_Allocator *al; @@ -3940,7 +3953,7 @@ _edje_lua2_script_init(Edje *ed) // Stack usage if (ed->L) return; if (0 > _log_domain) - _log_domain = eina_log_domain_register("lua", NULL); + _log_domain = eina_log_domain_register("lua", NULL); if (0 <= _log_domain) { _log_count++; @@ -3948,80 +3961,80 @@ _edje_lua2_script_init(Edje *ed) // Stack usage } #ifndef RASTER_FORGOT_WHY - _elua_init(); // This is actually truly pointless, even if raster remembers. + _elua_init(); // This is actually truly pointless, even if raster remembers. #endif L = ed->L = luaL_newstate(); al = lua_newuserdata(L, sizeof(Edje_Lua_Allocator)); - al->ref = luaL_ref(L, LUA_REGISTRYINDEX); + al->ref = luaL_ref(L, LUA_REGISTRYINDEX); al->func = lua_getallocf(L, &(al->ud)); - al->ela = &ela; - lua_setallocf(L, _elua_alloc, al); // Stack usage [-0, +0, -] - lua_atpanic(L, _elua_custom_panic); // Stack usage [-0, +0, -] + al->ela = &ela; + lua_setallocf(L, _elua_alloc, al); // Stack usage [-0, +0, -] + lua_atpanic(L, _elua_custom_panic); // Stack usage [-0, +0, -] // FIXME: figure out optimal gc settings later // lua_gc(L, LUA_GCSETPAUSE, 200); // Stack usage [-0, +0, e] // lua_gc(L, LUA_GCSETSTEPMUL, 200); // Stack usage [-0, +0, e] - for (l = _elua_libs; l->func; l++) // Currently * 4 + for (l = _elua_libs; l->func; l++) // Currently * 4 { #if LUA_VERSION_NUM >= 502 - luaL_requiref(L, l->name, l->func, 1); // Stack usage [-0, +1, e] + luaL_requiref(L, l->name, l->func, 1); // Stack usage [-0, +1, e] #else - lua_pushcfunction(L, l->func); // Stack usage [-0, +1, m] - lua_pushstring(L, l->name); // Stack usage [-0, +1, m] - lua_call(L, 1, 0); // Stack usage [-2, +0, m] + lua_pushcfunction(L, l->func); // Stack usage [-0, +1, m] + lua_pushstring(L, l->name); // Stack usage [-0, +1, m] + lua_call(L, 1, 0); // Stack usage [-2, +0, m] #endif } - _elua_bogan_protect(L); // Stack usage [+3, -3, m] + _elua_bogan_protect(L); // Stack usage [+3, -3, m] #if LUA_VERSION_NUM >= 502 - lua_newtable(L); // Stack usage [-0, +1, e] - lua_pushvalue(L, -1); // Stack usage [-0, +1, -] - lua_setglobal(L, _elua_edje_api); // Stack usage [-1, +0, e] - luaL_setfuncs(L, _elua_edje_funcs, 0); // Stack usage [-0, +0, e] + lua_newtable(L); // Stack usage [-0, +1, e] + lua_pushvalue(L, -1); // Stack usage [-0, +1, -] + lua_setglobal(L, _elua_edje_api); // Stack usage [-1, +0, e] + luaL_setfuncs(L, _elua_edje_funcs, 0); // Stack usage [-0, +0, e] #else - luaL_register(L, _elua_edje_api, _elua_edje_funcs); // Stack usage [-0, +1, m] + luaL_register(L, _elua_edje_api, _elua_edje_funcs); // Stack usage [-0, +1, m] #endif - luaL_getmetatable(L, "bogan"); // Stack usage [-0, +1, -] - lua_setmetatable(L, -2); // Stack usage [-1, +0, -] - luaL_newmetatable(L, _elua_edje_meta); // Stack usage [-0, +1, m] + luaL_getmetatable(L, "bogan"); // Stack usage [-0, +1, -] + lua_setmetatable(L, -2); // Stack usage [-1, +0, -] + luaL_newmetatable(L, _elua_edje_meta); // Stack usage [-0, +1, m] #if LUA_VERSION_NUM >= 502 - luaL_setfuncs(L, _elua_edje_gc_funcs, 0); // Stack usage [-0, +0, e] + luaL_setfuncs(L, _elua_edje_gc_funcs, 0); // Stack usage [-0, +0, e] #else - luaL_register(L, 0, _elua_edje_gc_funcs); // Stack usage [-1, +1, m] + luaL_register(L, 0, _elua_edje_gc_funcs); // Stack usage [-1, +1, m] #endif - lua_pop(L, 2); // Stack usage [-n, +0, -] + lua_pop(L, 2); // Stack usage [-n, +0, -] _elua_add_functions(L, _elua_evas_api, _elua_evas_funcs, _elua_evas_meta, NULL, NULL); - // Stack usage [-3, +5, m] + // Stack usage [-3, +5, m] _elua_add_functions(L, _elua_ecore_timer_api, _elua_ecore_timer_funcs, _elua_ecore_timer_meta, NULL, NULL); - // Stack usage [-3, +5, m] + // Stack usage [-3, +5, m] _elua_add_functions(L, _elua_ecore_animator_api, _elua_ecore_animator_funcs, _elua_ecore_animator_meta, NULL, NULL); - // Stack usage [-6, +11, m] + // Stack usage [-6, +11, m] _elua_add_functions(L, _elua_evas_edje_api, _elua_evas_edje_funcs, _elua_evas_edje_meta, _elua_evas_edje_parent, _elua_evas_api); - // Stack usage [-6, +11, em] + // Stack usage [-6, +11, em] _elua_add_functions(L, _elua_evas_image_api, _elua_evas_image_funcs, _elua_evas_image_meta, _elua_evas_image_parent, _elua_evas_api); - // Stack usage [-6, +11, em] + // Stack usage [-6, +11, em] _elua_add_functions(L, _elua_evas_line_api, _elua_evas_line_funcs, _elua_evas_line_meta, _elua_evas_line_parent, _elua_evas_api); - // Stack usage [-6, +11, em] + // Stack usage [-6, +11, em] _elua_add_functions(L, _elua_evas_map_api, _elua_evas_map_funcs, _elua_evas_map_meta, NULL, NULL); - // Stack usage [-3, +5, m] + // Stack usage [-3, +5, m] _elua_add_functions(L, _elua_evas_polygon_api, _elua_evas_polygon_funcs, _elua_evas_polygon_meta, _elua_evas_polygon_parent, _elua_evas_api); - // Stack usage [-6, +11, em] + // Stack usage [-6, +11, em] _elua_add_functions(L, _elua_evas_text_api, _elua_evas_text_funcs, _elua_evas_text_meta, _elua_evas_text_parent, _elua_evas_api); - // Stack usage [-6, +11, em] + // Stack usage [-6, +11, em] // weak table for our objects - lua_pushlightuserdata(L, &_elua_objs); // Stack usage [-0, +1, -] - lua_newtable(L); // Stack usage [-0, +1, m] - lua_pushstring(L, "__mode"); // Stack usage [-0, +1, m] - lua_pushstring(L, "kv"); // Stack usage [-0, +1, m] - lua_rawset(L, -3); // Stack usage [-2, +0, m] - lua_rawset(L, LUA_REGISTRYINDEX); // Stack usage [-2, +0, m] + lua_pushlightuserdata(L, &_elua_objs); // Stack usage [-0, +1, -] + lua_newtable(L); // Stack usage [-0, +1, m] + lua_pushstring(L, "__mode"); // Stack usage [-0, +1, m] + lua_pushstring(L, "kv"); // Stack usage [-0, +1, m] + lua_rawset(L, -3); // Stack usage [-2, +0, m] + lua_rawset(L, LUA_REGISTRYINDEX); // Stack usage [-2, +0, m] - _elua_table_ptr_set(L, _elua_key, ed); // Stack usage [-2, +2, e] + _elua_table_ptr_set(L, _elua_key, ed); // Stack usage [-2, +2, e] snprintf(buf, sizeof(buf), "edje/scripts/lua/%i", ed->collection->id); data = eet_read(ed->file->ef, buf, &size); @@ -4037,21 +4050,21 @@ _edje_lua2_script_init(Edje *ed) // Stack usage { if (err == LUA_ERRSYNTAX) ERR("Lua load syntax error: %s", - lua_tostring(L, -1)); // Stack usage [-0, +0, m] + lua_tostring(L, -1)); // Stack usage [-0, +0, m] else if (err == LUA_ERRMEM) ERR("Lua load memory allocation error: %s", - lua_tostring(L, -1)); // Stack usage [-0, +0, m] + lua_tostring(L, -1)); // Stack usage [-0, +0, m] } free(data); /* This is not needed, pcalls don't longjmp(), that's why they are protected. - if (setjmp(panic_jmp) == 1) - { + if (setjmp(panic_jmp) == 1) + { ERR("Lua script init panic"); return; - } - */ - if ((err = lua_pcall(L, 0, 0, 0))) // Stack usage [-1, +0, -] - _edje_lua2_error(L, err); // Stack usage [-0, +0, m] + } + */ + if ((err = lua_pcall(L, 0, 0, 0))) // Stack usage [-1, +0, -] + _edje_lua2_error(L, err); // Stack usage [-0, +0, m] } } @@ -4116,73 +4129,77 @@ _edje_lua2_script_unload(Edje_Part_Collection *edc EINA_UNUSED) // Stack usage void _edje_lua2_error_full(const char *file, const char *fnc, int line, - lua_State *L, int err_code) // Stack usage [-0, +0, m] + lua_State *L, int err_code) // Stack usage [-0, +0, m] { const char *err_type; switch (err_code) { - case LUA_ERRRUN: + case LUA_ERRRUN: err_type = "runtime"; break; - case LUA_ERRSYNTAX: + + case LUA_ERRSYNTAX: err_type = "syntax"; break; - case LUA_ERRMEM: + + case LUA_ERRMEM: err_type = "memory allocation"; break; - case LUA_ERRERR: + + case LUA_ERRERR: err_type = "error handler"; break; - default: + + default: err_type = "unknown"; break; } eina_log_print - (_edje_default_log_dom, EINA_LOG_LEVEL_ERR, file, fnc, line, - "Lua %s error: %s", err_type, lua_tostring(L, -1)); // Stack usage [-0, +0, m] + (_edje_default_log_dom, EINA_LOG_LEVEL_ERR, file, fnc, line, + "Lua %s error: %s", err_type, lua_tostring(L, -1)); // Stack usage [-0, +0, m] } /** -@page luaref -@section callbacks Lua callbacks + @page luaref + @section callbacks Lua callbacks -These are lua functions that are called by the lua edje system when certain -events occur. If the functions don't exist in the lua group, they don't get -called. + These are lua functions that are called by the lua edje system when certain + events occur. If the functions don't exist in the lua group, they don't get + called. */ /** -@page luaref -@subsection edje_shutdown Edje shutdown() callback. + @page luaref + @subsection edje_shutdown Edje shutdown() callback. -If a function called "shutdown" exists in a lua edje group, then it is called when -that edje gets deleted. -*/ + If a function called "shutdown" exists in a lua edje group, then it is called when + that edje gets deleted. + */ void -_edje_lua2_script_func_shutdown(Edje *ed) // Stack usage [-1, +1, em] +_edje_lua2_script_func_shutdown(Edje *ed) // Stack usage [-1, +1, em] { int err; - lua_getglobal(ed->L, "shutdown"); // Stack usage [-0, +1, e] - if (!lua_isnil(ed->L, -1)) // Stack usage [-0, +0, -] + lua_getglobal(ed->L, "shutdown"); // Stack usage [-0, +1, e] + if (!lua_isnil(ed->L, -1)) // Stack usage [-0, +0, -] { - if ((err = lua_pcall(ed->L, 0, 0, 0))) // Stack usage [-1, +0, -] - _edje_lua2_error(ed->L, err); // Stack usage [-0, +0, m] + if ((err = lua_pcall(ed->L, 0, 0, 0))) // Stack usage [-1, +0, -] + _edje_lua2_error(ed->L, err); // Stack usage [-0, +0, m] } else - lua_pop(ed->L, 1); // Stack usage [-n, +0, -] + lua_pop(ed->L, 1); // Stack usage [-n, +0, -] _edje_lua2_script_shutdown(ed); } /** -@page luaref -@subsection edje_show Edje show() callback. + @page luaref + @subsection edje_show Edje show() callback. -If a function called "show" exists in a lua edje group, then it is called when -that edje gets shown. -*/ + If a function called "show" exists in a lua edje group, then it is called when + that edje gets shown. + */ void _edje_lua2_script_func_show(Edje *ed) // Stack usage [-1, +1, e] { @@ -4199,12 +4216,12 @@ _edje_lua2_script_func_show(Edje *ed) // Stack usage [-1, +1, e] } /** -@page luaref -@subsection edje_hide Edje hide() callback. + @page luaref + @subsection edje_hide Edje hide() callback. -If a function called "hide" exists in a lua edje group, then it is called when -that edje gets hidden. -*/ + If a function called "hide" exists in a lua edje group, then it is called when + that edje gets hidden. + */ void _edje_lua2_script_func_hide(Edje *ed) // Stack usage [-1, +1, e] { @@ -4221,37 +4238,37 @@ _edje_lua2_script_func_hide(Edje *ed) // Stack usage [-1, +1, e] } /** -@page luaref -@subsection edje_move Edje move(x, y) callback. + @page luaref + @subsection edje_move Edje move(x, y) callback. -If a function called "move" exists in a lua edje group, then it is called when -that edje gets moved, with the new position passed to it. -*/ + If a function called "move" exists in a lua edje group, then it is called when + that edje gets moved, with the new position passed to it. + */ void _edje_lua2_script_func_move(Edje *ed) // Stack usage [-3, +3, e] or [-1, +1, e] if no matching function. { int err; // FIXME: move all objects created by script - lua_getglobal(ed->L, "move"); // Stack usage [-0, +1, e] - if (!lua_isnil(ed->L, -1)) // Stack usage [-0, +0, -] + lua_getglobal(ed->L, "move"); // Stack usage [-0, +1, e] + if (!lua_isnil(ed->L, -1)) // Stack usage [-0, +0, -] { - lua_pushinteger(ed->L, ed->x); // Stack usage [-0, +1, -] - lua_pushinteger(ed->L, ed->y); // Stack usage [-0, +1, -] - if ((err = lua_pcall(ed->L, 2, 0, 0))) // Stack usage [-3, +0, -] + lua_pushinteger(ed->L, ed->x); // Stack usage [-0, +1, -] + lua_pushinteger(ed->L, ed->y); // Stack usage [-0, +1, -] + if ((err = lua_pcall(ed->L, 2, 0, 0))) // Stack usage [-3, +0, -] _edje_lua2_error(ed->L, err); } else - lua_pop(ed->L, 1); // Stack usage [-n, +0, -] + lua_pop(ed->L, 1); // Stack usage [-n, +0, -] } /** -@page luaref -@subsection edje_resize Edje resize(w, h) callback. + @page luaref + @subsection edje_resize Edje resize(w, h) callback. -If a function called "resize" exists in a lua edje group, then it is called when -that edje gets resized, with the new size passed to it. -*/ + If a function called "resize" exists in a lua edje group, then it is called when + that edje gets resized, with the new size passed to it. + */ void _edje_lua2_script_func_resize(Edje *ed) // Stack usage [-3, +3, e] or [-1, +1, e] if no matching function. { @@ -4270,149 +4287,161 @@ _edje_lua2_script_func_resize(Edje *ed) // Stack usage [-3, +3, e] or [-1, +1, } /** -@page luaref -@subsection edje_message Edje message(id, type, ...) callback. + @page luaref + @subsection edje_message Edje message(id, type, ...) callback. -If a function called "message" exists in a lua edje group, then it is called when -that edje gets gets a message sent to it, with the message details passed to it. -See edje.messagesend() for details of what each type means. The arrays are -passed as a table. -*/ + If a function called "message" exists in a lua edje group, then it is called when + that edje gets gets a message sent to it, with the message details passed to it. + See edje.messagesend() for details of what each type means. The arrays are + passed as a table. + */ void _edje_lua2_script_func_message(Edje *ed, Edje_Message *em) // Stack usage [-?, +?, em] It's complicated, but it's even at least. { int err, n, c, i; - lua_getglobal(ed->L, "message"); // Stack usage [-0, +1, e] - if (!lua_isnil(ed->L, -1)) // Stack usage [-0, +0, -] + lua_getglobal(ed->L, "message"); // Stack usage [-0, +1, e] + if (!lua_isnil(ed->L, -1)) // Stack usage [-0, +0, -] { n = 2; - lua_pushinteger(ed->L, em->id); // Stack usage [-0, +1, -] + lua_pushinteger(ed->L, em->id); // Stack usage [-0, +1, -] switch (em->type) { - case EDJE_MESSAGE_NONE: - lua_pushstring(ed->L, "none"); // Stack usage [-0, +1, m] + case EDJE_MESSAGE_NONE: + lua_pushstring(ed->L, "none"); // Stack usage [-0, +1, m] break; - case EDJE_MESSAGE_SIGNAL: + + case EDJE_MESSAGE_SIGNAL: break; - case EDJE_MESSAGE_STRING: - lua_pushstring(ed->L, "str"); // Stack usage [-0, +1, m] + + case EDJE_MESSAGE_STRING: + lua_pushstring(ed->L, "str"); // Stack usage [-0, +1, m] lua_pushstring(ed->L, ((Edje_Message_String *)em->msg)->str); - // Stack usage [-0, +1, m] + // Stack usage [-0, +1, m] n += 1; - break; - case EDJE_MESSAGE_INT: - lua_pushstring(ed->L, "int"); // Stack usage [-0, +1, m] + break; + + case EDJE_MESSAGE_INT: + lua_pushstring(ed->L, "int"); // Stack usage [-0, +1, m] lua_pushinteger(ed->L, ((Edje_Message_Int *)em->msg)->val); - // Stack usage [-0, +1, -] + // Stack usage [-0, +1, -] n += 1; break; - case EDJE_MESSAGE_FLOAT: - lua_pushstring(ed->L, "float"); // Stack usage [-0, +1, m] + + case EDJE_MESSAGE_FLOAT: + lua_pushstring(ed->L, "float"); // Stack usage [-0, +1, m] lua_pushnumber(ed->L, ((Edje_Message_Float *)em->msg)->val); - // Stack usage [-0, +1, -] + // Stack usage [-0, +1, -] n += 1; break; - case EDJE_MESSAGE_STRING_SET: - lua_pushstring(ed->L, "strset"); // Stack usage [-0, +1, m] + + case EDJE_MESSAGE_STRING_SET: + lua_pushstring(ed->L, "strset"); // Stack usage [-0, +1, m] c = ((Edje_Message_String_Set *)em->msg)->count; - lua_createtable(ed->L, c, 0); // Stack usage [-0, +1, m] + lua_createtable(ed->L, c, 0); // Stack usage [-0, +1, m] for (i = 0; i < c; i++) { lua_pushstring(ed->L, ((Edje_Message_String_Set *)em->msg)->str[i]); - // Stack usage [-0, +1, m] + // Stack usage [-0, +1, m] // It's OK to bypass the metatable in these cases, // we create the table, and know there is no metatable. B-) - lua_rawseti(ed->L, -2, i + 1); // Stack usage [-1, +0, m] + lua_rawseti(ed->L, -2, i + 1); // Stack usage [-1, +0, m] } n += 1; break; - case EDJE_MESSAGE_INT_SET: - lua_pushstring(ed->L, "intset"); // Stack usage [-0, +1, m] + + case EDJE_MESSAGE_INT_SET: + lua_pushstring(ed->L, "intset"); // Stack usage [-0, +1, m] c = ((Edje_Message_Int_Set *)em->msg)->count; - lua_createtable(ed->L, c, 0); // Stack usage [-0, +1, m] + lua_createtable(ed->L, c, 0); // Stack usage [-0, +1, m] for (i = 0; i < c; i++) { lua_pushinteger(ed->L, ((Edje_Message_Int_Set *)em->msg)->val[i]); - // Stack usage [-0, +1, -] - lua_rawseti(ed->L, -2, i + 1); // Stack usage [-1, +0, m] + // Stack usage [-0, +1, -] + lua_rawseti(ed->L, -2, i + 1); // Stack usage [-1, +0, m] } n += 1; break; - case EDJE_MESSAGE_FLOAT_SET: - lua_pushstring(ed->L, "floatset"); // Stack usage [-0, +1, m] + + case EDJE_MESSAGE_FLOAT_SET: + lua_pushstring(ed->L, "floatset"); // Stack usage [-0, +1, m] c = ((Edje_Message_Float_Set *)em->msg)->count; - lua_createtable(ed->L, c, 0); // Stack usage [-0, +1, m] + lua_createtable(ed->L, c, 0); // Stack usage [-0, +1, m] for (i = 0; i < c; i++) { lua_pushnumber(ed->L, ((Edje_Message_Float_Set *)em->msg)->val[i]); - // Stack usage [-0, +1, -] - lua_rawseti(ed->L, -2, i + 1); // Stack usage [-1, +0, m] + // Stack usage [-0, +1, -] + lua_rawseti(ed->L, -2, i + 1); // Stack usage [-1, +0, m] } n += 1; break; - case EDJE_MESSAGE_STRING_INT: - lua_pushstring(ed->L, "strint"); // Stack usage [-0, +1, m] + + case EDJE_MESSAGE_STRING_INT: + lua_pushstring(ed->L, "strint"); // Stack usage [-0, +1, m] lua_pushstring(ed->L, ((Edje_Message_String_Int *)em->msg)->str); - // Stack usage [-0, +1, m] + // Stack usage [-0, +1, m] lua_pushinteger(ed->L, ((Edje_Message_String_Int *)em->msg)->val); - // Stack usage [-0, +1, -] + // Stack usage [-0, +1, -] n += 2; break; - case EDJE_MESSAGE_STRING_FLOAT: - lua_pushstring(ed->L, "strfloat"); // Stack usage [-0, +1, m] + + case EDJE_MESSAGE_STRING_FLOAT: + lua_pushstring(ed->L, "strfloat"); // Stack usage [-0, +1, m] lua_pushstring(ed->L, ((Edje_Message_String_Float *)em->msg)->str); - // Stack usage [-0, +1, m] + // Stack usage [-0, +1, m] lua_pushnumber(ed->L, ((Edje_Message_String_Float *)em->msg)->val); - // Stack usage [-0, +1, -] + // Stack usage [-0, +1, -] n += 2; break; - case EDJE_MESSAGE_STRING_INT_SET: - lua_pushstring(ed->L, "strintset"); // Stack usage [-0, +1, m] + + case EDJE_MESSAGE_STRING_INT_SET: + lua_pushstring(ed->L, "strintset"); // Stack usage [-0, +1, m] lua_pushstring(ed->L, ((Edje_Message_String_Int_Set *)em->msg)->str); - // Stack usage [-0, +1, m] + // Stack usage [-0, +1, m] c = ((Edje_Message_String_Int_Set *)em->msg)->count; - lua_createtable(ed->L, c, 0); // Stack usage [-0, +1, m] + lua_createtable(ed->L, c, 0); // Stack usage [-0, +1, m] for (i = 0; i < c; i++) { lua_pushinteger(ed->L, ((Edje_Message_String_Int_Set *)em->msg)->val[i]); - // Stack usage [-0, +1, -] - lua_rawseti(ed->L, -2, i + 1); // Stack usage [-1, +0, m] + // Stack usage [-0, +1, -] + lua_rawseti(ed->L, -2, i + 1); // Stack usage [-1, +0, m] } n += 2; break; - case EDJE_MESSAGE_STRING_FLOAT_SET: - lua_pushstring(ed->L, "strfloatset"); // Stack usage [-0, +1, m] + + case EDJE_MESSAGE_STRING_FLOAT_SET: + lua_pushstring(ed->L, "strfloatset"); // Stack usage [-0, +1, m] lua_pushstring(ed->L, ((Edje_Message_String_Float_Set *)em->msg)->str); - // Stack usage [-0, +1, m] + // Stack usage [-0, +1, m] c = ((Edje_Message_String_Float_Set *)em->msg)->count; - lua_createtable(ed->L, c, 0); // Stack usage [-0, +1, m] + lua_createtable(ed->L, c, 0); // Stack usage [-0, +1, m] for (i = 0; i < c; i++) { lua_pushnumber(ed->L, ((Edje_Message_String_Float_Set *)em->msg)->val[i]); - // Stack usage [-0, +1, -] - lua_rawseti(ed->L, -2, i + 1); // Stack usage [-1, +0, m] + // Stack usage [-0, +1, -] + lua_rawseti(ed->L, -2, i + 1); // Stack usage [-1, +0, m] } n += 2; break; - default: + + default: break; } - if ((err = lua_pcall(ed->L, n, 0, 0))) // Stack usage [-n+1, +0, -] + if ((err = lua_pcall(ed->L, n, 0, 0))) // Stack usage [-n+1, +0, -] _edje_lua2_error(ed->L, err); } else - lua_pop(ed->L, 1); // Stack usage [-n, +0, -] + lua_pop(ed->L, 1); // Stack usage [-n, +0, -] } /** -@page luaref -@subsection edje_signal Edje signal(signal, source) callback. + @page luaref + @subsection edje_signal Edje signal(signal, source) callback. -If a function called "signal" exists in a lua edje group, then it is called when -ever a signal arrives, with the signal details passed to it. + If a function called "signal" exists in a lua edje group, then it is called when + ever a signal arrives, with the signal details passed to it. -*/ + */ void _edje_lua2_script_func_signal(Edje *ed, const char *sig, const char *src) // Stack usage [-3, +3, em] or [-1, +1, e] if no matching function. { @@ -4429,3 +4458,4 @@ _edje_lua2_script_func_signal(Edje *ed, const char *sig, const char *src) // St else lua_pop(ed->L, 1); } + diff --git a/src/lib/edje/edje_lua_script_only.c b/src/lib/edje/edje_lua_script_only.c index e283c83329..2a0b82bcd2 100644 --- a/src/lib/edje/edje_lua_script_only.c +++ b/src/lib/edje/edje_lua_script_only.c @@ -4,7 +4,7 @@ Eina_Bool _edje_lua_script_only(Edje *ed) { if ((ed->collection) && (ed->collection->lua_script_only)) - return EINA_TRUE; + return EINA_TRUE; return EINA_FALSE; } @@ -12,48 +12,48 @@ void _edje_lua_script_only_init(Edje *ed) { if (ed->collection) - _edje_lua2_script_init(ed); + _edje_lua2_script_init(ed); } void _edje_lua_script_only_shutdown(Edje *ed) { if (ed->collection && ed->L) - _edje_lua2_script_func_shutdown(ed); + _edje_lua2_script_func_shutdown(ed); } void -_edje_lua_script_only_show(Edje * ed) +_edje_lua_script_only_show(Edje *ed) { if (ed->collection && ed->L) - _edje_lua2_script_func_show(ed); + _edje_lua2_script_func_show(ed); } void -_edje_lua_script_only_hide(Edje * ed) +_edje_lua_script_only_hide(Edje *ed) { if (ed->collection && ed->L) - _edje_lua2_script_func_hide(ed); + _edje_lua2_script_func_hide(ed); } void -_edje_lua_script_only_move(Edje * ed) +_edje_lua_script_only_move(Edje *ed) { if (ed->collection && ed->L) - _edje_lua2_script_func_move(ed); + _edje_lua2_script_func_move(ed); } void -_edje_lua_script_only_resize(Edje * ed) +_edje_lua_script_only_resize(Edje *ed) { if (ed->collection && ed->L) - _edje_lua2_script_func_resize(ed); + _edje_lua2_script_func_resize(ed); } void -_edje_lua_script_only_message(Edje * ed, Edje_Message * em) +_edje_lua_script_only_message(Edje *ed, Edje_Message *em) { if (ed->collection && ed->L) - _edje_lua2_script_func_message(ed, em); + _edje_lua2_script_func_message(ed, em); } diff --git a/src/lib/edje/edje_main.c b/src/lib/edje/edje_main.c index 9c474dc224..03c46eacab 100644 --- a/src/lib/edje/edje_main.c +++ b/src/lib/edje/edje_main.c @@ -1,7 +1,7 @@ #include "edje_private.h" static Edje_Version _version = { VMAJ, VMIN, VMIC, VREV }; -EAPI Edje_Version *edje_version = &_version; +EAPI Edje_Version * edje_version = &_version; static int _edje_init_count = 0; static Eina_Bool _need_imf = EINA_FALSE; @@ -14,16 +14,16 @@ Eina_Cow *_edje_calc_params_map_cow = NULL; Eina_Cow *_edje_calc_params_physics_cow = NULL; static const Edje_Calc_Params_Map default_calc_map = { - { 0, 0, 0 }, { 0.0, 0.0, 0.0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0.0, 0.0 }, NULL, 0 + { 0, 0, 0 }, { 0.0, 0.0, 0.0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0.0, 0.0 }, NULL, 0 }; static const Edje_Calc_Params_Physics default_calc_physics = { - 0.0, 0.0, 0.0, 0.0, 0.0, { 0.0, 0.0 }, { 0.0, 0.0 }, 0, 0, { { 0, 0, 0 }, { 0, 0, 0 } }, 0, 0, 0, 0 + 0.0, 0.0, 0.0, 0.0, 0.0, { 0.0, 0.0 }, { 0.0, 0.0 }, 0, 0, { { 0, 0, 0 }, { 0, 0, 0 } }, 0, 0, 0, 0 }; /*============================================================================* - * API * - *============================================================================*/ +* API * +*============================================================================*/ EAPI int edje_init(void) { @@ -38,7 +38,7 @@ edje_init(void) return --_edje_init_count; _edje_default_log_dom = eina_log_domain_register - ("edje", EDJE_DEFAULT_LOG_COLOR); + ("edje", EDJE_DEFAULT_LOG_COLOR); if (_edje_default_log_dom < 0) { EINA_LOG_ERR("Edje Can not create a general log domain."); @@ -59,14 +59,14 @@ edje_init(void) if (!eet_init()) { - ERR("Eet init failed"); - goto shutdown_embryo; + ERR("Eet init failed"); + goto shutdown_embryo; } if (!evas_init()) { - ERR("Evas init failed"); - goto shutdown_eet; + ERR("Evas init failed"); + goto shutdown_eet; } if (!efreet_init()) @@ -87,25 +87,25 @@ edje_init(void) edje_signal_init(); _edje_real_part_mp = eina_mempool_add("chained_mempool", - "Edje_Real_Part", NULL, - sizeof (Edje_Real_Part), 256); + "Edje_Real_Part", NULL, + sizeof (Edje_Real_Part), 256); if (!_edje_real_part_mp) { - ERR("Mempool for Edje_Real_Part cannot be allocated."); - goto shutdown_all; + ERR("Mempool for Edje_Real_Part cannot be allocated."); + goto shutdown_all; } _edje_real_part_state_mp = eina_mempool_add("chained_mempool", - "Edje_Real_Part_State", NULL, - sizeof (Edje_Real_Part_State), 64); + "Edje_Real_Part_State", NULL, + sizeof (Edje_Real_Part_State), 64); if (!_edje_real_part_state_mp) { - ERR("Mempool for Edje_Real_Part_State cannot be allocated."); - goto shutdown_all; + ERR("Mempool for Edje_Real_Part_State cannot be allocated."); + goto shutdown_all; } _edje_calc_params_map_cow = eina_cow_add("Edje Calc Params Map", sizeof (Edje_Calc_Params_Map), 8, &default_calc_map, EINA_TRUE); - _edje_calc_params_physics_cow= eina_cow_add("Edje Calc Params Physics", sizeof (Edje_Calc_Params_Physics), 8, &default_calc_physics, EINA_TRUE); + _edje_calc_params_physics_cow = eina_cow_add("Edje Calc Params Physics", sizeof (Edje_Calc_Params_Physics), 8, &default_calc_physics, EINA_TRUE); _edje_language = eina_stringshare_add(getenv("LANGUAGE")); @@ -115,12 +115,12 @@ edje_init(void) eina_strbuf_free(str); eina_log_timing(_edje_default_log_dom, - EINA_LOG_STATE_STOP, - EINA_LOG_STATE_INIT); + EINA_LOG_STATE_STOP, + EINA_LOG_STATE_INIT); return _edje_init_count; - shutdown_all: +shutdown_all: eina_mempool_del(_edje_real_part_state_mp); eina_mempool_del(_edje_real_part_mp); _edje_real_part_state_mp = NULL; @@ -133,18 +133,18 @@ edje_init(void) _edje_text_class_hash_free(); _edje_edd_shutdown(); efreet_shutdown(); - shutdown_evas: +shutdown_evas: evas_shutdown(); - shutdown_eet: +shutdown_eet: eet_shutdown(); - shutdown_embryo: +shutdown_embryo: embryo_shutdown(); - shutdown_ecore: +shutdown_ecore: ecore_shutdown(); - unregister_log_domain: +unregister_log_domain: eina_log_domain_unregister(_edje_default_log_dom); _edje_default_log_dom = -1; - shutdown_eina: +shutdown_eina: eina_shutdown(); return --_edje_init_count; } @@ -157,8 +157,8 @@ _edje_shutdown_core(void) if (_edje_users > 0) return; eina_log_timing(_edje_default_log_dom, - EINA_LOG_STATE_START, - EINA_LOG_STATE_SHUTDOWN); + EINA_LOG_STATE_START, + EINA_LOG_STATE_SHUTDOWN); _edje_file_cache_shutdown(); _edje_color_class_members_free(); @@ -251,8 +251,8 @@ _edje_del(Edje *ed) if (ed->processing_messages) { - ed->delete_me = EINA_TRUE; - return; + ed->delete_me = EINA_TRUE; + return; } _edje_message_del(ed); _edje_signal_callback_free(ed->callbacks); @@ -264,7 +264,7 @@ _edje_del(Edje *ed) ed->group = NULL; if ((ed->actions) || (ed->pending_actions)) { - _edje_animators = eina_list_remove(_edje_animators, ed); + _edje_animators = eina_list_remove(_edje_animators, ed); } EINA_LIST_FREE(ed->actions, runp) free(runp); @@ -273,9 +273,9 @@ _edje_del(Edje *ed) eina_hash_free(ed->color_classes); EINA_LIST_FREE(ed->text_classes, tc) { - if (tc->name) eina_stringshare_del(tc->name); - if (tc->font) eina_stringshare_del(tc->font); - free(tc); + if (tc->name) eina_stringshare_del(tc->name); + if (tc->font) eina_stringshare_del(tc->font); + free(tc); } EINA_LIST_FREE(ed->text_insert_filter_callbacks, cb) { @@ -324,3 +324,4 @@ _edje_need_imf(void) ecore_imf_init(); #endif } + diff --git a/src/lib/edje/edje_match.c b/src/lib/edje/edje_match.c index 573191fb4d..57e319bdb9 100644 --- a/src/lib/edje/edje_match.c +++ b/src/lib/edje/edje_match.c @@ -2,33 +2,33 @@ /* States manipulations. */ -typedef struct _Edje_State Edje_State; +typedef struct _Edje_State Edje_State; struct _Edje_State { - unsigned int idx; - unsigned int pos; + unsigned int idx; + unsigned int pos; }; struct _Edje_States { - unsigned int size; - Edje_State *states; - Eina_Bool *has; + unsigned int size; + Edje_State *states; + Eina_Bool *has; }; static void _edje_match_states_free(Edje_States *states, unsigned int states_size) { - (void) states_size; + (void)states_size; free(states); } -#define ALIGN(Size) \ - { \ - Size--; \ - Size |= sizeof (void*) - 1; \ - Size++; \ +#define ALIGN(Size) \ + { \ + Size--; \ + Size |= sizeof (void *) - 1; \ + Size++; \ }; static int @@ -41,15 +41,15 @@ _edje_match_states_alloc(Edje_Patterns *ppat, int n) const unsigned int array_len = (patterns_max_length + 1) * patterns_size; - unsigned int states_size; - unsigned int has_size; - unsigned int states_has_size; - unsigned int struct_size; + unsigned int states_size; + unsigned int has_size; + unsigned int states_has_size; + unsigned int struct_size; - unsigned char *states; - unsigned char *has; + unsigned char *states; + unsigned char *has; - int i; + int i; states_size = sizeof (*l->states) * array_len; ALIGN(states_size); @@ -69,16 +69,16 @@ _edje_match_states_alloc(Edje_Patterns *ppat, int n) ppat->states = l; ppat->states->size = 0; - states = (unsigned char *) (l + n); + states = (unsigned char *)(l + n); has = states + states_size; for (i = 0; i < n; ++i) { - l[i].states = (Edje_State *) states; - l[i].has = (Eina_Bool *) has; + l[i].states = (Edje_State *)states; + l[i].has = (Eina_Bool *)has; l[i].size = 0; - memset(l[i].has, 0, has_size); + memset(l[i].has, 0, has_size); states += states_has_size; has += states_has_size; @@ -99,7 +99,7 @@ _edje_match_states_insert(Edje_States *list, if (i < list->size) { - if (list->has[i]) return; + if (list->has[i]) return; } list->has[i] = 1; @@ -122,17 +122,17 @@ _edje_match_states_clear(Edje_States *list, enum status { - patterns_not_found = 0, - patterns_found = 1, - patterns_syntax_error = 2 + patterns_not_found = 0, + patterns_found = 1, + patterns_syntax_error = 2 }; static unsigned int -_edje_match_patterns_exec_class_token(enum status *status, - const char *cl_tok, - char c) +_edje_match_patterns_exec_class_token(enum status *status, + const char *cl_tok, + char c) { - if (! *cl_tok) + if (!*cl_tok) { *status = patterns_syntax_error; return 0; @@ -140,13 +140,13 @@ _edje_match_patterns_exec_class_token(enum status *status, else if (cl_tok[1] == '-' && cl_tok[2] != ']') { if (*cl_tok <= c && c <= cl_tok[2]) - *status = patterns_found; + *status = patterns_found; return 3; } else { if (c == *cl_tok) - *status = patterns_found; + *status = patterns_found; return 1; } } @@ -157,29 +157,29 @@ _edje_match_patterns_exec_class_complement(const char *cl_tok, unsigned int *ret switch (*cl_tok) { case 0: - return EDJE_MATCH_SYNTAX_ERROR; + return EDJE_MATCH_SYNTAX_ERROR; case '!': *ret = 1; - return EDJE_MATCH_OK; + return EDJE_MATCH_OK; default: - *ret = 0; - return EDJE_MATCH_OK; + *ret = 0; + return EDJE_MATCH_OK; } } static Edje_Match_Error -_edje_match_patterns_exec_class(const char *cl, - char c, +_edje_match_patterns_exec_class(const char *cl, + char c, unsigned int *ret) { enum status status = patterns_not_found; - int pos = 1; + int pos = 1; unsigned int neg; if (_edje_match_patterns_exec_class_complement(cl + 1, &neg) != EDJE_MATCH_OK) - return EDJE_MATCH_SYNTAX_ERROR; + return EDJE_MATCH_SYNTAX_ERROR; pos += neg; @@ -189,43 +189,43 @@ _edje_match_patterns_exec_class(const char *cl, } while (cl[pos] && cl[pos] != ']'); - if (status == patterns_syntax_error || ! cl[pos]) - return EDJE_MATCH_SYNTAX_ERROR; + if (status == patterns_syntax_error || !cl[pos]) + return EDJE_MATCH_SYNTAX_ERROR; if (status == patterns_found) - *ret = neg ? 0 : pos + 1; + *ret = neg ? 0 : pos + 1; else - *ret = neg ? pos + 1 : 0; + *ret = neg ? pos + 1 : 0; return EDJE_MATCH_OK; } static Edje_Match_Error -_edje_match_patterns_exec_token(const char *tok, - char c, +_edje_match_patterns_exec_token(const char *tok, + char c, unsigned int *ret) { - switch (*tok) - { - case '\\': - if (tok[1]) - { - *ret = tok[1] == c ? 2 : 0; - return EDJE_MATCH_OK; - } - return EDJE_MATCH_SYNTAX_ERROR; + switch (*tok) + { + case '\\': + if (tok[1]) + { + *ret = tok[1] == c ? 2 : 0; + return EDJE_MATCH_OK; + } + return EDJE_MATCH_SYNTAX_ERROR; - case '?': - *ret = 1; - return EDJE_MATCH_OK; + case '?': + *ret = 1; + return EDJE_MATCH_OK; - case '[': - return _edje_match_patterns_exec_class(tok, c, ret); + case '[': + return _edje_match_patterns_exec_class(tok, c, ret); - default: - *ret = *tok == c ? 1 : 0; - return EDJE_MATCH_OK; - } + default: + *ret = *tok == c ? 1 : 0; + return EDJE_MATCH_OK; + } } static void @@ -247,205 +247,205 @@ _edje_match_patterns_exec_init_states(Edje_States *states, /* Exported function. */ -#define EDJE_MATCH_INIT_LIST(Func, Type, Source, Show) \ - Edje_Patterns* \ - Func(const Eina_List *lst) \ - { \ - Edje_Patterns *r; \ - unsigned int i; \ - \ - if (!lst || eina_list_count(lst) <= 0) \ - return NULL; \ - \ - r = malloc(sizeof (Edje_Patterns) + \ - eina_list_count(lst) \ - * sizeof(*r->finals) \ - * sizeof(*r->patterns)); \ - if (!r) return NULL; \ - \ - r->ref = 1; \ - r->delete_me = EINA_FALSE; \ - r->patterns_size = eina_list_count(lst); \ - r->max_length = 0; \ - r->patterns = (const char **) r->finals + r->patterns_size + 1; \ - \ - for (i = 0; lst; ++i) \ - { \ - const char *str; \ - Type *data; \ - unsigned int j; \ - int special = 0; \ - \ - data = eina_list_data_get(lst); \ - if (!data) \ - { \ - free(r); \ - return NULL; \ - } \ - \ - str = data->Source; \ - if (!str) str = ""; \ - r->patterns[i] = str; \ - \ - if (Show) \ - INF("%lu [%s]", (unsigned long)i, str); \ - \ - r->finals[i] = 0; \ - for (j = 0; str[j]; ++j) \ - if (str[j] != '*') \ - { \ - r->finals[i] = j + 1; \ - special++; \ - } \ - j += special ? special + 1 : 0; \ - \ - if (j > r->max_length) \ - r->max_length = j; \ - \ - lst = eina_list_next(lst); \ - } \ - \ - if (!_edje_match_states_alloc(r, 2)) \ - { \ - free(r); \ - return NULL; \ - } \ - \ - return r; \ +#define EDJE_MATCH_INIT_LIST(Func, Type, Source, Show) \ + Edje_Patterns * \ + Func(const Eina_List *lst) \ + { \ + Edje_Patterns *r; \ + unsigned int i; \ + \ + if (!lst || eina_list_count(lst) <= 0) \ + return NULL; \ + \ + r = malloc(sizeof (Edje_Patterns) + \ + eina_list_count(lst) \ + * sizeof(*r->finals) \ + * sizeof(*r->patterns)); \ + if (!r) return NULL; \ + \ + r->ref = 1; \ + r->delete_me = EINA_FALSE; \ + r->patterns_size = eina_list_count(lst); \ + r->max_length = 0; \ + r->patterns = (const char **)r->finals + r->patterns_size + 1; \ + \ + for (i = 0; lst; ++i) \ + { \ + const char *str; \ + Type *data; \ + unsigned int j; \ + int special = 0; \ + \ + data = eina_list_data_get(lst); \ + if (!data) \ + { \ + free(r); \ + return NULL; \ + } \ + \ + str = data->Source; \ + if (!str) str = ""; \ + r->patterns[i] = str; \ + \ + if (Show) \ + INF("%lu [%s]", (unsigned long)i, str); \ + \ + r->finals[i] = 0; \ + for (j = 0; str[j]; ++j) \ + if (str[j] != '*') \ + { \ + r->finals[i] = j + 1; \ + special++; \ + } \ + j += special ? special + 1 : 0; \ + \ + if (j > r->max_length) \ + r->max_length = j; \ + \ + lst = eina_list_next(lst); \ + } \ + \ + if (!_edje_match_states_alloc(r, 2)) \ + { \ + free(r); \ + return NULL; \ + } \ + \ + return r; \ } -#define EDJE_MATCH_INIT_ARRAY(Func, Type, Source, Show) \ - Edje_Patterns* \ - Func(Type * const *lst, unsigned int count) \ - { \ - Edje_Patterns *r; \ - unsigned int i; \ - \ - if (!lst || count == 0) \ - return NULL; \ - \ - r = malloc(sizeof (Edje_Patterns) + \ - count \ - * sizeof(*r->finals) \ - * sizeof(*r->patterns)); \ - if (!r) return NULL; \ - \ - r->ref = 1; \ - r->delete_me = EINA_FALSE; \ - r->patterns_size = count; \ - r->max_length = 0; \ - r->patterns = (const char **) r->finals + r->patterns_size + 1; \ - \ - for (i = 0; i < count; ++i) \ - { \ - const char *str; \ - unsigned int j; \ - int special = 0; \ - \ - if (!lst[i]) \ - { \ - free(r); \ - return NULL; \ - } \ - \ - str = lst[i]->Source; \ - if (!str) str = ""; \ - r->patterns[i] = str; \ - \ - if (Show) \ - INF("%lu [%s]", (unsigned long)i, str); \ - \ - r->finals[i] = 0; \ - for (j = 0; str[j]; ++j) \ - if (str[j] != '*') \ - { \ - r->finals[i] = j + 1; \ - special++; \ - } \ - j += special ? special + 1 : 0; \ - \ - if (j > r->max_length) \ - r->max_length = j; \ - } \ - \ - if (!_edje_match_states_alloc(r, 2)) \ - { \ - free(r); \ - return NULL; \ - } \ - \ - return r; \ +#define EDJE_MATCH_INIT_ARRAY(Func, Type, Source, Show) \ + Edje_Patterns * \ + Func(Type * const *lst, unsigned int count) \ + { \ + Edje_Patterns *r; \ + unsigned int i; \ + \ + if (!lst || count == 0) \ + return NULL; \ + \ + r = malloc(sizeof (Edje_Patterns) + \ + count \ + * sizeof(*r->finals) \ + * sizeof(*r->patterns)); \ + if (!r) return NULL; \ + \ + r->ref = 1; \ + r->delete_me = EINA_FALSE; \ + r->patterns_size = count; \ + r->max_length = 0; \ + r->patterns = (const char **)r->finals + r->patterns_size + 1; \ + \ + for (i = 0; i < count; ++i) \ + { \ + const char *str; \ + unsigned int j; \ + int special = 0; \ + \ + if (!lst[i]) \ + { \ + free(r); \ + return NULL; \ + } \ + \ + str = lst[i]->Source; \ + if (!str) str = ""; \ + r->patterns[i] = str; \ + \ + if (Show) \ + INF("%lu [%s]", (unsigned long)i, str); \ + \ + r->finals[i] = 0; \ + for (j = 0; str[j]; ++j) \ + if (str[j] != '*') \ + { \ + r->finals[i] = j + 1; \ + special++; \ + } \ + j += special ? special + 1 : 0; \ + \ + if (j > r->max_length) \ + r->max_length = j; \ + } \ + \ + if (!_edje_match_states_alloc(r, 2)) \ + { \ + free(r); \ + return NULL; \ + } \ + \ + return r; \ } -#define EDJE_MATCH_INIT_INARRAY(Func, Source, Show) \ - Edje_Patterns* \ - Func(const Eina_Inarray *array, const Edje_Signal_Callback_Match *matches) \ - { \ - Edje_Patterns *r; \ - int *it; \ - unsigned int i = 0; \ - \ - if (!matches) \ - return NULL; \ - \ - r = malloc(sizeof (Edje_Patterns) + \ - eina_inarray_count(array) \ - * sizeof(*r->finals) \ - * sizeof(*r->patterns)); \ - if (!r) return NULL; \ - \ - r->ref = 1; \ - r->delete_me = EINA_FALSE; \ - r->patterns_size = eina_inarray_count(array); \ - r->max_length = 0; \ - r->patterns = (const char **) r->finals + r->patterns_size + 1; \ - \ - EINA_INARRAY_FOREACH(array, it) \ - { \ - const char *str; \ - unsigned int j; \ - int special = 0; \ - \ - str = (matches + *it)->Source; \ - if (!str) str = ""; \ - r->patterns[i] = str; \ - \ - if (Show) \ - INF("%lu [%s]", (unsigned long)i, str); \ - \ - r->finals[i] = 0; \ - for (j = 0; str[j]; ++j) \ - if (str[j] != '*') \ - { \ - r->finals[i] = j + 1; \ - special++; \ - } \ - j += special ? special + 1 : 0; \ - \ - if (j > r->max_length) \ - r->max_length = j; \ - \ - i++; \ - } \ - \ - if (!_edje_match_states_alloc(r, 2)) \ - { \ - free(r); \ - return NULL; \ - } \ - \ - return r; \ +#define EDJE_MATCH_INIT_INARRAY(Func, Source, Show) \ + Edje_Patterns * \ + Func(const Eina_Inarray * array, const Edje_Signal_Callback_Match * matches) \ + { \ + Edje_Patterns *r; \ + int *it; \ + unsigned int i = 0; \ + \ + if (!matches) \ + return NULL; \ + \ + r = malloc(sizeof (Edje_Patterns) + \ + eina_inarray_count(array) \ + * sizeof(*r->finals) \ + * sizeof(*r->patterns)); \ + if (!r) return NULL; \ + \ + r->ref = 1; \ + r->delete_me = EINA_FALSE; \ + r->patterns_size = eina_inarray_count(array); \ + r->max_length = 0; \ + r->patterns = (const char **)r->finals + r->patterns_size + 1; \ + \ + EINA_INARRAY_FOREACH(array, it) \ + { \ + const char *str; \ + unsigned int j; \ + int special = 0; \ + \ + str = (matches + *it)->Source; \ + if (!str) str = ""; \ + r->patterns[i] = str; \ + \ + if (Show) \ + INF("%lu [%s]", (unsigned long)i, str); \ + \ + r->finals[i] = 0; \ + for (j = 0; str[j]; ++j) \ + if (str[j] != '*') \ + { \ + r->finals[i] = j + 1; \ + special++; \ + } \ + j += special ? special + 1 : 0; \ + \ + if (j > r->max_length) \ + r->max_length = j; \ + \ + i++; \ + } \ + \ + if (!_edje_match_states_alloc(r, 2)) \ + { \ + free(r); \ + return NULL; \ + } \ + \ + return r; \ } EDJE_MATCH_INIT_LIST(edje_match_collection_dir_init, - Edje_Part_Collection_Directory_Entry, - entry, 0); + Edje_Part_Collection_Directory_Entry, + entry, 0); EDJE_MATCH_INIT_ARRAY(edje_match_programs_signal_init, - Edje_Program, - signal, 0); + Edje_Program, + signal, 0); EDJE_MATCH_INIT_ARRAY(edje_match_programs_source_init, - Edje_Program, - source, 0); + Edje_Program, + source, 0); EDJE_MATCH_INIT_INARRAY(edje_match_callback_signal_init, signal, 0); EDJE_MATCH_INIT_INARRAY(edje_match_callback_source_init, @@ -453,14 +453,14 @@ EDJE_MATCH_INIT_INARRAY(edje_match_callback_source_init, static Eina_Bool _edje_match_collection_dir_exec_finals(const unsigned int *finals, - const Edje_States *states) + const Edje_States *states) { - unsigned int i; + unsigned int i; for (i = 0; i < states->size; ++i) { if (states->states[i].pos >= finals[states->states[i].idx]) - return EINA_TRUE; + return EINA_TRUE; } return EINA_FALSE; } @@ -468,12 +468,12 @@ _edje_match_collection_dir_exec_finals(const unsigned int *finals, static Eina_Bool edje_match_programs_exec_check_finals(const unsigned int *signal_finals, const unsigned int *source_finals, - const Edje_States *signal_states, - const Edje_States *source_states, - Edje_Program **programs, + const Edje_States *signal_states, + const Edje_States *source_states, + Edje_Program **programs, Eina_Bool (*func)(Edje_Program *pr, void *data), - void *data, - Eina_Bool prop EINA_UNUSED) + void *data, + Eina_Bool prop EINA_UNUSED) { unsigned int i; unsigned int j; @@ -490,13 +490,13 @@ edje_match_programs_exec_check_finals(const unsigned int *signal_finals, if (signal_states->states[i].idx == source_states->states[j].idx && source_states->states[j].pos >= source_finals[source_states->states[j].idx]) { - Edje_Program *pr; + Edje_Program *pr; pr = programs[signal_states->states[i].idx]; if (pr) { if (func(pr, data)) - return EINA_FALSE; + return EINA_FALSE; } } } @@ -508,19 +508,19 @@ edje_match_programs_exec_check_finals(const unsigned int *signal_finals, static int edje_match_callback_exec_check_finals(const Edje_Signals_Sources_Patterns *ssp, - const Edje_Signal_Callback_Match *matches, + const Edje_Signal_Callback_Match *matches, const Edje_States *signal_states, const Edje_States *source_states, - const char *sig, - const char *source, - Edje *ed, - Eina_Bool prop) + const char *sig, + const char *source, + Edje *ed, + Eina_Bool prop) { const Edje_Signal_Callback_Match *cb; - Eina_Array run; + Eina_Array run; unsigned int i; unsigned int j; - int r = 1; + int r = 1; eina_array_step_set(&run, sizeof (Eina_Array), 4); @@ -539,9 +539,9 @@ edje_match_callback_exec_check_finals(const Edje_Signals_Sources_Patterns *ssp, cb = &matches[*e]; if (cb) { - if ((prop) && ed->callbacks->flags[*e].propagate) continue; - eina_array_push(&run, cb); - r = 2; + if ((prop) && ed->callbacks->flags[*e].propagate) continue; + eina_array_push(&run, cb); + r = 2; } } } @@ -551,11 +551,11 @@ edje_match_callback_exec_check_finals(const Edje_Signals_Sources_Patterns *ssp, { int idx = cb - matches; - if (ed->callbacks->flags[idx].delete_me) continue; + if (ed->callbacks->flags[idx].delete_me) continue; - cb->func((void*) ed->callbacks->custom_data[idx], ed->obj, sig, source); + cb->func((void *)ed->callbacks->custom_data[idx], ed->obj, sig, source); if (_edje_block_break(ed)) - { + { r = 0; break; } @@ -571,18 +571,17 @@ edje_match_callback_exec_check_finals(const Edje_Signals_Sources_Patterns *ssp, return r; } - -static Edje_States* -_edje_match_fn(const Edje_Patterns *ppat, - const char *string, - Edje_States *states) +static Edje_States * +_edje_match_fn(const Edje_Patterns *ppat, + const char *string, + Edje_States *states) { - Edje_States *new_states = states + 1; - const char *c; + Edje_States *new_states = states + 1; + const char *c; for (c = string; *c && states->size; ++c) { - unsigned int i; + unsigned int i; _edje_match_states_clear(new_states, ppat->patterns_size, ppat->max_length); @@ -592,7 +591,7 @@ _edje_match_fn(const Edje_Patterns *ppat, const unsigned int pos = states->states[i].pos; if (!ppat->patterns[idx][pos]) - continue; + continue; else if (ppat->patterns[idx][pos] == '*') { _edje_match_states_insert(states, ppat->max_length, idx, pos + 1); @@ -605,29 +604,29 @@ _edje_match_fn(const Edje_Patterns *ppat, if (_edje_match_patterns_exec_token(ppat->patterns[idx] + pos, *c, &m) != EDJE_MATCH_OK) - return NULL; + return NULL; if (m) - _edje_match_states_insert(new_states, ppat->max_length, idx, pos + m); + _edje_match_states_insert(new_states, ppat->max_length, idx, pos + m); } } - { - Edje_States *tmp = states; + { + Edje_States *tmp = states; - states = new_states; - new_states = tmp; - } + states = new_states; + new_states = tmp; + } } return states; } Eina_Bool -edje_match_collection_dir_exec(const Edje_Patterns *ppat, - const char *string) +edje_match_collection_dir_exec(const Edje_Patterns *ppat, + const char *string) { - Edje_States *result; - Eina_Bool r = EINA_FALSE; + Edje_States *result; + Eina_Bool r = EINA_FALSE; /* under high memory presure, it could be NULL */ if (!ppat) return EINA_FALSE; @@ -637,24 +636,24 @@ edje_match_collection_dir_exec(const Edje_Patterns *ppat, result = _edje_match_fn(ppat, string, ppat->states); if (result) - r = _edje_match_collection_dir_exec_finals(ppat->finals, result); + r = _edje_match_collection_dir_exec_finals(ppat->finals, result); return r; } Eina_Bool -edje_match_programs_exec(const Edje_Patterns *ppat_signal, - const Edje_Patterns *ppat_source, - const char *sig, - const char *source, - Edje_Program **programs, +edje_match_programs_exec(const Edje_Patterns *ppat_signal, + const Edje_Patterns *ppat_source, + const char *sig, + const char *source, + Edje_Program **programs, Eina_Bool (*func)(Edje_Program *pr, void *data), - void *data, - Eina_Bool prop) + void *data, + Eina_Bool prop) { - Edje_States *signal_result; - Edje_States *source_result; - Eina_Bool r = EINA_FALSE; + Edje_States *signal_result; + Edje_States *source_result; + Eina_Bool r = EINA_FALSE; /* under high memory presure, they could be NULL */ if (!ppat_source || !ppat_signal) return EINA_FALSE; @@ -670,28 +669,28 @@ edje_match_programs_exec(const Edje_Patterns *ppat_signal, source_result = _edje_match_fn(ppat_source, source, ppat_source->states); if (signal_result && source_result) - r = edje_match_programs_exec_check_finals(ppat_signal->finals, - ppat_source->finals, - signal_result, - source_result, - programs, - func, - data, - prop); + r = edje_match_programs_exec_check_finals(ppat_signal->finals, + ppat_source->finals, + signal_result, + source_result, + programs, + func, + data, + prop); return r; } int edje_match_callback_exec(const Edje_Signals_Sources_Patterns *ssp, - const Edje_Signal_Callback_Match *matches, + const Edje_Signal_Callback_Match *matches, const char *sig, const char *source, Edje *ed, Eina_Bool prop) { - Edje_States *signal_result; - Edje_States *source_result; - int r = 0; + Edje_States *signal_result; + Edje_States *source_result; + int r = 0; /* under high memory presure, they could be NULL */ if (!ssp->sources_patterns || !ssp->signals_patterns) return 0; @@ -710,7 +709,7 @@ edje_match_callback_exec(const Edje_Signals_Sources_Patterns *ssp, if (signal_result && source_result) r = edje_match_callback_exec_check_finals(ssp, - matches, + matches, signal_result, source_result, sig, @@ -750,8 +749,8 @@ _edje_signals_sources_patterns_clean(Edje_Signals_Sources_Patterns *ssp) static Eina_Rbtree_Direction _edje_signal_source_node_cmp(const Edje_Signal_Source_Char *n1, - const Edje_Signal_Source_Char *n2, - EINA_UNUSED void *data) + const Edje_Signal_Source_Char *n2, + EINA_UNUSED void *data) { int cmp; @@ -763,9 +762,9 @@ _edje_signal_source_node_cmp(const Edje_Signal_Source_Char *n1, static int _edje_signal_source_key_cmp(const Edje_Signal_Source_Char *node, - const char *sig, - EINA_UNUSED int length, - const char *source) + const char *sig, + EINA_UNUSED int length, + const char *source) { int cmp; @@ -775,11 +774,10 @@ _edje_signal_source_key_cmp(const Edje_Signal_Source_Char *node, return strcmp(node->source, source); } - Eina_List * -edje_match_program_hash_build(Edje_Program * const *programs, - unsigned int count, - Eina_Rbtree **tree) +edje_match_program_hash_build(Edje_Program *const *programs, + unsigned int count, + Eina_Rbtree **tree) { Eina_List *result = NULL; Eina_Rbtree *new = NULL; @@ -787,30 +785,30 @@ edje_match_program_hash_build(Edje_Program * const *programs, for (i = 0; i < count; ++i) { - if (programs[i]->signal && !strpbrk(programs[i]->signal, "*?[\\") - && programs[i]->source && !strpbrk(programs[i]->source, "*?[\\")) - { - Edje_Signal_Source_Char *item; + if (programs[i]->signal && !strpbrk(programs[i]->signal, "*?[\\") + && programs[i]->source && !strpbrk(programs[i]->source, "*?[\\")) + { + Edje_Signal_Source_Char *item; - item = (Edje_Signal_Source_Char*) eina_rbtree_inline_lookup(new, programs[i]->signal, 0, - EINA_RBTREE_CMP_KEY_CB(_edje_signal_source_key_cmp), programs[i]->source); - if (!item) - { - item = malloc(sizeof (Edje_Signal_Source_Char)); - if (!item) continue; + item = (Edje_Signal_Source_Char *)eina_rbtree_inline_lookup(new, programs[i]->signal, 0, + EINA_RBTREE_CMP_KEY_CB(_edje_signal_source_key_cmp), programs[i]->source); + if (!item) + { + item = malloc(sizeof (Edje_Signal_Source_Char)); + if (!item) continue; - item->signal = programs[i]->signal; - item->source = programs[i]->source; - eina_inarray_step_set(&item->list, sizeof (Eina_Inarray), sizeof (void*), 8); + item->signal = programs[i]->signal; + item->source = programs[i]->source; + eina_inarray_step_set(&item->list, sizeof (Eina_Inarray), sizeof (void *), 8); - new = eina_rbtree_inline_insert(new, EINA_RBTREE_GET(item), - EINA_RBTREE_CMP_NODE_CB(_edje_signal_source_node_cmp), NULL); - } + new = eina_rbtree_inline_insert(new, EINA_RBTREE_GET(item), + EINA_RBTREE_CMP_NODE_CB(_edje_signal_source_node_cmp), NULL); + } - eina_inarray_push(&item->list, &programs[i]); - } - else - result = eina_list_prepend(result, programs[i]); + eina_inarray_push(&item->list, &programs[i]); + } + else + result = eina_list_prepend(result, programs[i]); } *tree = new; @@ -819,8 +817,8 @@ edje_match_program_hash_build(Edje_Program * const *programs, void edje_match_callback_hash_build(const Edje_Signal_Callback_Match *callbacks, - int callbacks_count, - Eina_Rbtree **tree, + int callbacks_count, + Eina_Rbtree **tree, Eina_Inarray *result) { Eina_Rbtree *new = NULL; @@ -831,28 +829,28 @@ edje_match_callback_hash_build(const Edje_Signal_Callback_Match *callbacks, for (i = 0; i < callbacks_count; ++i, ++callbacks) { if (callbacks->signal && !strpbrk(callbacks->signal, "*?[\\") - && callbacks->source && !strpbrk(callbacks->source, "*?[\\")) - { - Edje_Signal_Source_Char *item; + && callbacks->source && !strpbrk(callbacks->source, "*?[\\")) + { + Edje_Signal_Source_Char *item; - item = (Edje_Signal_Source_Char*) eina_rbtree_inline_lookup(new, callbacks->signal, 0, - EINA_RBTREE_CMP_KEY_CB(_edje_signal_source_key_cmp), callbacks->source); - if (!item) - { - item = malloc(sizeof (Edje_Signal_Source_Char)); - if (!item) continue; + item = (Edje_Signal_Source_Char *)eina_rbtree_inline_lookup(new, callbacks->signal, 0, + EINA_RBTREE_CMP_KEY_CB(_edje_signal_source_key_cmp), callbacks->source); + if (!item) + { + item = malloc(sizeof (Edje_Signal_Source_Char)); + if (!item) continue; - item->signal = callbacks->signal; - item->source = callbacks->source; + item->signal = callbacks->signal; + item->source = callbacks->source; eina_inarray_step_set(&item->list, sizeof (Eina_Inarray), sizeof (int), 8); - new = eina_rbtree_inline_insert(new, EINA_RBTREE_GET(item), - EINA_RBTREE_CMP_NODE_CB(_edje_signal_source_node_cmp), NULL); - } + new = eina_rbtree_inline_insert(new, EINA_RBTREE_GET(item), + EINA_RBTREE_CMP_NODE_CB(_edje_signal_source_node_cmp), NULL); + } - eina_inarray_push(&item->list, &i); - } - else + eina_inarray_push(&item->list, &i); + } + else { eina_inarray_push(result, &i); } @@ -863,13 +861,13 @@ edje_match_callback_hash_build(const Edje_Signal_Callback_Match *callbacks, const Eina_Inarray * edje_match_signal_source_hash_get(const char *sig, - const char *source, - const Eina_Rbtree *tree) + const char *source, + const Eina_Rbtree *tree) { Edje_Signal_Source_Char *lookup; - lookup = (Edje_Signal_Source_Char*) eina_rbtree_inline_lookup(tree, sig, 0, - EINA_RBTREE_CMP_KEY_CB(_edje_signal_source_key_cmp), source); + lookup = (Edje_Signal_Source_Char *)eina_rbtree_inline_lookup(tree, sig, 0, + EINA_RBTREE_CMP_KEY_CB(_edje_signal_source_key_cmp), source); if (lookup) return &lookup->list; return NULL; @@ -881,3 +879,4 @@ edje_match_signal_source_free(Edje_Signal_Source_Char *key, EINA_UNUSED void *da eina_inarray_flush(&key->list); free(key); } + diff --git a/src/lib/edje/edje_message_queue.c b/src/lib/edje/edje_message_queue.c index 4ed5a07ebe..0ebbcb7e5d 100644 --- a/src/lib/edje/edje_message_queue.c +++ b/src/lib/edje/edje_message_queue.c @@ -12,8 +12,8 @@ static int tmp_msgq_processing = 0; static int tmp_msgq_restart = 0; /*============================================================================* - * API * - *============================================================================*/ +* API * +*============================================================================*/ static void _edje_object_message_popornot_send(Evas_Object *obj, Edje_Message_Type type, int id, void *msg, Eina_Bool prop) @@ -75,8 +75,8 @@ _edje_object_message_signal_process(Eo *obj EINA_UNUSED, Edje *ed) } else { - tmp_msgq = tmpq; - tmpq = NULL; + tmp_msgq = tmpq; + tmpq = NULL; } tmp_msgq_processing++; @@ -87,7 +87,7 @@ again: if (em->edje == lookup_ed) break; if (em->edje != lookup_ed) continue; - tmp_msgq = eina_list_remove_list(tmp_msgq, l); + tmp_msgq = eina_list_remove_list(tmp_msgq, l); if (!lookup_ed->delete_me) { lookup_ed->processing_messages++; @@ -96,7 +96,7 @@ again: lookup_ed->processing_messages--; } else - _edje_message_free(em); + _edje_message_free(em); if (lookup_ed->processing_messages == 0) { if (lookup_ed->delete_me) _edje_del(lookup_ed); @@ -124,9 +124,9 @@ again: end: tmp_msgq_processing--; if (tmp_msgq_processing == 0) - tmp_msgq_restart = 0; + tmp_msgq_restart = 0; else - tmp_msgq_restart = 1; + tmp_msgq_restart = 1; } EAPI void @@ -135,7 +135,6 @@ edje_message_signal_process(void) _edje_message_queue_process(); } - static Eina_Bool _edje_dummy_timer(void *data EINA_UNUSED) { @@ -147,8 +146,8 @@ _edje_job(void *data EINA_UNUSED) { if (_job_loss_timer) { - ecore_timer_del(_job_loss_timer); - _job_loss_timer = NULL; + ecore_timer_del(_job_loss_timer); + _job_loss_timer = NULL; } _job = NULL; _injob++; @@ -189,7 +188,7 @@ _edje_message_shutdown(void) } void -_edje_message_cb_set(Edje *ed, void (*func) (void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg), void *data) +_edje_message_cb_set(Edje *ed, void (*func)(void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg), void *data) { Eina_List *l; Evas_Object *o; @@ -224,119 +223,130 @@ _edje_message_free(Edje_Message *em) { if (em->msg) { - int i; + int i; - switch (em->type) - { - case EDJE_MESSAGE_STRING: - { - Edje_Message_String *emsg; + switch (em->type) + { + case EDJE_MESSAGE_STRING: + { + Edje_Message_String *emsg; - emsg = (Edje_Message_String *)em->msg; - free(emsg->str); - free(emsg); - } - break; - case EDJE_MESSAGE_INT: - { - Edje_Message_Int *emsg; + emsg = (Edje_Message_String *)em->msg; + free(emsg->str); + free(emsg); + } + break; - emsg = (Edje_Message_Int *)em->msg; - free(emsg); - } - break; - case EDJE_MESSAGE_FLOAT: - { - Edje_Message_Float *emsg; + case EDJE_MESSAGE_INT: + { + Edje_Message_Int *emsg; - emsg = (Edje_Message_Float *)em->msg; - free(emsg); - } - break; - case EDJE_MESSAGE_INT_SET: - { - Edje_Message_Int_Set *emsg; + emsg = (Edje_Message_Int *)em->msg; + free(emsg); + } + break; - emsg = (Edje_Message_Int_Set *)em->msg; - free(emsg); - } - break; - case EDJE_MESSAGE_FLOAT_SET: - { - Edje_Message_Float_Set *emsg; + case EDJE_MESSAGE_FLOAT: + { + Edje_Message_Float *emsg; - emsg = (Edje_Message_Float_Set *)em->msg; - free(emsg); - } - break; - case EDJE_MESSAGE_STRING_FLOAT: - { - Edje_Message_String_Float *emsg; + emsg = (Edje_Message_Float *)em->msg; + free(emsg); + } + break; - emsg = (Edje_Message_String_Float *)em->msg; - free(emsg->str); - free(emsg); - } - break; - case EDJE_MESSAGE_STRING_INT: - { - Edje_Message_String_Int *emsg; + case EDJE_MESSAGE_INT_SET: + { + Edje_Message_Int_Set *emsg; - emsg = (Edje_Message_String_Int *)em->msg; - free(emsg->str); - free(emsg); - } - break; - case EDJE_MESSAGE_STRING_FLOAT_SET: - { - Edje_Message_String_Float_Set *emsg; + emsg = (Edje_Message_Int_Set *)em->msg; + free(emsg); + } + break; - emsg = (Edje_Message_String_Float_Set *)em->msg; - free(emsg->str); - free(emsg); - } - break; - case EDJE_MESSAGE_STRING_INT_SET: - { - Edje_Message_String_Int_Set *emsg; + case EDJE_MESSAGE_FLOAT_SET: + { + Edje_Message_Float_Set *emsg; - emsg = (Edje_Message_String_Int_Set *)em->msg; - free(emsg->str); - free(emsg); - } - break; - case EDJE_MESSAGE_SIGNAL: - { - Edje_Message_Signal *emsg; + emsg = (Edje_Message_Float_Set *)em->msg; + free(emsg); + } + break; - emsg = (Edje_Message_Signal *)em->msg; - if (emsg->sig) eina_stringshare_del(emsg->sig); - if (emsg->src) eina_stringshare_del(emsg->src); - if (emsg->data && (--(emsg->data->ref) == 0)) - { - if (emsg->data->free_func) - { - emsg->data->free_func(emsg->data->data); - } - free(emsg->data); - } - free(emsg); - } - break; - case EDJE_MESSAGE_STRING_SET: - { - Edje_Message_String_Set *emsg; + case EDJE_MESSAGE_STRING_FLOAT: + { + Edje_Message_String_Float *emsg; - emsg = (Edje_Message_String_Set *)em->msg; - for (i = 0; i < emsg->count; i++) - free(emsg->str[i]); - free(emsg); - } - break; - case EDJE_MESSAGE_NONE: - default: - break; - } + emsg = (Edje_Message_String_Float *)em->msg; + free(emsg->str); + free(emsg); + } + break; + + case EDJE_MESSAGE_STRING_INT: + { + Edje_Message_String_Int *emsg; + + emsg = (Edje_Message_String_Int *)em->msg; + free(emsg->str); + free(emsg); + } + break; + + case EDJE_MESSAGE_STRING_FLOAT_SET: + { + Edje_Message_String_Float_Set *emsg; + + emsg = (Edje_Message_String_Float_Set *)em->msg; + free(emsg->str); + free(emsg); + } + break; + + case EDJE_MESSAGE_STRING_INT_SET: + { + Edje_Message_String_Int_Set *emsg; + + emsg = (Edje_Message_String_Int_Set *)em->msg; + free(emsg->str); + free(emsg); + } + break; + + case EDJE_MESSAGE_SIGNAL: + { + Edje_Message_Signal *emsg; + + emsg = (Edje_Message_Signal *)em->msg; + if (emsg->sig) eina_stringshare_del(emsg->sig); + if (emsg->src) eina_stringshare_del(emsg->src); + if (emsg->data && (--(emsg->data->ref) == 0)) + { + if (emsg->data->free_func) + { + emsg->data->free_func(emsg->data->data); + } + free(emsg->data); + } + free(emsg); + } + break; + + case EDJE_MESSAGE_STRING_SET: + { + Edje_Message_String_Set *emsg; + + emsg = (Edje_Message_String_Set *)em->msg; + for (i = 0; i < emsg->count; i++) + free(emsg->str[i]); + free(emsg); + } + break; + + case EDJE_MESSAGE_NONE: + default: + break; + } } free(em); } @@ -377,140 +387,152 @@ _edje_message_propornot_send(Edje *ed, Edje_Queue queue, Edje_Message_Type type, switch (em->type) { case EDJE_MESSAGE_NONE: - break; + break; + case EDJE_MESSAGE_SIGNAL: - { - Edje_Message_Signal *emsg2, *emsg3; + { + Edje_Message_Signal *emsg2, *emsg3; + + emsg2 = (Edje_Message_Signal *)emsg; + emsg3 = calloc(1, sizeof(Edje_Message_Signal)); + if (emsg2->sig) emsg3->sig = eina_stringshare_add(emsg2->sig); + if (emsg2->src) emsg3->src = eina_stringshare_add(emsg2->src); + if (emsg2->data) + { + emsg3->data = emsg2->data; + emsg3->data->ref++; + } + msg = (unsigned char *)emsg3; + } + break; - emsg2 = (Edje_Message_Signal *)emsg; - emsg3 = calloc(1, sizeof(Edje_Message_Signal)); - if (emsg2->sig) emsg3->sig = eina_stringshare_add(emsg2->sig); - if (emsg2->src) emsg3->src = eina_stringshare_add(emsg2->src); - if (emsg2->data) - { - emsg3->data = emsg2->data; - emsg3->data->ref++; - } - msg = (unsigned char *)emsg3; - } - break; case EDJE_MESSAGE_STRING: - { - Edje_Message_String *emsg2, *emsg3; + { + Edje_Message_String *emsg2, *emsg3; - emsg2 = (Edje_Message_String *)emsg; + emsg2 = (Edje_Message_String *)emsg; + + emsg3 = malloc(sizeof(Edje_Message_String)); + emsg3->str = strdup(emsg2->str); + msg = (unsigned char *)emsg3; + } + break; - emsg3 = malloc(sizeof(Edje_Message_String)); - emsg3->str = strdup(emsg2->str); - msg = (unsigned char *)emsg3; - } - break; case EDJE_MESSAGE_INT: - { - Edje_Message_Int *emsg2, *emsg3; + { + Edje_Message_Int *emsg2, *emsg3; + + emsg2 = (Edje_Message_Int *)emsg; + emsg3 = malloc(sizeof(Edje_Message_Int)); + emsg3->val = emsg2->val; + msg = (unsigned char *)emsg3; + } + break; - emsg2 = (Edje_Message_Int *)emsg; - emsg3 = malloc(sizeof(Edje_Message_Int)); - emsg3->val = emsg2->val; - msg = (unsigned char *)emsg3; - } - break; case EDJE_MESSAGE_FLOAT: - { - Edje_Message_Float *emsg2, *emsg3; + { + Edje_Message_Float *emsg2, *emsg3; + + emsg2 = (Edje_Message_Float *)emsg; + emsg3 = malloc(sizeof(Edje_Message_Float)); + emsg3->val = emsg2->val; + msg = (unsigned char *)emsg3; + } + break; - emsg2 = (Edje_Message_Float *)emsg; - emsg3 = malloc(sizeof(Edje_Message_Float)); - emsg3->val = emsg2->val; - msg = (unsigned char *)emsg3; - } - break; case EDJE_MESSAGE_STRING_SET: - { - Edje_Message_String_Set *emsg2, *emsg3; + { + Edje_Message_String_Set *emsg2, *emsg3; + + emsg2 = (Edje_Message_String_Set *)emsg; + emsg3 = malloc(sizeof(Edje_Message_String_Set) + ((emsg2->count - 1) * sizeof(char *))); + emsg3->count = emsg2->count; + for (i = 0; i < emsg3->count; i++) + emsg3->str[i] = strdup(emsg2->str[i]); + msg = (unsigned char *)emsg3; + } + break; - emsg2 = (Edje_Message_String_Set *)emsg; - emsg3 = malloc(sizeof(Edje_Message_String_Set) + ((emsg2->count - 1) * sizeof(char *))); - emsg3->count = emsg2->count; - for (i = 0; i < emsg3->count; i++) - emsg3->str[i] = strdup(emsg2->str[i]); - msg = (unsigned char *)emsg3; - } - break; case EDJE_MESSAGE_INT_SET: - { - Edje_Message_Int_Set *emsg2, *emsg3; + { + Edje_Message_Int_Set *emsg2, *emsg3; + + emsg2 = (Edje_Message_Int_Set *)emsg; + emsg3 = malloc(sizeof(Edje_Message_Int_Set) + ((emsg2->count - 1) * sizeof(int))); + emsg3->count = emsg2->count; + for (i = 0; i < emsg3->count; i++) + emsg3->val[i] = emsg2->val[i]; + msg = (unsigned char *)emsg3; + } + break; - emsg2 = (Edje_Message_Int_Set *)emsg; - emsg3 = malloc(sizeof(Edje_Message_Int_Set) + ((emsg2->count - 1) * sizeof(int))); - emsg3->count = emsg2->count; - for (i = 0; i < emsg3->count; i++) - emsg3->val[i] = emsg2->val[i]; - msg = (unsigned char *)emsg3; - } - break; case EDJE_MESSAGE_FLOAT_SET: - { - Edje_Message_Float_Set *emsg2, *emsg3; + { + Edje_Message_Float_Set *emsg2, *emsg3; + + emsg2 = (Edje_Message_Float_Set *)emsg; + emsg3 = malloc(sizeof(Edje_Message_Float_Set) + ((emsg2->count - 1) * sizeof(double))); + emsg3->count = emsg2->count; + for (i = 0; i < emsg3->count; i++) + emsg3->val[i] = emsg2->val[i]; + msg = (unsigned char *)emsg3; + } + break; - emsg2 = (Edje_Message_Float_Set *)emsg; - emsg3 = malloc(sizeof(Edje_Message_Float_Set) + ((emsg2->count - 1) * sizeof(double))); - emsg3->count = emsg2->count; - for (i = 0; i < emsg3->count; i++) - emsg3->val[i] = emsg2->val[i]; - msg = (unsigned char *)emsg3; - } - break; case EDJE_MESSAGE_STRING_INT: - { - Edje_Message_String_Int *emsg2, *emsg3; + { + Edje_Message_String_Int *emsg2, *emsg3; + + emsg2 = (Edje_Message_String_Int *)emsg; + emsg3 = malloc(sizeof(Edje_Message_String_Int)); + emsg3->str = strdup(emsg2->str); + emsg3->val = emsg2->val; + msg = (unsigned char *)emsg3; + } + break; - emsg2 = (Edje_Message_String_Int *)emsg; - emsg3 = malloc(sizeof(Edje_Message_String_Int)); - emsg3->str = strdup(emsg2->str); - emsg3->val = emsg2->val; - msg = (unsigned char *)emsg3; - } - break; case EDJE_MESSAGE_STRING_FLOAT: - { - Edje_Message_String_Float *emsg2, *emsg3; + { + Edje_Message_String_Float *emsg2, *emsg3; + + emsg2 = (Edje_Message_String_Float *)emsg; + emsg3 = malloc(sizeof(Edje_Message_String_Float)); + emsg3->str = strdup(emsg2->str); + emsg3->val = emsg2->val; + msg = (unsigned char *)emsg3; + } + break; - emsg2 = (Edje_Message_String_Float *)emsg; - emsg3 = malloc(sizeof(Edje_Message_String_Float)); - emsg3->str = strdup(emsg2->str); - emsg3->val = emsg2->val; - msg = (unsigned char *)emsg3; - } - break; case EDJE_MESSAGE_STRING_INT_SET: - { - Edje_Message_String_Int_Set *emsg2, *emsg3; + { + Edje_Message_String_Int_Set *emsg2, *emsg3; + + emsg2 = (Edje_Message_String_Int_Set *)emsg; + emsg3 = malloc(sizeof(Edje_Message_String_Int_Set) + ((emsg2->count - 1) * sizeof(int))); + emsg3->str = strdup(emsg2->str); + emsg3->count = emsg2->count; + for (i = 0; i < emsg3->count; i++) + emsg3->val[i] = emsg2->val[i]; + msg = (unsigned char *)emsg3; + } + break; - emsg2 = (Edje_Message_String_Int_Set *)emsg; - emsg3 = malloc(sizeof(Edje_Message_String_Int_Set) + ((emsg2->count - 1) * sizeof(int))); - emsg3->str = strdup(emsg2->str); - emsg3->count = emsg2->count; - for (i = 0; i < emsg3->count; i++) - emsg3->val[i] = emsg2->val[i]; - msg = (unsigned char *)emsg3; - } - break; case EDJE_MESSAGE_STRING_FLOAT_SET: - { - Edje_Message_String_Float_Set *emsg2, *emsg3; + { + Edje_Message_String_Float_Set *emsg2, *emsg3; + + emsg2 = (Edje_Message_String_Float_Set *)emsg; + emsg3 = malloc(sizeof(Edje_Message_String_Float_Set) + ((emsg2->count - 1) * sizeof(double))); + emsg3->str = strdup(emsg2->str); + emsg3->count = emsg2->count; + for (i = 0; i < emsg3->count; i++) + emsg3->val[i] = emsg2->val[i]; + msg = (unsigned char *)emsg3; + } + break; - emsg2 = (Edje_Message_String_Float_Set *)emsg; - emsg3 = malloc(sizeof(Edje_Message_String_Float_Set) + ((emsg2->count - 1) * sizeof(double))); - emsg3->str = strdup(emsg2->str); - emsg3->count = emsg2->count; - for (i = 0; i < emsg3->count; i++) - emsg3->val[i] = emsg2->val[i]; - msg = (unsigned char *)emsg3; - } - break; default: - break; + break; } em->msg = msg; @@ -527,114 +549,125 @@ void _edje_message_parameters_push(Edje_Message *em) { int i; - + /* these params ALWAYS go on */ /* first param is the message type - always */ embryo_parameter_cell_push(em->edje->collection->script, - (Embryo_Cell)em->type); + (Embryo_Cell)em->type); /* 2nd param is the integer of the event id - always there */ embryo_parameter_cell_push(em->edje->collection->script, - (Embryo_Cell)em->id); + (Embryo_Cell)em->id); /* the rest is varags of whatever is in the msg */ switch (em->type) { case EDJE_MESSAGE_NONE: - break; + break; + case EDJE_MESSAGE_STRING: - embryo_parameter_string_push(em->edje->collection->script, - ((Edje_Message_String *)em->msg)->str); - break; + embryo_parameter_string_push(em->edje->collection->script, + ((Edje_Message_String *)em->msg)->str); + break; + case EDJE_MESSAGE_INT: - { - Embryo_Cell v; + { + Embryo_Cell v; + + v = (Embryo_Cell)((Edje_Message_Int *)em->msg)->val; + embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1); + } + break; - v = (Embryo_Cell)((Edje_Message_Int *)em->msg)->val; - embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1); - } - break; case EDJE_MESSAGE_FLOAT: - { - Embryo_Cell v; - float fv; + { + Embryo_Cell v; + float fv; + + fv = ((Edje_Message_Float *)em->msg)->val; + v = EMBRYO_FLOAT_TO_CELL(fv); + embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1); + } + break; - fv = ((Edje_Message_Float *)em->msg)->val; - v = EMBRYO_FLOAT_TO_CELL(fv); - embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1); - } - break; case EDJE_MESSAGE_STRING_SET: - for (i = 0; i < ((Edje_Message_String_Set *)em->msg)->count; i++) - embryo_parameter_string_push(em->edje->collection->script, - ((Edje_Message_String_Set *)em->msg)->str[i]); - break; + for (i = 0; i < ((Edje_Message_String_Set *)em->msg)->count; i++) + embryo_parameter_string_push(em->edje->collection->script, + ((Edje_Message_String_Set *)em->msg)->str[i]); + break; + case EDJE_MESSAGE_INT_SET: - for (i = 0; i < ((Edje_Message_Int_Set *)em->msg)->count; i++) - { - Embryo_Cell v; + for (i = 0; i < ((Edje_Message_Int_Set *)em->msg)->count; i++) + { + Embryo_Cell v; + + v = (Embryo_Cell)((Edje_Message_Int_Set *)em->msg)->val[i]; + embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1); + } + break; - v = (Embryo_Cell)((Edje_Message_Int_Set *)em->msg)->val[i]; - embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1); - } - break; case EDJE_MESSAGE_FLOAT_SET: - for (i = 0; i < ((Edje_Message_Float_Set *)em->msg)->count; i++) - { - Embryo_Cell v; - float fv; + for (i = 0; i < ((Edje_Message_Float_Set *)em->msg)->count; i++) + { + Embryo_Cell v; + float fv; + + fv = ((Edje_Message_Float_Set *)em->msg)->val[i]; + v = EMBRYO_FLOAT_TO_CELL(fv); + embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1); + } + break; - fv = ((Edje_Message_Float_Set *)em->msg)->val[i]; - v = EMBRYO_FLOAT_TO_CELL(fv); - embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1); - } - break; case EDJE_MESSAGE_STRING_INT: - embryo_parameter_string_push(em->edje->collection->script, - ((Edje_Message_String_Int *)em->msg)->str); - { - Embryo_Cell v; + embryo_parameter_string_push(em->edje->collection->script, + ((Edje_Message_String_Int *)em->msg)->str); + { + Embryo_Cell v; + + v = (Embryo_Cell)((Edje_Message_String_Int *)em->msg)->val; + embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1); + } + break; - v = (Embryo_Cell)((Edje_Message_String_Int *)em->msg)->val; - embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1); - } - break; case EDJE_MESSAGE_STRING_FLOAT: - embryo_parameter_string_push(em->edje->collection->script, - ((Edje_Message_String_Float *)em->msg)->str); - { - Embryo_Cell v; - float fv; + embryo_parameter_string_push(em->edje->collection->script, + ((Edje_Message_String_Float *)em->msg)->str); + { + Embryo_Cell v; + float fv; + + fv = ((Edje_Message_String_Float *)em->msg)->val; + v = EMBRYO_FLOAT_TO_CELL(fv); + embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1); + } + break; - fv = ((Edje_Message_String_Float *)em->msg)->val; - v = EMBRYO_FLOAT_TO_CELL(fv); - embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1); - } - break; case EDJE_MESSAGE_STRING_INT_SET: - embryo_parameter_string_push(em->edje->collection->script, - ((Edje_Message_String_Int_Set *)em->msg)->str); - for (i = 0; i < ((Edje_Message_String_Int_Set *)em->msg)->count; i++) - { - Embryo_Cell v; + embryo_parameter_string_push(em->edje->collection->script, + ((Edje_Message_String_Int_Set *)em->msg)->str); + for (i = 0; i < ((Edje_Message_String_Int_Set *)em->msg)->count; i++) + { + Embryo_Cell v; + + v = (Embryo_Cell)((Edje_Message_String_Int_Set *)em->msg)->val[i]; + embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1); + } + break; - v = (Embryo_Cell)((Edje_Message_String_Int_Set *)em->msg)->val[i]; - embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1); - } - break; case EDJE_MESSAGE_STRING_FLOAT_SET: - embryo_parameter_string_push(em->edje->collection->script, - ((Edje_Message_String_Float_Set *)em->msg)->str); - for (i = 0; i < ((Edje_Message_String_Float_Set *)em->msg)->count; i++) - { - Embryo_Cell v; - float fv; + embryo_parameter_string_push(em->edje->collection->script, + ((Edje_Message_String_Float_Set *)em->msg)->str); + for (i = 0; i < ((Edje_Message_String_Float_Set *)em->msg)->count; i++) + { + Embryo_Cell v; + float fv; + + fv = ((Edje_Message_String_Float_Set *)em->msg)->val[i]; + v = EMBRYO_FLOAT_TO_CELL(fv); + embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1); + } + break; - fv = ((Edje_Message_String_Float_Set *)em->msg)->val[i]; - v = EMBRYO_FLOAT_TO_CELL(fv); - embryo_parameter_cell_array_push(em->edje->collection->script, &v, 1); - } - break; default: - break; + break; } } @@ -644,39 +677,39 @@ _edje_message_process(Edje_Message *em) Embryo_Function fn; void *pdata; int ret; - + /* 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, - ((Edje_Message_Signal *)em->msg)->data, - em->propagated); - return; + _edje_emit_handle(em->edje, + ((Edje_Message_Signal *)em->msg)->sig, + ((Edje_Message_Signal *)em->msg)->src, + ((Edje_Message_Signal *)em->msg)->data, + em->propagated); + 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; + 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)) return; if (em->edje->L) { - _edje_lua_script_only_message(em->edje, em); - return; + _edje_lua_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); @@ -707,7 +740,7 @@ _edje_message_process(Edje_Message *em) "message", embryo_program_max_cycle_run_get(em->edje->collection->script)); } - + embryo_program_data_set(em->edje->collection->script, pdata); embryo_program_vm_pop(em->edje->collection->script); } @@ -723,50 +756,50 @@ _edje_message_queue_process(void) /* us to go back to normal processing and let a 0 timeout deal with it */ for (i = 0; (i < 8) && (msgq); i++) { - /* a temporary message queue */ - if (tmp_msgq) - { - while (msgq) - { - tmp_msgq = eina_list_append(tmp_msgq, msgq->data); - msgq = eina_list_remove_list(msgq, msgq); - } - } - else - { - tmp_msgq = msgq; - msgq = NULL; - } + /* a temporary message queue */ + if (tmp_msgq) + { + while (msgq) + { + tmp_msgq = eina_list_append(tmp_msgq, msgq->data); + msgq = eina_list_remove_list(msgq, msgq); + } + } + else + { + tmp_msgq = msgq; + msgq = NULL; + } tmp_msgq_processing++; - while (tmp_msgq) - { - Edje_Message *em; - Edje *ed; + while (tmp_msgq) + { + Edje_Message *em; + Edje *ed; - em = tmp_msgq->data; - ed = em->edje; - tmp_msgq = eina_list_remove_list(tmp_msgq, tmp_msgq); - em->edje->message.num--; - if (!ed->delete_me) - { - ed->processing_messages++; - _edje_message_process(em); - _edje_message_free(em); - ed->processing_messages--; - } - else - _edje_message_free(em); - if (ed->processing_messages == 0) - { - if (ed->delete_me) _edje_del(ed); - } - } + em = tmp_msgq->data; + ed = em->edje; + tmp_msgq = eina_list_remove_list(tmp_msgq, tmp_msgq); + em->edje->message.num--; + if (!ed->delete_me) + { + ed->processing_messages++; + _edje_message_process(em); + _edje_message_free(em); + ed->processing_messages--; + } + else + _edje_message_free(em); + if (ed->processing_messages == 0) + { + if (ed->delete_me) _edje_del(ed); + } + } tmp_msgq_processing--; if (tmp_msgq_processing == 0) - tmp_msgq_restart = 0; + tmp_msgq_restart = 0; else - tmp_msgq_restart = 1; + tmp_msgq_restart = 1; } /* if the message queue filled again set a timer to expire in 0.0 sec */ @@ -774,7 +807,7 @@ _edje_message_queue_process(void) if (msgq) { static int self_feed_debug = -1; - + if (self_feed_debug == -1) { const char *s = getenv("EDJE_SELF_FEED_DEBUG"); @@ -785,7 +818,7 @@ _edje_message_queue_process(void) { WRN("Edje is in a self-feeding message loop (> 8 loops needed)"); } - ecore_timer_add(0.0, _edje_dummy_timer, NULL); + ecore_timer_add(0.0, _edje_dummy_timer, NULL); } } @@ -794,21 +827,21 @@ _edje_message_queue_clear(void) { while (msgq) { - Edje_Message *em; + Edje_Message *em; - em = msgq->data; - msgq = eina_list_remove_list(msgq, msgq); - em->edje->message.num--; - _edje_message_free(em); + em = msgq->data; + msgq = eina_list_remove_list(msgq, msgq); + em->edje->message.num--; + _edje_message_free(em); } while (tmp_msgq) { - Edje_Message *em; + Edje_Message *em; - em = tmp_msgq->data; - tmp_msgq = eina_list_remove_list(tmp_msgq, tmp_msgq); - em->edje->message.num--; - _edje_message_free(em); + em = tmp_msgq->data; + tmp_msgq = eina_list_remove_list(tmp_msgq, tmp_msgq); + em->edje->message.num--; + _edje_message_free(em); } } @@ -821,35 +854,36 @@ _edje_message_del(Edje *ed) /* delete any messages on the main queue for this edje object */ for (l = msgq; l; ) { - Edje_Message *em; - Eina_List *lp; + Edje_Message *em; + Eina_List *lp; - em = eina_list_data_get(l); - lp = l; - l = eina_list_next(l); - if (em->edje == ed) - { - msgq = eina_list_remove_list(msgq, lp); - em->edje->message.num--; - _edje_message_free(em); - } - if (ed->message.num <= 0) return; + em = eina_list_data_get(l); + lp = l; + l = eina_list_next(l); + if (em->edje == ed) + { + msgq = eina_list_remove_list(msgq, lp); + em->edje->message.num--; + _edje_message_free(em); + } + if (ed->message.num <= 0) return; } /* delete any on the processing queue */ for (l = tmp_msgq; l; ) { - Edje_Message *em; - Eina_List *lp; + Edje_Message *em; + Eina_List *lp; - em = eina_list_data_get(l); - lp = l; - l = eina_list_next(l); - if (em->edje == ed) - { - tmp_msgq = eina_list_remove_list(tmp_msgq, lp); - em->edje->message.num--; - _edje_message_free(em); - } - if (ed->message.num <= 0) return; + em = eina_list_data_get(l); + lp = l; + l = eina_list_next(l); + if (em->edje == ed) + { + tmp_msgq = eina_list_remove_list(tmp_msgq, lp); + em->edje->message.num--; + _edje_message_free(em); + } + if (ed->message.num <= 0) return; } } + diff --git a/src/lib/edje/edje_module.c b/src/lib/edje/edje_module.c index 0e6882c7c1..cfd30088f2 100644 --- a/src/lib/edje/edje_module.c +++ b/src/lib/edje/edje_module.c @@ -28,7 +28,7 @@ _edje_module_handle_load(const char *module) EINA_SAFETY_ON_NULL_RETURN_VAL(module, NULL); - em = (Eina_Module *)eina_hash_find(_registered_modules, module); + em = (Eina_Module *)eina_hash_find(_registered_modules, module); if (em) return em; run_in_tree = !!getenv("EFL_RUN_IN_TREE"); @@ -40,16 +40,16 @@ _edje_module_handle_load(const char *module) #if defined(HAVE_GETUID) && defined(HAVE_GETEUID) if (getuid() == geteuid()) #endif - { - if (run_in_tree) - { - struct stat st; - snprintf(tmp, sizeof(tmp), "%s/%s/.libs/%s", - path, module, EDJE_MODULE_NAME); - if (stat(tmp, &st) != 0) + { + if (run_in_tree) + { + struct stat st; + snprintf(tmp, sizeof(tmp), "%s/%s/.libs/%s", + path, module, EDJE_MODULE_NAME); + if (stat(tmp, &st) != 0) tmp[0] = '\0'; - } - } + } + } if (tmp[0] == '\0') snprintf(tmp, sizeof(tmp), "%s/%s/%s/%s", @@ -82,18 +82,18 @@ _edje_module_init(void) #if defined(HAVE_GETUID) && defined(HAVE_GETEUID) if (getuid() == geteuid()) #endif - { - if (getenv("EFL_RUN_IN_TREE")) - { - struct stat st; - const char mp[] = PACKAGE_BUILD_DIR"/src/modules/edje"; - if (stat(mp, &st) == 0) - { - _modules_paths = eina_list_append(_modules_paths, strdup(mp)); - return; - } - } - } + { + if (getenv("EFL_RUN_IN_TREE")) + { + struct stat st; + const char mp[] = PACKAGE_BUILD_DIR "/src/modules/edje"; + if (stat(mp, &st) == 0) + { + _modules_paths = eina_list_append(_modules_paths, strdup(mp)); + return; + } + } + } /* 1. libedje.so/../edje/modules/ */ paths[0] = eina_module_symbol_path_get(_edje_module_init, "/edje/modules"); @@ -102,15 +102,15 @@ _edje_module_init(void) paths[1] = strdup(PACKAGE_LIB_DIR "/edje/modules"); #endif - for (j = 0; j < ((sizeof (paths) / sizeof (char*)) - 1); ++j) - for (i = j + 1; i < sizeof (paths) / sizeof (char*); ++i) + for (j = 0; j < ((sizeof (paths) / sizeof (char *)) - 1); ++j) + for (i = j + 1; i < sizeof (paths) / sizeof (char *); ++i) if (paths[i] && paths[j] && !strcmp(paths[i], paths[j])) - { - free(paths[i]); - paths[i] = NULL; - } + { + free(paths[i]); + paths[i] = NULL; + } - for (i = 0; i < sizeof (paths) / sizeof (char*); ++i) + for (i = 0; i < sizeof (paths) / sizeof (char *); ++i) if (paths[i]) _modules_paths = eina_list_append(_modules_paths, paths[i]); } @@ -122,8 +122,8 @@ _edje_module_shutdown(void) if (_registered_modules) { - eina_hash_free(_registered_modules); - _registered_modules = NULL; + eina_hash_free(_registered_modules); + _registered_modules = NULL; } EINA_LIST_FREE(_modules_paths, path) @@ -145,35 +145,36 @@ edje_available_modules_get(void) /* FIXME: Stat each possible dir and check if they did change, before starting a huge round of readdir/stat */ if (_modules_found) { - EINA_LIST_FREE(_modules_found, path) - eina_stringshare_del(path); + EINA_LIST_FREE(_modules_found, path) + eina_stringshare_del(path); } EINA_LIST_FOREACH(_modules_paths, l, path) { - it = eina_file_direct_ls(path); + it = eina_file_direct_ls(path); - if (it) - { - EINA_ITERATOR_FOREACH(it, info) - { - char tmp[PATH_MAX]; + if (it) + { + EINA_ITERATOR_FOREACH(it, info) + { + char tmp[PATH_MAX]; - snprintf(tmp, sizeof (tmp), "%s/%s/" EDJE_MODULE_NAME, info->path, MODULE_ARCH + snprintf(tmp, sizeof (tmp), "%s/%s/" EDJE_MODULE_NAME, info->path, MODULE_ARCH #ifdef EDJE_EXTRA_MODULE_NAME , info->path + info->name_start #endif ); - if (ecore_file_exists(tmp)) - result = eina_list_append(result, eina_stringshare_add(info->path + info->name_start)); - } + if (ecore_file_exists(tmp)) + result = eina_list_append(result, eina_stringshare_add(info->path + info->name_start)); + } - eina_iterator_free(it); - } + eina_iterator_free(it); + } } _modules_found = result; return result; } + diff --git a/src/lib/edje/edje_multisense.c b/src/lib/edje/edje_multisense.c index 8d40b0c590..92e36d50a0 100644 --- a/src/lib/edje/edje_multisense.c +++ b/src/lib/edje/edje_multisense.c @@ -7,14 +7,16 @@ static Eo *out = NULL; static int outs = 0; static Eina_Bool outfail = EINA_FALSE; -static Eina_Bool _play_finished(void *data EINA_UNUSED, Eo *in, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) +static Eina_Bool +_play_finished(void *data EINA_UNUSED, Eo *in, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { - eo_del(in); + eo_del(in); return EINA_TRUE; } -static Eina_Bool _out_fail(void *data EINA_UNUSED, Eo *output EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) +static Eina_Bool +_out_fail(void *data EINA_UNUSED, Eo *output EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { outfail = EINA_TRUE; eo_del(out); @@ -24,9 +26,9 @@ static Eina_Bool _out_fail(void *data EINA_UNUSED, Eo *output EINA_UNUSED, const struct _edje_multisense_eet_data { - unsigned int offset, length; - Eet_File *ef; - const char *data; + unsigned int offset, length; + Eet_File *ef; + const char *data; Ecore_Audio_Vio vio; }; @@ -43,19 +45,22 @@ eet_snd_file_seek(void *data, Eo *eo_obj EINA_UNUSED, int offset, int whence) struct _edje_multisense_eet_data *vf = data; switch (whence) - { + { case SEEK_SET: vf->offset = offset; - break; + break; + case SEEK_CUR: vf->offset += offset; break; + case SEEK_END: vf->offset = vf->length + offset; - break; - default: - break; - } + break; + + default: + break; + } return vf->offset; } @@ -85,7 +90,7 @@ _free(void *data) struct _edje_multisense_eet_data *eet_data = data; if (eet_data->ef) eet_close(eet_data->ef); -// don't free if eet_data->data comes from eet_read_direct +// don't free if eet_data->data comes from eet_read_direct // free(eet_data->data); free(data); outs--; @@ -110,11 +115,11 @@ EAPI void edje_audio_channel_mute_set(Edje_Channel channel, Eina_Bool mute) { #ifdef ENABLE_MULTISENSE - if ((unsigned) channel > 7) return; + if ((unsigned)channel > 7) return; _channel_mute_states[channel] = mute; #else - (void) channel; - (void) mute; + (void)channel; + (void)mute; #endif } @@ -122,10 +127,10 @@ EAPI Eina_Bool edje_audio_channel_mute_get(Edje_Channel channel) { #ifdef ENABLE_MULTISENSE - if ((unsigned) channel > 7) return EINA_FALSE; + if ((unsigned)channel > 7) return EINA_FALSE; return _channel_mute_states[channel]; #else - (void) channel; + (void)channel; return EINA_FALSE; #endif } @@ -141,9 +146,9 @@ _edje_multisense_internal_sound_sample_play(Edje *ed, const char *sample_name, c Eina_Bool ret = EINA_FALSE; if (_channel_mute(ed, channel)) return EINA_FALSE; - + if (outfail) return EINA_FALSE; - + if (!sample_name) { ERR("Given Sample Name is NULL\n"); @@ -153,91 +158,91 @@ _edje_multisense_internal_sound_sample_play(Edje *ed, const char *sample_name, c if ((!ed) || (!ed->file) || (!ed->file->sound_dir)) return EINA_FALSE; - for(i=0; i<(int)ed->file->sound_dir->samples_count; i++) + for (i = 0; i < (int)ed->file->sound_dir->samples_count; i++) { - sample = &ed->file->sound_dir->samples[i]; - if (!strcmp(sample->name, sample_name)) - { - struct _edje_multisense_eet_data *eet_data; - int len; + sample = &ed->file->sound_dir->samples[i]; + if (!strcmp(sample->name, sample_name)) + { + struct _edje_multisense_eet_data *eet_data; + int len; - snprintf(snd_id_str, sizeof(snd_id_str), "edje/sounds/%i", sample->id); - - eet_data = calloc(1, sizeof(struct _edje_multisense_eet_data)); - if (!eet_data) - { - ERR("Out of memory in allocating multisense sample info"); - return EINA_FALSE; - } - // open eet file again to esnure we have reference because we - // use eet_read_direct to avoid duplicating/copying into memory - // by relying on a direct mmap, but this means we need to close - // the eet file handle instead of freeing data - eet_data->ef = eet_mmap(ed->file->f); - if (!eet_data->ef) - { - ERR("Cannot open edje file '%s' for samples", ed->path); - free(eet_data); - return EINA_FALSE; - } - eet_data->data = eet_read_direct(eet_data->ef, snd_id_str, &len); - if (len <= 0) - { - ERR("Sample form edj file '%s' is 0 length", ed->path); - eet_close(eet_data->ef); - free(eet_data); - return EINA_FALSE; - } - eet_data->length = len; - /* action->speed */ + snprintf(snd_id_str, sizeof(snd_id_str), "edje/sounds/%i", sample->id); - eet_data->vio.get_length = eet_snd_file_get_length; - eet_data->vio.seek = eet_snd_file_seek; - eet_data->vio.read = eet_snd_file_read; - eet_data->vio.tell = eet_snd_file_tell; - eet_data->offset = 0; + eet_data = calloc(1, sizeof(struct _edje_multisense_eet_data)); + if (!eet_data) + { + ERR("Out of memory in allocating multisense sample info"); + return EINA_FALSE; + } + // open eet file again to esnure we have reference because we + // use eet_read_direct to avoid duplicating/copying into memory + // by relying on a direct mmap, but this means we need to close + // the eet file handle instead of freeing data + eet_data->ef = eet_mmap(ed->file->f); + if (!eet_data->ef) + { + ERR("Cannot open edje file '%s' for samples", ed->path); + free(eet_data); + return EINA_FALSE; + } + eet_data->data = eet_read_direct(eet_data->ef, snd_id_str, &len); + if (len <= 0) + { + ERR("Sample form edj file '%s' is 0 length", ed->path); + eet_close(eet_data->ef); + free(eet_data); + return EINA_FALSE; + } + eet_data->length = len; + /* action->speed */ - in = eo_add(ECORE_AUDIO_IN_SNDFILE_CLASS, NULL, - ecore_audio_obj_name_set(snd_id_str), - ecore_audio_obj_in_speed_set(speed), - ecore_audio_obj_vio_set(&eet_data->vio, eet_data, _free), - eo_event_callback_add(ECORE_AUDIO_IN_EVENT_IN_STOPPED, _play_finished, NULL)); - if (!out) - { + eet_data->vio.get_length = eet_snd_file_get_length; + eet_data->vio.seek = eet_snd_file_seek; + eet_data->vio.read = eet_snd_file_read; + eet_data->vio.tell = eet_snd_file_tell; + eet_data->offset = 0; + + in = eo_add(ECORE_AUDIO_IN_SNDFILE_CLASS, NULL, + ecore_audio_obj_name_set(snd_id_str), + ecore_audio_obj_in_speed_set(speed), + ecore_audio_obj_vio_set(&eet_data->vio, eet_data, _free), + eo_event_callback_add(ECORE_AUDIO_IN_EVENT_IN_STOPPED, _play_finished, NULL)); + if (!out) + { #if HAVE_COREAUDIO - out = eo_add(ECORE_AUDIO_OUT_CORE_AUDIO_CLASS, NULL); + out = eo_add(ECORE_AUDIO_OUT_CORE_AUDIO_CLASS, NULL); #elif HAVE_PULSE - out = eo_add(ECORE_AUDIO_OUT_PULSE_CLASS, NULL, - eo_event_callback_add(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_FAIL, _out_fail, NULL)); + out = eo_add(ECORE_AUDIO_OUT_PULSE_CLASS, NULL, + eo_event_callback_add(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_FAIL, _out_fail, NULL)); #endif - if (out) outs++; - } - if (!out) - { + if (out) outs++; + } + if (!out) + { #if HAVE_COREAUDIO - ERR("Could not create multisense audio out (CoreAudio)"); + ERR("Could not create multisense audio out (CoreAudio)"); #elif HAVE_PULSE - ERR("Could not create multisense audio out (pulse)"); + ERR("Could not create multisense audio out (pulse)"); #endif - eo_del(in); - return EINA_FALSE; - } - eo_do(out, ret = ecore_audio_obj_out_input_attach(in)); - if (!ret) - { - ERR("Could not attach input"); - eo_del(in); - return EINA_FALSE; - } - } + eo_del(in); + return EINA_FALSE; + } + eo_do(out, ret = ecore_audio_obj_out_input_attach(in)); + if (!ret) + { + ERR("Could not attach input"); + eo_del(in); + return EINA_FALSE; + } + } } return EINA_TRUE; #else // warning shh - (void) ed; - (void) sample_name; - (void) speed; - (void) channel; + (void)ed; + (void)sample_name; + (void)speed; + (void)channel; return EINA_FALSE; #endif } @@ -256,15 +261,15 @@ _edje_multisense_internal_sound_tone_play(Edje *ed, const char *tone_name, const ERR("Given Tone Name is NULL"); return EINA_FALSE; } - + if (_channel_mute(ed, channel)) return EINA_FALSE; if (outfail) return EINA_FALSE; - + if ((!ed) || (!ed->file) || (!ed->file->sound_dir)) return EINA_FALSE; - for (i=0; ifile->sound_dir->tones_count; i++) + for (i = 0; i < ed->file->sound_dir->tones_count; i++) { tone = &ed->file->sound_dir->tones[i]; if (!strcmp(tone->name, tone_name)) @@ -287,34 +292,34 @@ _edje_multisense_internal_sound_tone_play(Edje *ed, const char *tone_name, const } eo_do(out, ret = ecore_audio_obj_out_input_attach(in)); - if (!ret) { - ERR("Could not attach input"); - eo_del(in); - return EINA_FALSE; - } + if (!ret) + { + ERR("Could not attach input"); + eo_del(in); + return EINA_FALSE; + } } } return EINA_TRUE; #else // warning shh - (void) ed; - (void) duration; - (void) tone_name; - (void) channel; + (void)ed; + (void)duration; + (void)tone_name; + (void)channel; return EINA_FALSE; #endif - } Eina_Bool _edje_multisense_internal_vibration_sample_play(Edje *ed EINA_UNUSED, const char *sample_name EINA_UNUSED, int repeat EINA_UNUSED) { #ifdef ENABLE_MULTISENSE - ERR("Vibration is not supported yet, name:%s, repeat:%d", sample_name, repeat); - return EINA_FALSE; + ERR("Vibration is not supported yet, name:%s, repeat:%d", sample_name, repeat); + return EINA_FALSE; #else - (void) ed; - (void) repeat; + (void)ed; + (void)repeat; return EINA_FALSE; #endif } @@ -345,3 +350,4 @@ _edje_multisense_shutdown(void) ecore_audio_shutdown(); #endif } + diff --git a/src/lib/edje/edje_program.c b/src/lib/edje/edje_program.c index 5d9a67b40d..2b5a1fa737 100644 --- a/src/lib/edje/edje_program.c +++ b/src/lib/edje/edje_program.c @@ -4,10 +4,9 @@ static void _edje_emit_cb(Edje *ed, const char *sig, const char *src, Edje_Messa static void _edje_param_copy(Edje *ed, Edje_Real_Part *src_part, const char *src_param, Edje_Real_Part *dst_part, const char *dst_param); static void _edje_param_set(Edje *ed, Edje_Real_Part *part, const char *param, const char *value); -int _edje_anim_count = 0; +int _edje_anim_count = 0; Ecore_Animator *_edje_timer = NULL; -Eina_List *_edje_animators = NULL; - +Eina_List *_edje_animators = NULL; static Eina_Bool _edje_emit_aliased(Edje *ed, const char *part, const char *sig, const char *src) @@ -70,54 +69,54 @@ _edje_emit_child(Edje *ed, Edje_Real_Part *rp, const char *part, const char *sig switch (rp->part->type) { case EDJE_PART_TYPE_GROUP: - if (((rp->type != EDJE_RP_TYPE_SWALLOW) || - (!rp->typedata.swallow)) || - (!rp->typedata.swallow->swallowed_object)) - break; - ed2 = _edje_fetch(rp->typedata.swallow->swallowed_object); - if (!ed2) break; + if (((rp->type != EDJE_RP_TYPE_SWALLOW) || + (!rp->typedata.swallow)) || + (!rp->typedata.swallow->swallowed_object)) + break; + ed2 = _edje_fetch(rp->typedata.swallow->swallowed_object); + if (!ed2) break; - _edje_emit(ed2, sig, src); - return EINA_FALSE; + _edje_emit(ed2, sig, src); + return EINA_FALSE; case EDJE_PART_TYPE_EXTERNAL: - if (((rp->type != EDJE_RP_TYPE_SWALLOW) || - (!rp->typedata.swallow)) || - (!rp->typedata.swallow->swallowed_object)) - break; + if (((rp->type != EDJE_RP_TYPE_SWALLOW) || + (!rp->typedata.swallow)) || + (!rp->typedata.swallow->swallowed_object)) + break; - if (!idx) - { - _edje_external_signal_emit(rp->typedata.swallow->swallowed_object, sig, src); - } - else - { - Evas_Object *child; + if (!idx) + { + _edje_external_signal_emit(rp->typedata.swallow->swallowed_object, sig, src); + } + else + { + Evas_Object *child; - child = _edje_children_get(rp, idx); - ed2 = _edje_fetch(child); - if (!ed2) break; - _edje_emit(ed2, sig, src); - } - return EINA_FALSE; + child = _edje_children_get(rp, idx); + ed2 = _edje_fetch(child); + if (!ed2) break; + _edje_emit(ed2, sig, src); + } + return EINA_FALSE; case EDJE_PART_TYPE_BOX: case EDJE_PART_TYPE_TABLE: - if (idx) - { - Evas_Object *child; + if (idx) + { + Evas_Object *child; - child = _edje_children_get(rp, idx); - ed2 = _edje_fetch(child); - if (!ed2) break; - _edje_emit(ed2, sig, src); - return EINA_FALSE; - } - break ; + child = _edje_children_get(rp, idx); + ed2 = _edje_fetch(child); + if (!ed2) break; + _edje_emit(ed2, sig, src); + return EINA_FALSE; + } + break; default: - // ERR("SPANK SPANK SPANK !!!\nYou should never be here !"); - break; + // ERR("SPANK SPANK SPANK !!!\nYou should never be here !"); + break; } return ed->collection->broadcast_signal; } @@ -168,8 +167,8 @@ _edje_emit_send(Edje *ed, Eina_Bool broadcast, const char *sig, const char *src, } /*============================================================================* - * API * - *============================================================================*/ +* API * +*============================================================================*/ EAPI void edje_frametime_set(double t) @@ -184,7 +183,7 @@ edje_frametime_get(void) } void -edje_object_propagate_callback_add(Evas_Object *obj, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source), void *data) +edje_object_propagate_callback_add(Evas_Object *obj, void (*func)(void *data, Evas_Object *o, const char *emission, const char *source), void *data) { const char *sig; const char *src; @@ -232,7 +231,7 @@ _edje_object_signal_callback_add(Eo *obj EINA_UNUSED, Edje *ed, const char *emis } EAPI void * -edje_object_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source)) +edje_object_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, void (*func)(void *data, Evas_Object *o, const char *emission, const char *source)) { if (!obj) return NULL; void *ret = NULL; @@ -240,7 +239,7 @@ edje_object_signal_callback_del(Evas_Object *obj, const char *emission, const ch return ret; } -EOLIAN void* +EOLIAN void * _edje_object_signal_callback_del(Eo *obj EINA_UNUSED, Edje *ed, const char *emission, const char *source, Edje_Signal_Cb func, void *data) { if ((!emission) || (!source) || (!func)) return NULL; @@ -295,7 +294,7 @@ _edje_object_play_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool play) ed->paused = EINA_FALSE; t = ecore_time_get() - ed->paused_at; EINA_LIST_FOREACH(ed->actions, l, runp) - runp->start_time += t; + runp->start_time += t; } else { @@ -308,7 +307,7 @@ _edje_object_play_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool play) { Edje_Real_Part *rp; rp = ed->table_parts[i]; - if ((rp->part->type == EDJE_PART_TYPE_GROUP) && + if ((rp->part->type == EDJE_PART_TYPE_GROUP) && ((rp->type == EDJE_RP_TYPE_SWALLOW) && (rp->typedata.swallow)) && (rp->typedata.swallow->swallowed_object)) @@ -344,7 +343,7 @@ _edje_object_animation_set(Eo *obj, Edje *ed, Eina_Bool on) const void *data; EINA_LIST_FOREACH(ed->actions, l, data) - newl = eina_list_append(newl, data); + newl = eina_list_append(newl, data); while (newl) { Edje_Running_Program *runp; @@ -374,7 +373,7 @@ break_prog: { Edje_Real_Part *rp; rp = ed->table_parts[i]; - if ((rp->part->type == EDJE_PART_TYPE_GROUP) && + if ((rp->part->type == EDJE_PART_TYPE_GROUP) && ((rp->type == EDJE_RP_TYPE_SWALLOW) && (rp->typedata.swallow)) && (rp->typedata.swallow->swallowed_object)) @@ -420,12 +419,13 @@ _edje_program_run_iterate(Edje_Running_Program *runp, double tim) if (pt->id >= 0) { rp = ed->table_parts[pt->id % ed->table_parts_size]; - if (rp) _edje_part_pos_set(ed, rp, - runp->program->tween.mode, t, - runp->program->tween.v1, - runp->program->tween.v2, - runp->program->tween.v3, - runp->program->tween.v4); + if (rp) + _edje_part_pos_set(ed, rp, + runp->program->tween.mode, t, + runp->program->tween.v1, + runp->program->tween.v2, + runp->program->tween.v3, + runp->program->tween.v4); } } if (t >= FROM_INT(1)) @@ -488,7 +488,7 @@ _edje_program_run_iterate(Edje_Running_Program *runp, double tim) _edje_unref(ed); if (!ed->walking_actions) free(runp); _edje_unblock(ed); - return EINA_FALSE; + return EINA_FALSE; } break_prog: _edje_recalc(ed); @@ -575,6 +575,7 @@ _edje_physics_action_set(Edje *ed, Edje_Program *pr, void (*func)(EPhysics_Body return EINA_TRUE; } + #endif void @@ -626,486 +627,515 @@ _edje_program_run(Edje *ed, Edje_Program *pr, Eina_Bool force, const char *ssig, switch (pr->action) { case EDJE_ACTION_TYPE_STATE_SET: - if ((pr->tween.time > ZERO) && (!ed->no_anim)) - { - Edje_Running_Program *runp; + if ((pr->tween.time > ZERO) && (!ed->no_anim)) + { + Edje_Running_Program *runp; - runp = calloc(1, sizeof(Edje_Running_Program)); - EINA_LIST_FOREACH(pr->targets, l, pt) - { - if (pt->id >= 0) - { - rp = ed->table_parts[pt->id % ed->table_parts_size]; - if (rp) - { - if ((rp->object) && (pr->tween.mode & EDJE_TWEEN_MODE_OPT_FROM_CURRENT)) - { - Edje_Calc_Params *tmp; + runp = calloc(1, sizeof(Edje_Running_Program)); + EINA_LIST_FOREACH(pr->targets, l, pt) + { + if (pt->id >= 0) + { + rp = ed->table_parts[pt->id % ed->table_parts_size]; + if (rp) + { + if ((rp->object) && (pr->tween.mode & EDJE_TWEEN_MODE_OPT_FROM_CURRENT)) + { + Edje_Calc_Params *tmp; - tmp = calloc(1, sizeof(Edje_Calc_Params)); - if (!tmp) goto low_mem_current; - tmp->map = eina_cow_alloc(_edje_calc_params_map_cow); + tmp = calloc(1, sizeof(Edje_Calc_Params)); + if (!tmp) goto low_mem_current; + tmp->map = eina_cow_alloc(_edje_calc_params_map_cow); #ifdef HAVE_EPHYSICS - tmp->physics = eina_cow_alloc(_edje_calc_params_physics_cow); + tmp->physics = eina_cow_alloc(_edje_calc_params_physics_cow); #endif - _edje_part_recalc(ed, rp, FLAG_XY, tmp); + _edje_part_recalc(ed, rp, FLAG_XY, tmp); - if (rp->current) - { - eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **) &rp->current->map); + if (rp->current) + { + eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **)&rp->current->map); #ifdef HAVE_EPHYSICS - eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **) &rp->current->physics); + eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&rp->current->physics); #endif - free(rp->current); - } - rp->current = tmp; - } - else - { + free(rp->current); + } + rp->current = tmp; + } + else + { low_mem_current: - if (rp->current) - { - eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **) &rp->current->map); + if (rp->current) + { + eina_cow_free(_edje_calc_params_map_cow, (const Eina_Cow_Data **)&rp->current->map); #ifdef HAVE_EPHYSICS - eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **) &rp->current->physics); + eina_cow_free(_edje_calc_params_physics_cow, (const Eina_Cow_Data **)&rp->current->physics); #endif - free(rp->current); - } - rp->current = NULL; - } + free(rp->current); + } + rp->current = NULL; + } - if (rp->program) - _edje_program_end(ed, rp->program); - _edje_part_description_apply(ed, rp, - rp->param1.description->state.name, - rp->param1.description->state.value, - pr->state, - pr->value); - _edje_part_pos_set(ed, rp, pr->tween.mode, ZERO, - pr->tween.v1, - pr->tween.v2, - pr->tween.v3, - pr->tween.v4); - rp->program = runp; - } - } - } - // _edje_emit(ed, "program,start", pr->name); - if (_edje_block_break(ed)) - { - ed->actions = eina_list_append(ed->actions, runp); - goto break_prog; - } - if (!ed->actions) - _edje_animators = eina_list_append(_edje_animators, ed); - ed->actions = eina_list_append(ed->actions, runp); - runp->start_time = ecore_loop_time_get(); - runp->edje = ed; - runp->program = pr; - if (!_edje_timer) - _edje_timer = ecore_animator_add(_edje_timer_cb, NULL); - _edje_anim_count++; - } - else - { - EINA_LIST_FOREACH(pr->targets, l, pt) - { - if (pt->id >= 0) - { - rp = ed->table_parts[pt->id % ed->table_parts_size]; - if (rp) - { - if (rp->program) - _edje_program_end(ed, rp->program); - _edje_part_description_apply(ed, rp, - pr->state, - pr->value, - NULL, - 0.0); - _edje_part_pos_set(ed, rp, pr->tween.mode, ZERO, - pr->tween.v1, - pr->tween.v2, - pr->tween.v3, - pr->tween.v4); - } - } - } - // _edje_emit(ed, "program,start", pr->name); - if (_edje_block_break(ed)) goto break_prog; - // _edje_emit(ed, "program,stop", pr->name); - if (_edje_block_break(ed)) goto break_prog; + if (rp->program) + _edje_program_end(ed, rp->program); + _edje_part_description_apply(ed, rp, + rp->param1.description->state.name, + rp->param1.description->state.value, + pr->state, + pr->value); + _edje_part_pos_set(ed, rp, pr->tween.mode, ZERO, + pr->tween.v1, + pr->tween.v2, + pr->tween.v3, + pr->tween.v4); + rp->program = runp; + } + } + } + // _edje_emit(ed, "program,start", pr->name); + if (_edje_block_break(ed)) + { + ed->actions = eina_list_append(ed->actions, runp); + goto break_prog; + } + if (!ed->actions) + _edje_animators = eina_list_append(_edje_animators, ed); + ed->actions = eina_list_append(ed->actions, runp); + runp->start_time = ecore_loop_time_get(); + runp->edje = ed; + runp->program = pr; + if (!_edje_timer) + _edje_timer = ecore_animator_add(_edje_timer_cb, NULL); + _edje_anim_count++; + } + else + { + EINA_LIST_FOREACH(pr->targets, l, pt) + { + if (pt->id >= 0) + { + rp = ed->table_parts[pt->id % ed->table_parts_size]; + if (rp) + { + if (rp->program) + _edje_program_end(ed, rp->program); + _edje_part_description_apply(ed, rp, + pr->state, + pr->value, + NULL, + 0.0); + _edje_part_pos_set(ed, rp, pr->tween.mode, ZERO, + pr->tween.v1, + pr->tween.v2, + pr->tween.v3, + pr->tween.v4); + } + } + } + // _edje_emit(ed, "program,start", pr->name); + if (_edje_block_break(ed)) goto break_prog; + // _edje_emit(ed, "program,stop", pr->name); + if (_edje_block_break(ed)) goto break_prog; + + EINA_LIST_FOREACH(pr->after, l, pa) + { + if (pa->id >= 0) + { + pr2 = ed->collection->patterns.table_programs[pa->id % ed->collection->patterns.table_programs_size]; + if (pr2) _edje_program_run(ed, pr2, 0, "", ""); + if (_edje_block_break(ed)) goto break_prog; + } + } + _edje_recalc(ed); + } + break; - EINA_LIST_FOREACH(pr->after, l, pa) - { - if (pa->id >= 0) - { - pr2 = ed->collection->patterns.table_programs[pa->id % ed->collection->patterns.table_programs_size]; - if (pr2) _edje_program_run(ed, pr2, 0, "", ""); - if (_edje_block_break(ed)) goto break_prog; - } - } - _edje_recalc(ed); - } - break; case EDJE_ACTION_TYPE_ACTION_STOP: - // _edje_emit(ed, "program,start", pr->name); - EINA_LIST_FOREACH(pr->targets, l, pt) - { - Eina_List *ll; - Edje_Running_Program *runp; - Edje_Pending_Program *pp; + // _edje_emit(ed, "program,start", pr->name); + EINA_LIST_FOREACH(pr->targets, l, pt) + { + Eina_List *ll; + Edje_Running_Program *runp; + Edje_Pending_Program *pp; + + for (ll = ed->actions; ll; ) + { + runp = ll->data; + ll = ll->next; + if (pt->id == runp->program->id) + { + _edje_program_end(ed, runp); + // goto done; + } + } + for (ll = ed->pending_actions; ll; ) + { + pp = ll->data; + ll = ll->next; + if (pt->id == pp->program->id) + { + ed->pending_actions = eina_list_remove(ed->pending_actions, pp); + ecore_timer_del(pp->timer); + free(pp); + // goto done; + } + } + // done: + // continue; + } + // _edje_emit(ed, "program,stop", pr->name); + if (_edje_block_break(ed)) goto break_prog; + break; - for (ll = ed->actions; ll; ) - { - runp = ll->data; - ll = ll->next; - if (pt->id == runp->program->id) - { - _edje_program_end(ed, runp); - // goto done; - } - } - for (ll = ed->pending_actions; ll; ) - { - pp = ll->data; - ll = ll->next; - if (pt->id == pp->program->id) - { - ed->pending_actions = eina_list_remove(ed->pending_actions, pp); - ecore_timer_del(pp->timer); - free(pp); - // goto done; - } - } - // done: - // continue; - } - // _edje_emit(ed, "program,stop", pr->name); - if (_edje_block_break(ed)) goto break_prog; - break; case EDJE_ACTION_TYPE_SIGNAL_EMIT: - // _edje_emit(ed, "program,start", pr->name); - if (_edje_block_break(ed)) goto break_prog; - if (pr->targets) - { - EINA_LIST_FOREACH(pr->targets, l, pt) - { - if (pt->id < 0) continue; - rp = ed->table_parts[pt->id % ed->table_parts_size]; - if (!rp) continue; - if (!_edje_emit_aliased(ed, rp->part->name, pr->state, pr->state2)) - { - Eina_Bool broadcast; + // _edje_emit(ed, "program,start", pr->name); + if (_edje_block_break(ed)) goto break_prog; + if (pr->targets) + { + EINA_LIST_FOREACH(pr->targets, l, pt) + { + if (pt->id < 0) continue; + rp = ed->table_parts[pt->id % ed->table_parts_size]; + if (!rp) continue; + if (!_edje_emit_aliased(ed, rp->part->name, pr->state, pr->state2)) + { + Eina_Bool broadcast; + + broadcast = _edje_emit_child(ed, rp, rp->part->name, pr->state, pr->state2); + _edje_emit_send(ed, broadcast, pr->state, pr->state2, NULL, NULL); + } + } + } + else + _edje_emit(ed, pr->state, pr->state2); + if (_edje_block_break(ed)) goto break_prog; + // _edje_emit(ed, "program,stop", pr->name); + if (_edje_block_break(ed)) goto break_prog; + break; - broadcast = _edje_emit_child(ed, rp, rp->part->name, pr->state, pr->state2); - _edje_emit_send(ed, broadcast, pr->state, pr->state2, NULL, NULL); - } - } - } - else - _edje_emit(ed, pr->state, pr->state2); - if (_edje_block_break(ed)) goto break_prog; - // _edje_emit(ed, "program,stop", pr->name); - if (_edje_block_break(ed)) goto break_prog; - break; case EDJE_ACTION_TYPE_DRAG_VAL_SET: - // _edje_emit(ed, "program,start", pr->name); - if (_edje_block_break(ed)) goto break_prog; - EINA_LIST_FOREACH(pr->targets, l, pt) - { - if (pt->id >= 0) - { - rp = ed->table_parts[pt->id % ed->table_parts_size]; - if ((rp) && (rp->drag) && (rp->drag->down.count == 0)) - { - rp->drag->val.x = pr->value; - rp->drag->val.y = pr->value2; - if (rp->drag->val.x < 0.0) rp->drag->val.x = 0.0; - else if (rp->drag->val.x > 1.0) rp->drag->val.x = 1.0; - if (rp->drag->val.y < 0.0) rp->drag->val.y = 0.0; - else if (rp->drag->val.y > 1.0) rp->drag->val.y = 1.0; - _edje_dragable_pos_set(ed, rp, rp->drag->val.x, rp->drag->val.y); - _edje_emit(ed, "drag,set", rp->part->name); - if (_edje_block_break(ed)) goto break_prog; - } - } - } - // _edje_emit(ed, "program,stop", pr->name); - if (_edje_block_break(ed)) goto break_prog; - break; + // _edje_emit(ed, "program,start", pr->name); + if (_edje_block_break(ed)) goto break_prog; + EINA_LIST_FOREACH(pr->targets, l, pt) + { + if (pt->id >= 0) + { + rp = ed->table_parts[pt->id % ed->table_parts_size]; + if ((rp) && (rp->drag) && (rp->drag->down.count == 0)) + { + rp->drag->val.x = pr->value; + rp->drag->val.y = pr->value2; + if (rp->drag->val.x < 0.0) rp->drag->val.x = 0.0; + else if (rp->drag->val.x > 1.0) + rp->drag->val.x = 1.0; + if (rp->drag->val.y < 0.0) rp->drag->val.y = 0.0; + else if (rp->drag->val.y > 1.0) + rp->drag->val.y = 1.0; + _edje_dragable_pos_set(ed, rp, rp->drag->val.x, rp->drag->val.y); + _edje_emit(ed, "drag,set", rp->part->name); + if (_edje_block_break(ed)) goto break_prog; + } + } + } + // _edje_emit(ed, "program,stop", pr->name); + if (_edje_block_break(ed)) goto break_prog; + break; + case EDJE_ACTION_TYPE_DRAG_VAL_STEP: - // _edje_emit(ed, "program,start", pr->name); - if (_edje_block_break(ed)) goto break_prog; - EINA_LIST_FOREACH(pr->targets, l, pt) - { - if (pt->id >= 0) - { - rp = ed->table_parts[pt->id % ed->table_parts_size]; - if ((rp) && (rp->drag) && (rp->drag->down.count == 0)) - { - rp->drag->val.x += pr->value * rp->drag->step.x * rp->part->dragable.x; - rp->drag->val.y += pr->value2 * rp->drag->step.y * rp->part->dragable.y; - if (rp->drag->val.x < 0.0) rp->drag->val.x = 0.0; - else if (rp->drag->val.x > 1.0) rp->drag->val.x = 1.0; - if (rp->drag->val.y < 0.0) rp->drag->val.y = 0.0; - else if (rp->drag->val.y > 1.0) rp->drag->val.y = 1.0; - _edje_dragable_pos_set(ed, rp, rp->drag->val.x, rp->drag->val.y); - _edje_emit(ed, "drag,step", rp->part->name); - if (_edje_block_break(ed)) goto break_prog; - } - } - } - // _edje_emit(ed, "program,stop", pr->name); - if (_edje_block_break(ed)) goto break_prog; - break; + // _edje_emit(ed, "program,start", pr->name); + if (_edje_block_break(ed)) goto break_prog; + EINA_LIST_FOREACH(pr->targets, l, pt) + { + if (pt->id >= 0) + { + rp = ed->table_parts[pt->id % ed->table_parts_size]; + if ((rp) && (rp->drag) && (rp->drag->down.count == 0)) + { + rp->drag->val.x += pr->value * rp->drag->step.x * rp->part->dragable.x; + rp->drag->val.y += pr->value2 * rp->drag->step.y * rp->part->dragable.y; + if (rp->drag->val.x < 0.0) rp->drag->val.x = 0.0; + else if (rp->drag->val.x > 1.0) + rp->drag->val.x = 1.0; + if (rp->drag->val.y < 0.0) rp->drag->val.y = 0.0; + else if (rp->drag->val.y > 1.0) + rp->drag->val.y = 1.0; + _edje_dragable_pos_set(ed, rp, rp->drag->val.x, rp->drag->val.y); + _edje_emit(ed, "drag,step", rp->part->name); + if (_edje_block_break(ed)) goto break_prog; + } + } + } + // _edje_emit(ed, "program,stop", pr->name); + if (_edje_block_break(ed)) goto break_prog; + break; + case EDJE_ACTION_TYPE_DRAG_VAL_PAGE: + // _edje_emit(ed, "program,start", pr->name); + if (_edje_block_break(ed)) goto break_prog; + EINA_LIST_FOREACH(pr->targets, l, pt) + { + if (pt->id >= 0) + { + rp = ed->table_parts[pt->id % ed->table_parts_size]; + if ((rp) && (rp->drag) && (rp->drag->down.count == 0)) + { + rp->drag->val.x += pr->value * rp->drag->page.x * rp->part->dragable.x; + rp->drag->val.y += pr->value2 * rp->drag->page.y * rp->part->dragable.y; + if (rp->drag->val.x < 0.0) rp->drag->val.x = 0.0; + else if (rp->drag->val.x > 1.0) + rp->drag->val.x = 1.0; + if (rp->drag->val.y < 0.0) rp->drag->val.y = 0.0; + else if (rp->drag->val.y > 1.0) + rp->drag->val.y = 1.0; + _edje_dragable_pos_set(ed, rp, rp->drag->val.x, rp->drag->val.y); + _edje_emit(ed, "drag,page", rp->part->name); + if (_edje_block_break(ed)) goto break_prog; + } + } + } + // _edje_emit(ed, "program,stop", pr->name); + if (_edje_block_break(ed)) goto break_prog; + break; + + case EDJE_ACTION_TYPE_SCRIPT: + { + char fname[128]; + // _edje_emit(ed, "program,start", pr->name); if (_edje_block_break(ed)) goto break_prog; - EINA_LIST_FOREACH(pr->targets, l, pt) - { - if (pt->id >= 0) - { - rp = ed->table_parts[pt->id % ed->table_parts_size]; - if ((rp) && (rp->drag) && (rp->drag->down.count == 0)) - { - rp->drag->val.x += pr->value * rp->drag->page.x * rp->part->dragable.x; - rp->drag->val.y += pr->value2 * rp->drag->page.y * rp->part->dragable.y; - if (rp->drag->val.x < 0.0) rp->drag->val.x = 0.0; - else if (rp->drag->val.x > 1.0) rp->drag->val.x = 1.0; - if (rp->drag->val.y < 0.0) rp->drag->val.y = 0.0; - else if (rp->drag->val.y > 1.0) rp->drag->val.y = 1.0; - _edje_dragable_pos_set(ed, rp, rp->drag->val.x, rp->drag->val.y); - _edje_emit(ed, "drag,page", rp->part->name); - if (_edje_block_break(ed)) goto break_prog; - } - } - } + snprintf(fname, sizeof(fname), "_p%i", pr->id); + _edje_embryo_test_run(ed, fname, ssig, ssrc); // _edje_emit(ed, "program,stop", pr->name); if (_edje_block_break(ed)) goto break_prog; - break; - case EDJE_ACTION_TYPE_SCRIPT: - { - char fname[128]; + _edje_recalc_do(ed); + } + break; - // _edje_emit(ed, "program,start", pr->name); - if (_edje_block_break(ed)) goto break_prog; - snprintf(fname, sizeof(fname), "_p%i", pr->id); - _edje_embryo_test_run(ed, fname, ssig, ssrc); - // _edje_emit(ed, "program,stop", pr->name); - if (_edje_block_break(ed)) goto break_prog; - _edje_recalc_do(ed); - } - break; case EDJE_ACTION_TYPE_FOCUS_SET: - if (!pr->targets) - { - if (ed->focused_part) - _edje_emit(ed, "focus,part,out", - ed->focused_part->part->name); - ed->focused_part = NULL; - } - else - { - EINA_LIST_FOREACH(pr->targets, l, pt) - { - if (pt->id >= 0) - { - rp = ed->table_parts[pt->id % ed->table_parts_size]; - if (rp) - { - if (ed->focused_part != rp) - { - if (ed->focused_part) - _edje_emit(ed, "focus,part,out", - ed->focused_part->part->name); - ed->focused_part = rp; - _edje_emit(ed, "focus,part,in", - ed->focused_part->part->name); - } - } - } - } - } - break; + if (!pr->targets) + { + if (ed->focused_part) + _edje_emit(ed, "focus,part,out", + ed->focused_part->part->name); + ed->focused_part = NULL; + } + else + { + EINA_LIST_FOREACH(pr->targets, l, pt) + { + if (pt->id >= 0) + { + rp = ed->table_parts[pt->id % ed->table_parts_size]; + if (rp) + { + if (ed->focused_part != rp) + { + if (ed->focused_part) + _edje_emit(ed, "focus,part,out", + ed->focused_part->part->name); + ed->focused_part = rp; + _edje_emit(ed, "focus,part,in", + ed->focused_part->part->name); + } + } + } + } + } + break; + case EDJE_ACTION_TYPE_FOCUS_OBJECT: - if (!pr->targets) - { - Evas_Object *focused; + if (!pr->targets) + { + Evas_Object *focused; - focused = evas_focus_get(evas_object_evas_get(ed->obj)); - if (focused) - { - unsigned int i; + focused = evas_focus_get(evas_object_evas_get(ed->obj)); + if (focused) + { + unsigned int i; + + /* Check if the current swallowed object is one of my child. */ + for (i = 0; i < ed->table_parts_size; ++i) + { + rp = ed->table_parts[i]; + if ((rp) && + ((rp->type == EDJE_RP_TYPE_SWALLOW) && + (rp->typedata.swallow)) && + (rp->typedata.swallow->swallowed_object == focused)) + { + evas_object_focus_set(focused, EINA_FALSE); + break; + } + } + } + } + else + { + EINA_LIST_FOREACH(pr->targets, l, pt) + { + if (pt->id >= 0) + { + rp = ed->table_parts[pt->id % ed->table_parts_size]; + if (rp && + ((rp->type == EDJE_RP_TYPE_SWALLOW) && + (rp->typedata.swallow)) && + (rp->typedata.swallow->swallowed_object)) + evas_object_focus_set(rp->typedata.swallow->swallowed_object, EINA_TRUE); + } + } + } + break; - /* Check if the current swallowed object is one of my child. */ - for (i = 0; i < ed->table_parts_size; ++i) - { - rp = ed->table_parts[i]; - if ((rp) && - ((rp->type == EDJE_RP_TYPE_SWALLOW) && - (rp->typedata.swallow)) && - (rp->typedata.swallow->swallowed_object == focused)) - { - evas_object_focus_set(focused, EINA_FALSE); - break; - } - } - } - } - else - { - EINA_LIST_FOREACH(pr->targets, l, pt) - { - if (pt->id >= 0) - { - rp = ed->table_parts[pt->id % ed->table_parts_size]; - if (rp && - ((rp->type == EDJE_RP_TYPE_SWALLOW) && - (rp->typedata.swallow)) && - (rp->typedata.swallow->swallowed_object)) - evas_object_focus_set(rp->typedata.swallow->swallowed_object, EINA_TRUE); - } - } - } - break; case EDJE_ACTION_TYPE_SOUND_SAMPLE: - if (_edje_block_break(ed)) - goto break_prog; - _edje_multisense_internal_sound_sample_play(ed, pr->sample_name, pr->speed, pr->channel); - break; + if (_edje_block_break(ed)) + goto break_prog; + _edje_multisense_internal_sound_sample_play(ed, pr->sample_name, pr->speed, pr->channel); + break; + case EDJE_ACTION_TYPE_SOUND_TONE: - if (_edje_block_break(ed)) - goto break_prog; - _edje_multisense_internal_sound_tone_play(ed, pr->tone_name, pr->duration, pr->channel); - break; + if (_edje_block_break(ed)) + goto break_prog; + _edje_multisense_internal_sound_tone_play(ed, pr->tone_name, pr->duration, pr->channel); + break; + case EDJE_ACTION_TYPE_VIBRATION_SAMPLE: - if (_edje_block_break(ed)) - goto break_prog; - _edje_multisense_internal_vibration_sample_play(ed, pr->vibration_name, pr->vibration_repeat); - break; + if (_edje_block_break(ed)) + goto break_prog; + _edje_multisense_internal_vibration_sample_play(ed, pr->vibration_name, pr->vibration_repeat); + break; + case EDJE_ACTION_TYPE_PARAM_COPY: - { - Edje_Real_Part *src_part, *dst_part; + { + Edje_Real_Part *src_part, *dst_part; - // _edje_emit(ed, "program,start", pr->name); - if (_edje_block_break(ed)) goto break_prog; + // _edje_emit(ed, "program,start", pr->name); + if (_edje_block_break(ed)) goto break_prog; - src_part = ed->table_parts[pr->param.src % ed->table_parts_size]; - dst_part = ed->table_parts[pr->param.dst % ed->table_parts_size]; - _edje_param_copy(ed, src_part, pr->state, dst_part, pr->state2); + src_part = ed->table_parts[pr->param.src % ed->table_parts_size]; + dst_part = ed->table_parts[pr->param.dst % ed->table_parts_size]; + _edje_param_copy(ed, src_part, pr->state, dst_part, pr->state2); + + if (_edje_block_break(ed)) goto break_prog; + // _edje_emit(ed, "program,stop", pr->name); + if (_edje_block_break(ed)) goto break_prog; + } + break; - if (_edje_block_break(ed)) goto break_prog; - // _edje_emit(ed, "program,stop", pr->name); - if (_edje_block_break(ed)) goto break_prog; - } - break; case EDJE_ACTION_TYPE_PARAM_SET: - { - Edje_Real_Part *part; + { + Edje_Real_Part *part; - // _edje_emit(ed, "program,start", pr->name); - if (_edje_block_break(ed)) goto break_prog; + // _edje_emit(ed, "program,start", pr->name); + if (_edje_block_break(ed)) goto break_prog; - part = ed->table_parts[pr->param.dst % ed->table_parts_size]; - _edje_param_set(ed, part, pr->state, pr->state2); + part = ed->table_parts[pr->param.dst % ed->table_parts_size]; + _edje_param_set(ed, part, pr->state, pr->state2); + + if (_edje_block_break(ed)) goto break_prog; + // _edje_emit(ed, "program,stop", pr->name); + if (_edje_block_break(ed)) goto break_prog; + } + break; - if (_edje_block_break(ed)) goto break_prog; - // _edje_emit(ed, "program,stop", pr->name); - if (_edje_block_break(ed)) goto break_prog; - } - break; #ifdef HAVE_EPHYSICS case EDJE_ACTION_TYPE_PHYSICS_IMPULSE: - if (!_edje_physics_action_set(ed, pr, ephysics_body_central_impulse_apply)) - goto break_prog; - break; + if (!_edje_physics_action_set(ed, pr, ephysics_body_central_impulse_apply)) + goto break_prog; + break; + case EDJE_ACTION_TYPE_PHYSICS_TORQUE_IMPULSE: - if (!_edje_physics_action_set(ed, pr, ephysics_body_torque_impulse_apply)) - goto break_prog; - break; + if (!_edje_physics_action_set(ed, pr, ephysics_body_torque_impulse_apply)) + goto break_prog; + break; + case EDJE_ACTION_TYPE_PHYSICS_FORCE: - if (!_edje_physics_action_set(ed, pr, ephysics_body_central_force_apply)) - goto break_prog; - break; + if (!_edje_physics_action_set(ed, pr, ephysics_body_central_force_apply)) + goto break_prog; + break; + case EDJE_ACTION_TYPE_PHYSICS_TORQUE: - if (!_edje_physics_action_set(ed, pr, ephysics_body_torque_apply)) - goto break_prog; - break; + if (!_edje_physics_action_set(ed, pr, ephysics_body_torque_apply)) + goto break_prog; + break; + case EDJE_ACTION_TYPE_PHYSICS_FORCES_CLEAR: - if (_edje_block_break(ed)) - goto break_prog; - EINA_LIST_FOREACH(pr->targets, l, pt) - { - if (pt->id >= 0) - { - rp = ed->table_parts[pt->id % ed->table_parts_size]; - if ((rp) && (rp->body)) - ephysics_body_forces_clear(rp->body); - } - } - break; + if (_edje_block_break(ed)) + goto break_prog; + EINA_LIST_FOREACH(pr->targets, l, pt) + { + if (pt->id >= 0) + { + rp = ed->table_parts[pt->id % ed->table_parts_size]; + if ((rp) && (rp->body)) + ephysics_body_forces_clear(rp->body); + } + } + break; + case EDJE_ACTION_TYPE_PHYSICS_VEL_SET: - if (!_edje_physics_action_set(ed, pr, ephysics_body_linear_velocity_set)) - goto break_prog; - break; + if (!_edje_physics_action_set(ed, pr, ephysics_body_linear_velocity_set)) + goto break_prog; + break; + case EDJE_ACTION_TYPE_PHYSICS_ANG_VEL_SET: - if (!_edje_physics_action_set(ed, pr, ephysics_body_angular_velocity_set)) - goto break_prog; - break; + if (!_edje_physics_action_set(ed, pr, ephysics_body_angular_velocity_set)) + goto break_prog; + break; + case EDJE_ACTION_TYPE_PHYSICS_STOP: - if (_edje_block_break(ed)) - goto break_prog; - EINA_LIST_FOREACH(pr->targets, l, pt) - { - if (pt->id >= 0) - { - rp = ed->table_parts[pt->id % ed->table_parts_size]; - if ((rp) && (rp->body)) - ephysics_body_stop(rp->body); - } - } - break; + if (_edje_block_break(ed)) + goto break_prog; + EINA_LIST_FOREACH(pr->targets, l, pt) + { + if (pt->id >= 0) + { + rp = ed->table_parts[pt->id % ed->table_parts_size]; + if ((rp) && (rp->body)) + ephysics_body_stop(rp->body); + } + } + break; + case EDJE_ACTION_TYPE_PHYSICS_ROT_SET: - if (_edje_block_break(ed)) - goto break_prog; - EINA_LIST_FOREACH(pr->targets, l, pt) - { - if (pt->id >= 0) - { - rp = ed->table_parts[pt->id % ed->table_parts_size]; - if ((rp) && (rp->body)) - { - EPhysics_Quaternion quat; - ephysics_quaternion_set(&quat, pr->physics.x, - pr->physics.y, pr->physics.z, - pr->physics.w); - ephysics_quaternion_normalize(&quat); - ephysics_body_rotation_set(rp->body, &quat); - } - } - } - break; + if (_edje_block_break(ed)) + goto break_prog; + EINA_LIST_FOREACH(pr->targets, l, pt) + { + if (pt->id >= 0) + { + rp = ed->table_parts[pt->id % ed->table_parts_size]; + if ((rp) && (rp->body)) + { + EPhysics_Quaternion quat; + ephysics_quaternion_set(&quat, pr->physics.x, + pr->physics.y, pr->physics.z, + pr->physics.w); + ephysics_quaternion_normalize(&quat); + ephysics_body_rotation_set(rp->body, &quat); + } + } + } + break; + #endif default: - // _edje_emit(ed, "program,start", pr->name); - // _edje_emit(ed, "program,stop", pr->name); - break; + // _edje_emit(ed, "program,start", pr->name); + // _edje_emit(ed, "program,stop", pr->name); + break; } if (!((pr->action == EDJE_ACTION_TYPE_STATE_SET) /* hmm this fucks somethgin up. must look into it later */ /* && (pr->tween.time > ZERO) && (!ed->no_anim))) */ - )) - { - EINA_LIST_FOREACH(pr->after, l, pa) - { - if (pa->id >= 0) - { - pr2 = ed->collection->patterns.table_programs[pa->id % ed->collection->patterns.table_programs_size]; - if (pr2) _edje_program_run(ed, pr2, 0, "", ""); - if (_edje_block_break(ed)) goto break_prog; - } - } - } + )) + { + EINA_LIST_FOREACH(pr->after, l, pa) + { + if (pa->id >= 0) + { + pr2 = ed->collection->patterns.table_programs[pa->id % ed->collection->patterns.table_programs_size]; + if (pr2) _edje_program_run(ed, pr2, 0, "", ""); + if (_edje_block_break(ed)) goto break_prog; + } + } + } break_prog: _edje_util_thaw(ed); _edje_unref(ed); @@ -1160,12 +1190,13 @@ _edje_emit_full(Edje *ed, const char *sig, const char *src, void *data, void (*f struct _Edje_Program_Data { - Eina_List *matches; - Edje *ed; - const char *source; + Eina_List *matches; + Edje *ed; + const char *source; }; -static Eina_Bool _edje_glob_callback(Edje_Program *pr, void *dt) +static Eina_Bool +_edje_glob_callback(Edje_Program *pr, void *dt) { struct _Edje_Program_Data *data = dt; Edje_Real_Part *rp = NULL; @@ -1222,56 +1253,56 @@ _edje_emit_handle(Edje *ed, const char *sig, const char *src, done = 0; #ifdef EDJE_PROGRAM_CACHE - { - Eina_List *matches; - Eina_List *l; - Edje_Program *pr; + { + Eina_List *matches; + Eina_List *l; + Edje_Program *pr; - if (eina_hash_find(ec->prog_cache.no_matches, tmps)) - { - done = 1; - } - else if ((matches = eina_hash_find(ec->prog_cache.matches, tmps))) - { - EINA_LIST_FOREACH(matches, l, pr) - { - Eina_Bool exec = EINA_TRUE; + if (eina_hash_find(ec->prog_cache.no_matches, tmps)) + { + done = 1; + } + else if ((matches = eina_hash_find(ec->prog_cache.matches, tmps))) + { + EINA_LIST_FOREACH(matches, l, pr) + { + Eina_Bool exec = EINA_TRUE; - if (pr->filter.state) - { - Edje_Real_Part *rp; - - rp = _edje_real_part_get(ed, pr->filter.part ? pr->filter.part : src); - if (rp) - { - if (rp->program) - exec = EINA_FALSE; - else - exec = (rp->chosen_description->state.name != pr->filter.state) ? - !strcmp(rp->chosen_description->state.name, pr->filter.state) : EINA_TRUE; - } - } - - pr->exec = exec; - } - - EINA_LIST_FOREACH(matches, l, pr) - if (pr->exec) + if (pr->filter.state) { - _edje_program_run(ed, pr, 0, sig, src); - if (_edje_block_break(ed)) + Edje_Real_Part *rp; + + rp = _edje_real_part_get(ed, pr->filter.part ? pr->filter.part : src); + if (rp) { - goto break_prog; + if (rp->program) + exec = EINA_FALSE; + else + exec = (rp->chosen_description->state.name != pr->filter.state) ? + !strcmp(rp->chosen_description->state.name, pr->filter.state) : EINA_TRUE; } } - done = 1; - } - } + pr->exec = exec; + } + + EINA_LIST_FOREACH(matches, l, pr) + if (pr->exec) + { + _edje_program_run(ed, pr, 0, sig, src); + if (_edje_block_break(ed)) + { + goto break_prog; + } + } + + done = 1; + } + } #endif if (!done) { - struct _Edje_Program_Data data; + struct _Edje_Program_Data data; data.ed = ed; data.source = src; @@ -1303,25 +1334,25 @@ _edje_emit_handle(Edje *ed, const char *sig, const char *src, Edje_Program **tpr; EINA_INARRAY_FOREACH(match, tpr) - _edje_glob_callback(*tpr, &data); + _edje_glob_callback(*tpr, &data); } #ifdef EDJE_PROGRAM_CACHE EINA_LIST_FOREACH(data.matches, l, pr) #else - EINA_LIST_FREE(data.matches, pr) + EINA_LIST_FREE(data.matches, pr) #endif - { - if (pr->exec) - _edje_program_run(ed, pr, 0, sig, src); + { + if (pr->exec) + _edje_program_run(ed, pr, 0, sig, src); - if (_edje_block_break(ed)) - { - eina_list_free(data.matches); - data.matches = NULL; - goto break_prog; - } - } + if (_edje_block_break(ed)) + { + eina_list_free(data.matches); + data.matches = NULL; + goto break_prog; + } + } } #ifdef EDJE_PROGRAM_CACHE @@ -1383,7 +1414,7 @@ _edje_emit_cb(Edje *ed, const char *sig, const char *src, Edje_Message_Signal_Da ssp = _edje_signal_callback_patterns_ref(ed->callbacks); - m = (Edje_Signal_Callback_Matches*) ed->callbacks->matches; + m = (Edje_Signal_Callback_Matches *)ed->callbacks->matches; EINA_REFCOUNT_REF(m); callback_extra_data = (data) ? data->data : NULL; @@ -1407,16 +1438,16 @@ _edje_emit_cb(Edje *ed, const char *sig, const char *src, Edje_Message_Signal_Da unsigned int *i; EINA_INARRAY_FOREACH(match, i) - { - if (ed->callbacks->flags[*i].delete_me) continue; - if ((prop) && (ed->callbacks->flags[*i].propagate)) continue; + { + if (ed->callbacks->flags[*i].delete_me) continue; + if ((prop) && (ed->callbacks->flags[*i].propagate)) continue; - cb = &m->matches[*i]; + cb = &m->matches[*i]; - cb->func((void*) ed->callbacks->custom_data[*i], ed->obj, sig, src); - if (_edje_block_break(ed)) - break; - } + cb->func((void *)ed->callbacks->custom_data[*i], ed->obj, sig, src); + if (_edje_block_break(ed)) + break; + } } break_prog: @@ -1695,7 +1726,7 @@ _edje_param_native_set(Edje *ed, Edje_Real_Part *rp, const char *name, const Edj rp->invalidate = EINA_TRUE; #endif _edje_dragable_pos_set - (ed, rp, rp->drag->val.x, rp->drag->val.y); + (ed, rp, rp->drag->val.x, rp->drag->val.y); _edje_emit(ed, "drag,set", rp->part->name); return EINA_TRUE; } @@ -1714,7 +1745,7 @@ _edje_param_native_set(Edje *ed, Edje_Real_Part *rp, const char *name, const Edj rp->invalidate = EINA_TRUE; #endif _edje_dragable_pos_set - (ed, rp, rp->drag->val.x, rp->drag->val.y); + (ed, rp, rp->drag->val.x, rp->drag->val.y); _edje_emit(ed, "drag,set", rp->part->name); return EINA_TRUE; } @@ -1804,7 +1835,7 @@ _edje_native_param_info_get(const Edje_Real_Part *rp, const char *name) if (!strcmp(name, "text")) { static const Edje_External_Param_Info pi = - EDJE_EXTERNAL_PARAM_INFO_STRING("text"); + EDJE_EXTERNAL_PARAM_INFO_STRING("text"); return π } if (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK) @@ -1812,13 +1843,13 @@ _edje_native_param_info_get(const Edje_Real_Part *rp, const char *name) if (!strcmp(name, "text_unescaped")) { static const Edje_External_Param_Info pi = - EDJE_EXTERNAL_PARAM_INFO_STRING("text_unescaped"); + EDJE_EXTERNAL_PARAM_INFO_STRING("text_unescaped"); return π } if (!strcmp(name, "select_allow")) { static const Edje_External_Param_Info pi = - EDJE_EXTERNAL_PARAM_INFO_BOOL("text_unescaped"); + EDJE_EXTERNAL_PARAM_INFO_BOOL("text_unescaped"); return π } } @@ -1832,49 +1863,49 @@ _edje_native_param_info_get(const Edje_Real_Part *rp, const char *name) if (!strcmp(name, "value_x")) { static const Edje_External_Param_Info pi = - EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_value_x"); + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_value_x"); return π } if (!strcmp(name, "value_y")) { static const Edje_External_Param_Info pi = - EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_value_y"); + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_value_y"); return π } if (!strcmp(name, "size_w")) { static const Edje_External_Param_Info pi = - EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_size_w"); + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_size_w"); return π } if (!strcmp(name, "size_h")) { static const Edje_External_Param_Info pi = - EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_size_h"); + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_size_h"); return π } if (!strcmp(name, "step_x")) { static const Edje_External_Param_Info pi = - EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_step_x"); + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_step_x"); return π } if (!strcmp(name, "step_y")) { static const Edje_External_Param_Info pi = - EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_step_y"); + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_step_y"); return π } if (!strcmp(name, "page_x")) { static const Edje_External_Param_Info pi = - EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_page_x"); + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_page_x"); return π } if (!strcmp(name, "page_y")) { static const Edje_External_Param_Info pi = - EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_page_y"); + EDJE_EXTERNAL_PARAM_INFO_DOUBLE("drag_page_y"); return π } @@ -1894,104 +1925,116 @@ _edje_param_convert(Edje_External_Param *param, const Edje_External_Param_Info * { case EDJE_EXTERNAL_PARAM_TYPE_BOOL: case EDJE_EXTERNAL_PARAM_TYPE_INT: + { + int i; + switch (param->type) { - int i; - switch (param->type) - { - case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: - i = (int)param->d; - break; - case EDJE_EXTERNAL_PARAM_TYPE_STRING: - case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: - i = (param->s) ? atoi(param->s) : 0; - break; - case EDJE_EXTERNAL_PARAM_TYPE_BOOL: - case EDJE_EXTERNAL_PARAM_TYPE_INT: - i = param->i; - break; - default: - return NULL; - } - if (dst_info->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) - i = !!i; - param->type = dst_info->type; - param->i = i; - return param; + case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: + i = (int)param->d; + break; + + case EDJE_EXTERNAL_PARAM_TYPE_STRING: + case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: + i = (param->s) ? atoi(param->s) : 0; + break; + + case EDJE_EXTERNAL_PARAM_TYPE_BOOL: + case EDJE_EXTERNAL_PARAM_TYPE_INT: + i = param->i; + break; + + default: + return NULL; } + if (dst_info->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL) + i = !!i; + param->type = dst_info->type; + param->i = i; + return param; + } case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: + { + double d; + switch (param->type) { - double d; - switch (param->type) - { - case EDJE_EXTERNAL_PARAM_TYPE_INT: - d = (double)param->i; - break; - case EDJE_EXTERNAL_PARAM_TYPE_STRING: - case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: - d = (param->s) ? atof(param->s) : 0.0; - break; - case EDJE_EXTERNAL_PARAM_TYPE_BOOL: - d = (double)param->i; - break; - default: - return NULL; - } - param->type = dst_info->type; - param->d = d; - return param; + case EDJE_EXTERNAL_PARAM_TYPE_INT: + d = (double)param->i; + break; + + case EDJE_EXTERNAL_PARAM_TYPE_STRING: + case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: + d = (param->s) ? atof(param->s) : 0.0; + break; + + case EDJE_EXTERNAL_PARAM_TYPE_BOOL: + d = (double)param->i; + break; + + default: + return NULL; } + param->type = dst_info->type; + param->d = d; + return param; + } case EDJE_EXTERNAL_PARAM_TYPE_STRING: + { + static char s[64]; + switch (param->type) { - static char s[64]; - switch (param->type) - { - case EDJE_EXTERNAL_PARAM_TYPE_BOOL: - case EDJE_EXTERNAL_PARAM_TYPE_INT: - if (!snprintf(s, sizeof(s), "%i", param->i)) return NULL; - break; - case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: - if (!snprintf(s, sizeof(s), "%f", param->d)) return NULL; - break; - case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: - param->type = dst_info->type; - return param; - default: - return NULL; - } + case EDJE_EXTERNAL_PARAM_TYPE_BOOL: + case EDJE_EXTERNAL_PARAM_TYPE_INT: + if (!snprintf(s, sizeof(s), "%i", param->i)) return NULL; + break; + + case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: + if (!snprintf(s, sizeof(s), "%f", param->d)) return NULL; + break; + + case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: param->type = dst_info->type; - param->s = s; return param; + + default: + return NULL; } + param->type = dst_info->type; + param->s = s; + return param; + } case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: + { + static char s[64]; + const char *val; + switch (param->type) { - static char s[64]; - const char *val; - switch (param->type) - { - case EDJE_EXTERNAL_PARAM_TYPE_BOOL: - case EDJE_EXTERNAL_PARAM_TYPE_INT: - if (!snprintf(s, sizeof(s), "%i", param->i)) return NULL; - val = s; - break; - case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: - if (!snprintf(s, sizeof(s), "%f", param->d)) return NULL; - val = s; - break; - case EDJE_EXTERNAL_PARAM_TYPE_STRING: - val = param->s; - break; - default: - return NULL; - } + case EDJE_EXTERNAL_PARAM_TYPE_BOOL: + case EDJE_EXTERNAL_PARAM_TYPE_INT: + if (!snprintf(s, sizeof(s), "%i", param->i)) return NULL; + val = s; + break; - param->type = dst_info->type; - if (param->s != val) param->s = val; - return param; + case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: + if (!snprintf(s, sizeof(s), "%f", param->d)) return NULL; + val = s; + break; + + case EDJE_EXTERNAL_PARAM_TYPE_STRING: + val = param->s; + break; + + default: + return NULL; } + param->type = dst_info->type; + if (param->s != val) param->s = val; + return param; + } + default: return NULL; } } @@ -2002,47 +2045,47 @@ _edje_param_validate(const Edje_External_Param *param, const Edje_External_Param switch (info->type) { case EDJE_EXTERNAL_PARAM_TYPE_BOOL: - return ((param->i == 0) || (param->i == 1)); + return (param->i == 0) || (param->i == 1); case EDJE_EXTERNAL_PARAM_TYPE_INT: - if ((info->info.i.min != EDJE_EXTERNAL_INT_UNSET) && - (info->info.i.min > param->i)) - return EINA_FALSE; + if ((info->info.i.min != EDJE_EXTERNAL_INT_UNSET) && + (info->info.i.min > param->i)) + return EINA_FALSE; - if ((info->info.i.max != EDJE_EXTERNAL_INT_UNSET) && - (info->info.i.max < param->i)) - return EINA_FALSE; + if ((info->info.i.max != EDJE_EXTERNAL_INT_UNSET) && + (info->info.i.max < param->i)) + return EINA_FALSE; - return EINA_TRUE; + return EINA_TRUE; case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: - if ((info->info.d.min != EDJE_EXTERNAL_DOUBLE_UNSET) && - (info->info.d.min > param->d)) - return EINA_FALSE; + if ((info->info.d.min != EDJE_EXTERNAL_DOUBLE_UNSET) && + (info->info.d.min > param->d)) + return EINA_FALSE; - if ((info->info.d.max != EDJE_EXTERNAL_DOUBLE_UNSET) && - (info->info.d.max < param->d)) - return EINA_FALSE; + if ((info->info.d.max != EDJE_EXTERNAL_DOUBLE_UNSET) && + (info->info.d.max < param->d)) + return EINA_FALSE; - return EINA_TRUE; + return EINA_TRUE; case EDJE_EXTERNAL_PARAM_TYPE_STRING: - if (!param->s) return EINA_FALSE; - if (info->info.s.accept_fmt) - INF("string 'accept_fmt' validation not implemented."); - if (info->info.s.deny_fmt) - INF("string 'deny_fmt' validation not implemented."); - return EINA_TRUE; + if (!param->s) return EINA_FALSE; + if (info->info.s.accept_fmt) + INF("string 'accept_fmt' validation not implemented."); + if (info->info.s.deny_fmt) + INF("string 'deny_fmt' validation not implemented."); + return EINA_TRUE; case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: - { - const char **itr = info->info.c.choices; - if (!itr) return EINA_FALSE; - for (; *itr; itr++) - if (!strcmp(*itr, param->s)) - return EINA_TRUE; - return EINA_FALSE; - } + { + const char **itr = info->info.c.choices; + if (!itr) return EINA_FALSE; + for (; *itr; itr++) + if (!strcmp(*itr, param->s)) + return EINA_TRUE; + return EINA_FALSE; + } default: return EINA_FALSE; } @@ -2062,7 +2105,7 @@ _edje_param_copy(Edje *ed, Edje_Real_Part *src_part, const char *src_param, Edje (dst_part->type == EDJE_RP_TYPE_SWALLOW) && (dst_part->typedata.swallow)) dst_info = _edje_external_param_info_get - (dst_part->typedata.swallow->swallowed_object, dst_param); + (dst_part->typedata.swallow->swallowed_object, dst_param); else dst_info = _edje_native_param_info_get(dst_part, dst_param); @@ -2076,7 +2119,7 @@ _edje_param_copy(Edje *ed, Edje_Real_Part *src_part, const char *src_param, Edje if (src_part->part->type == EDJE_PART_TYPE_EXTERNAL) { if (!_edje_param_external_get - (src_part, src_param, &val)) + (src_part, src_param, &val)) { ERR("cannot get parameter '%s' of part '%s'", src_param, src_part->part->name); @@ -2197,3 +2240,4 @@ _edje_param_set(Edje *ed, Edje_Real_Part *part, const char *param, const char *v } } } + diff --git a/src/lib/edje/edje_signal.c b/src/lib/edje/edje_signal.c index 0d51a51a80..e92787f364 100644 --- a/src/lib/edje/edje_signal.c +++ b/src/lib/edje/edje_signal.c @@ -22,7 +22,7 @@ _edje_signal_match_key_cmp(const void *key1, int key1_length EINA_UNUSED, const { if (a->matches[i].signal != b->matches[i].signal) return a->matches[i].signal - b->matches[i].signal; if (a->matches[i].source != b->matches[i].source) return a->matches[i].source - b->matches[i].source; - if (a->matches[i].func != b->matches[i].func) return (unsigned char*) a->matches[i].func - (unsigned char*) b->matches[i].func; + if (a->matches[i].func != b->matches[i].func) return (unsigned char *)a->matches[i].func - (unsigned char *)b->matches[i].func; } return 0; } @@ -37,13 +37,13 @@ _edje_signal_match_key_hash(const void *key, int key_length EINA_UNUSED) for (i = 0; i < a->matches_count; ++i) { #ifdef EFL64 - hash ^= eina_hash_int64((const unsigned long long int*) &a->matches[i].signal, sizeof (char *)); - hash ^= eina_hash_int64((const unsigned long long int*) &a->matches[i].source, sizeof (char *)); - hash ^= eina_hash_int64((const unsigned long long int*) &a->matches[i].func, sizeof (Edje_Signal_Cb)); + hash ^= eina_hash_int64((const unsigned long long int *)&a->matches[i].signal, sizeof (char *)); + hash ^= eina_hash_int64((const unsigned long long int *)&a->matches[i].source, sizeof (char *)); + hash ^= eina_hash_int64((const unsigned long long int *)&a->matches[i].func, sizeof (Edje_Signal_Cb)); #else - hash ^= eina_hash_int32((const unsigned int*) a->matches[i].signal, sizeof (char *)); - hash ^= eina_hash_int32((const unsigned int*) a->matches[i].source, sizeof (char *)); - hash ^= eina_hash_int32((const unsigned int*) a->matches[i].func, sizeof (Edje_Signal_Cb)); + hash ^= eina_hash_int32((const unsigned int *)a->matches[i].signal, sizeof (char *)); + hash ^= eina_hash_int32((const unsigned int *)a->matches[i].source, sizeof (char *)); + hash ^= eina_hash_int32((const unsigned int *)a->matches[i].func, sizeof (Edje_Signal_Cb)); #endif } return hash; @@ -66,9 +66,9 @@ _edje_signal_callback_matches_dup(const Edje_Signal_Callback_Matches *src) for (i = 0; i < src->matches_count; i++) { - result->matches[i].signal = eina_stringshare_ref(src->matches[i].signal); - result->matches[i].source = eina_stringshare_ref(src->matches[i].source); - result->matches[i].func = src->matches[i].func; + result->matches[i].signal = eina_stringshare_ref(src->matches[i].signal); + result->matches[i].source = eina_stringshare_ref(src->matches[i].source); + result->matches[i].func = src->matches[i].func; } return result; @@ -80,7 +80,7 @@ _edje_callbacks_patterns_clean(Edje_Signal_Callback_Group *gp) Edje_Signal_Callback_Matches *tmp; assert(EINA_REFCOUNT_GET(gp->matches) == 1); - tmp = (Edje_Signal_Callback_Matches*) gp->matches; + tmp = (Edje_Signal_Callback_Matches *)gp->matches; _edje_signal_callback_patterns_unref(tmp->patterns); tmp->patterns = NULL; @@ -94,15 +94,15 @@ _edje_callbacks_patterns_init(Edje_Signal_Callback_Group *gp) if (gp->matches->patterns) return; - tmp = (Edje_Signal_Callback_Matches*) gp->matches; + tmp = (Edje_Signal_Callback_Matches *)gp->matches; tmp->patterns = calloc(1, sizeof (Edje_Signals_Sources_Patterns)); if (!gp->matches->patterns) return; ssp = gp->matches->patterns; edje_match_callback_hash_build(gp->matches->matches, - gp->matches->matches_count, - &ssp->exact_match, - &ssp->u.callbacks.globing); + gp->matches->matches_count, + &ssp->exact_match, + &ssp->u.callbacks.globing); ssp->signals_patterns = edje_match_callback_signal_init(&ssp->u.callbacks.globing, tmp->matches); ssp->sources_patterns = edje_match_callback_source_init(&ssp->u.callbacks.globing, tmp->matches); @@ -160,10 +160,10 @@ _edje_signal_callback_grow(Edje_Signal_Callback_Group *gp) { Edje_Signal_Callback_Matches *tmp; - tmp = (Edje_Signal_Callback_Matches*) gp->matches; + tmp = (Edje_Signal_Callback_Matches *)gp->matches; tmp->matches_count++; tmp->matches = realloc(tmp->matches, sizeof (Edje_Signal_Callback_Match) * tmp->matches_count); - gp->custom_data = realloc(gp->custom_data, sizeof (void*) * tmp->matches_count); + gp->custom_data = realloc(gp->custom_data, sizeof (void *) * tmp->matches_count); gp->flags = realloc(gp->flags, sizeof (Edje_Signal_Callback_Flags) * tmp->matches_count); return gp; @@ -174,7 +174,7 @@ _edje_signal_callback_push(const Edje_Signal_Callback_Group *cgp, const char *sig, const char *src, Edje_Signal_Cb func, void *data, Eina_Bool propagate) { - Edje_Signal_Callback_Group *gp = (Edje_Signal_Callback_Group*) cgp; + Edje_Signal_Callback_Group *gp = (Edje_Signal_Callback_Group *)cgp; unsigned int i; Edje_Signal_Callback_Flags flags; @@ -200,7 +200,7 @@ _edje_signal_callback_push(const Edje_Signal_Callback_Group *cgp, { Edje_Signal_Callback_Matches *tmp; - tmp = (Edje_Signal_Callback_Matches*) gp->matches; + tmp = (Edje_Signal_Callback_Matches *)gp->matches; if (EINA_REFCOUNT_GET(tmp) == 1) { @@ -210,7 +210,7 @@ _edje_signal_callback_push(const Edje_Signal_Callback_Group *cgp, else { Edje_Signal_Callback_Matches *tmp_dup; - tmp_dup = (Edje_Signal_Callback_Matches*) _edje_signal_callback_matches_dup(tmp); + tmp_dup = (Edje_Signal_Callback_Matches *)_edje_signal_callback_matches_dup(tmp); if (!tmp_dup) return; EINA_REFCOUNT_UNREF(tmp) (void) 0; // Nothing to do because the case where refcount == 1 was already handle above. @@ -264,32 +264,32 @@ void _edje_signal_callback_matches_unref(Edje_Signal_Callback_Matches *m) { EINA_REFCOUNT_UNREF(m) - { - unsigned int i; + { + unsigned int i; - _edje_signal_callback_patterns_unref(m->patterns); + _edje_signal_callback_patterns_unref(m->patterns); - if (m->hashed) - eina_hash_del(signal_match, m, m); - - for (i = 0; i < m->matches_count; ++i) - { - eina_stringshare_del(m->matches[i].signal); - eina_stringshare_del(m->matches[i].source); - } - free(m->matches); - free(m); - } + if (m->hashed) + eina_hash_del(signal_match, m, m); + + for (i = 0; i < m->matches_count; ++i) + { + eina_stringshare_del(m->matches[i].signal); + eina_stringshare_del(m->matches[i].source); + } + free(m->matches); + free(m); + } } void _edje_signal_callback_free(const Edje_Signal_Callback_Group *cgp) { - Edje_Signal_Callback_Group *gp = (Edje_Signal_Callback_Group*) cgp; + Edje_Signal_Callback_Group *gp = (Edje_Signal_Callback_Group *)cgp; if (!gp) return; - _edje_signal_callback_matches_unref((Edje_Signal_Callback_Matches*) gp->matches); + _edje_signal_callback_matches_unref((Edje_Signal_Callback_Matches *)gp->matches); gp->matches = NULL; free(gp->flags); free(gp->custom_data); @@ -301,7 +301,7 @@ _edje_signal_callback_disable(const Edje_Signal_Callback_Group *cgp, const char *sig, const char *src, Edje_Signal_Cb func, void *data) { - Edje_Signal_Callback_Group *gp = (Edje_Signal_Callback_Group*) cgp; + Edje_Signal_Callback_Group *gp = (Edje_Signal_Callback_Group *)cgp; unsigned int i; if (!gp || !gp->matches) return NULL; @@ -343,7 +343,7 @@ _edje_signal_callback_move_last(Edje_Signal_Callback_Group *gp, Edje_Signal_Callback_Matches *m; unsigned int j; - m = (Edje_Signal_Callback_Matches*) gp->matches; + m = (Edje_Signal_Callback_Matches *)gp->matches; for (j = --m->matches_count; j > i; --j) { @@ -364,7 +364,7 @@ const Edje_Signals_Sources_Patterns * _edje_signal_callback_patterns_ref(const Edje_Signal_Callback_Group *gp) { const Edje_Signal_Callback_Matches *m; - Edje_Signal_Callback_Matches *tmp; + Edje_Signal_Callback_Matches *tmp; if (gp->matches->hashed) goto got_it; @@ -372,7 +372,7 @@ _edje_signal_callback_patterns_ref(const Edje_Signal_Callback_Group *gp) m = eina_hash_find(signal_match, gp->matches); if (!m) { - tmp = (Edje_Signal_Callback_Matches*) gp->matches; + tmp = (Edje_Signal_Callback_Matches *)gp->matches; if (!(tmp->patterns && (EINA_REFCOUNT_GET(tmp->patterns) > 1))) { // Let compact it and remove uneeded pattern before building it @@ -382,31 +382,30 @@ _edje_signal_callback_patterns_ref(const Edje_Signal_Callback_Group *gp) for (i = 0; i < tmp->matches_count; i++) { if (gp->flags[i].delete_me) - _edje_signal_callback_move_last((Edje_Signal_Callback_Group*) gp, i); + _edje_signal_callback_move_last((Edje_Signal_Callback_Group *)gp, i); } - } _edje_signal_callback_patterns_unref(tmp->patterns); tmp->patterns = NULL; - _edje_callbacks_patterns_init((Edje_Signal_Callback_Group*) gp); - eina_hash_add(signal_match, tmp, tmp); - // We should be able to use direct_add, but if I do so valgrind stack explode and - // it bagain to be a pain to debug efl apps. I can't understand what is going on. + _edje_callbacks_patterns_init((Edje_Signal_Callback_Group *)gp); + eina_hash_add(signal_match, tmp, tmp); + // We should be able to use direct_add, but if I do so valgrind stack explode and + // it bagain to be a pain to debug efl apps. I can't understand what is going on. // eina_hash_direct_add(signal_match, tmp, tmp); tmp->hashed = EINA_TRUE; } else { - _edje_signal_callback_matches_unref((Edje_Signal_Callback_Matches*) gp->matches); - ((Edje_Signal_Callback_Group*)gp)->matches = m; - tmp = (Edje_Signal_Callback_Matches*) gp->matches; + _edje_signal_callback_matches_unref((Edje_Signal_Callback_Matches *)gp->matches); + ((Edje_Signal_Callback_Group *)gp)->matches = m; + tmp = (Edje_Signal_Callback_Matches *)gp->matches; EINA_REFCOUNT_REF(tmp); } - got_it: - tmp = (Edje_Signal_Callback_Matches*) gp->matches; +got_it: + tmp = (Edje_Signal_Callback_Matches *)gp->matches; EINA_REFCOUNT_REF(tmp->patterns); return gp->matches->patterns; @@ -419,7 +418,7 @@ _edje_signal_callback_patterns_unref(const Edje_Signals_Sources_Patterns *essp) if (!essp) return; - ssp = (Edje_Signals_Sources_Patterns*) essp; + ssp = (Edje_Signals_Sources_Patterns *)essp; EINA_REFCOUNT_UNREF(ssp) { diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index f75abd7873..225db1a794 100644 --- a/src/lib/edje/edje_smart.c +++ b/src/lib/edje/edje_smart.c @@ -6,9 +6,9 @@ # undef MY_CLASS #endif -#define MY_CLASS EDJE_OBJECT_CLASS +#define MY_CLASS EDJE_OBJECT_CLASS -#define MY_CLASS_NAME "Edje" +#define MY_CLASS_NAME "Edje" #define MY_CLASS_NAME_LEGACY "edje" Eina_List *_edje_edjes = NULL; @@ -59,7 +59,7 @@ _edje_object_eo_base_dbg_info_get(Eo *eo_obj, Edje *_pd EINA_UNUSED, Eo_Dbg_Info if (error != EDJE_LOAD_ERROR_NONE) { EO_DBG_INFO_APPEND(group, "Error", EINA_VALUE_TYPE_STRING, - edje_load_error_str(error)); + edje_load_error_str(error)); } } @@ -72,7 +72,6 @@ _edje_color_class_free(void *data) free(cc); } - /* Private Routines */ EOLIAN static void _edje_object_evas_object_smart_add(Eo *obj, Edje *ed) @@ -93,7 +92,7 @@ _edje_object_evas_object_smart_add(Eo *obj, Edje *ed) ed->obj = obj; _edje_edjes = eina_list_append(_edje_edjes, obj); /* - { + { Eina_List *l; const void *data; @@ -104,8 +103,8 @@ _edje_object_evas_object_smart_add(Eo *obj, Edje *ed) printf("EDJE: %80s | %80s\n", ed->path, ed->part); } printf("--- EDJE DUMP [%i]\n", eina_list_count(_edje_edjes)); - } - */ + } + */ evas_event_thaw(tev); evas_event_thaw_eval(tev); } @@ -168,9 +167,9 @@ _edje_object_evas_object_smart_move(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord x, { if (ep->typedata.swallow->swallowed_object) evas_object_move - (ep->typedata.swallow->swallowed_object, - ed->x + ep->x, - ed->y + ep->y); + (ep->typedata.swallow->swallowed_object, + ed->x + ep->x, + ed->y + ep->y); } } if (ep->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) @@ -236,9 +235,9 @@ _edje_object_evas_object_smart_resize(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord ed->h = h; #ifdef HAVE_EPHYSICS if ((ed->collection) && (ed->world)) - 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); + 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); #endif #ifdef EDJE_CALC_CACHE ed->all_part_change = EINA_TRUE; @@ -318,7 +317,7 @@ _edje_object_efl_file_file_set(Eo *obj, Edje *_pd EINA_UNUSED, const char *file, if (file) { f = eina_file_open(file, EINA_FALSE); - if (!f) + if (!f) { Edje *ed; @@ -386,7 +385,7 @@ edje_object_file_set(Edje_Object *obj, const char *file, const char *group) EAPI void edje_object_file_get(const Edje_Object *obj, const char **file, const char **group) { - eo_do((Edje_Object *) obj, efl_file_get(file, group)); + eo_do((Edje_Object *)obj, efl_file_get(file, group)); } #include "edje_object.eo.c" diff --git a/src/lib/edje/edje_text.c b/src/lib/edje/edje_text.c index a39d52c3b6..ec91e8e2ca 100644 --- a/src/lib/edje/edje_text.c +++ b/src/lib/edje/edje_text.c @@ -34,7 +34,7 @@ _set_translated_string(Edje *ed, Edje_Real_Part *ep) const char *text = NULL; Edje_Part_Description_Text *chosen_desc; - chosen_desc = (Edje_Part_Description_Text*)ep->chosen_description; + chosen_desc = (Edje_Part_Description_Text *)ep->chosen_description; domain = chosen_desc->text.domain; text = edje_string_get(&chosen_desc->text.text); @@ -76,14 +76,14 @@ _edje_text_part_on_add(Edje *ed, Edje_Real_Part *ep) if (ep->part->type != EDJE_PART_TYPE_TEXT) return; /* if text class exists for this part, add the edje to the tc member list */ - desc = (Edje_Part_Description_Text *) pt->default_desc; + desc = (Edje_Part_Description_Text *)pt->default_desc; if ((pt->default_desc) && (desc->text.text_class)) _edje_text_class_member_add(ed, desc->text.text_class); /* If any other classes exist add them */ for (i = 0; i < pt->other.desc_count; ++i) { - desc = (Edje_Part_Description_Text *) pt->other.desc[i]; + desc = (Edje_Part_Description_Text *)pt->other.desc[i]; if ((desc) && (desc->text.text_class)) _edje_text_class_member_add(ed, desc->text.text_class); } @@ -99,13 +99,13 @@ _edje_text_part_on_del(Edje *ed, Edje_Part *pt) if (pt->type != EDJE_PART_TYPE_TEXT) return; - desc = (Edje_Part_Description_Text *) pt->default_desc; + desc = (Edje_Part_Description_Text *)pt->default_desc; if ((pt->default_desc) && (desc->text.text_class)) _edje_text_class_member_del(ed, desc->text.text_class); for (i = 0; i < pt->other.desc_count; ++i) { - desc = (Edje_Part_Description_Text *) pt->other.desc[i]; + desc = (Edje_Part_Description_Text *)pt->other.desc[i]; if (desc->text.text_class) _edje_text_class_member_del(ed, desc->text.text_class); } @@ -199,18 +199,18 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Part_Description_Text *chosen_desc, Eina_Bool calc_only) { - const char *text = NULL; - const char *font; - char *font2 = NULL; - char *sfont = NULL; - int size; - const char *filter, *source_name; - Eina_List *filter_sources = NULL, *prev_sources = NULL, *li; - Evas_Coord tw, th; - Evas_Coord sw, sh; - int inlined_font = 0, free_text = 0; - Eina_Bool same_text = EINA_FALSE; - FLOAT_T sc; + const char *text = NULL; + const char *font; + char *font2 = NULL; + char *sfont = NULL; + int size; + const char *filter, *source_name; + Eina_List *filter_sources = NULL, *prev_sources = NULL, *li; + Evas_Coord tw, th; + Evas_Coord sw, sh; + int inlined_font = 0, free_text = 0; + Eina_Bool same_text = EINA_FALSE; + FLOAT_T sc; if ((ep->type != EDJE_RP_TYPE_TEXT) || (!ep->typedata.text)) return; @@ -426,8 +426,9 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, int bottom, top; if (th < sh) bottom = 10; - else if (th > sh) bottom = 1; - else bottom = 0; /* XXX shut up GCC, th == sh is handled before! */ + else if (th > sh) + bottom = 1; + else bottom = 0; /* XXX shut up GCC, th == sh is handled before! */ top = size; /* search one that fits (binary search) */ @@ -441,8 +442,9 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, part_get_geometry(ep, &tw, &th); - if (th < sh) bottom = current + 1; - else if (th > sh) top = current - 1; + if (th < sh) bottom = current + 1; + else if (th > sh) + top = current - 1; } while ((bottom < top) && (th != sh)); } @@ -473,272 +475,289 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, /* Handle ellipsis */ if (!chosen_desc->text.min_x) { - eo_do(ep->object, - if (inlined_font) efl_text_properties_font_source_set(ed->path); - else efl_text_properties_font_source_set(NULL)); + eo_do (ep->object, + if (inlined_font) efl_text_properties_font_source_set(ed->path); + else efl_text_properties_font_source_set(NULL)); - text = _edje_text_fit_x(ed, ep, params, chosen_desc, - text, font, size, - sw, sh, &free_text); - } - /* when evas ellipsis support was added in efl 1.8 and used to replace - * previous support, SOMEONE, who I shall call "cedric", borked ellipsis - * defaults. as a result, edje_cc continued using 0.0 (left-most) as its default value - * for ellipsis while evas used -1.0 (no ellipsizing). - * this was moderately okay for a time because nobody was using it or GROUP parts - * with text in them very frequently, and so nobody noticed that the mismatch was breaking - * sizing in some cases when the edje ellipsis value failed to be applied, - * which occurred any time text.min_x was set; in this case, ellipsis would NEVER be - * correctly applied, and instead the text object would only ever get the first - * ellipsis_set(0), permanently breaking the part. - * the only way to fix this while preserving previous behavior was to bump - * the edje file minor version and then check it here to ignore "unset" ellipsis - * values from old file versions. - * the downside is that this will break old files which have text.min_x set to 0...maybe. - * - * -zmike - * 22 April 2014 - */ - else if (((ed->file->version >= 3) && (ed->file->minor >= 6)) || - params->type.text.ellipsis) - evas_object_text_ellipsis_set(ep->object, - chosen_desc->text.min_x ? -1 : params->type.text.ellipsis); + text = _edje_text_fit_x(ed, ep, params, chosen_desc, + text, font, size, + sw, sh, &free_text); + } + /* when evas ellipsis support was added in efl 1.8 and used to replace + * previous support, SOMEONE, who I shall call "cedric", borked ellipsis + * defaults. as a result, edje_cc continued using 0.0 (left-most) as its default value + * for ellipsis while evas used -1.0 (no ellipsizing). + * this was moderately okay for a time because nobody was using it or GROUP parts + * with text in them very frequently, and so nobody noticed that the mismatch was breaking + * sizing in some cases when the edje ellipsis value failed to be applied, + * which occurred any time text.min_x was set; in this case, ellipsis would NEVER be + * correctly applied, and instead the text object would only ever get the first + * ellipsis_set(0), permanently breaking the part. + * the only way to fix this while preserving previous behavior was to bump + * the edje file minor version and then check it here to ignore "unset" ellipsis + * values from old file versions. + * the downside is that this will break old files which have text.min_x set to 0...maybe. + * + * -zmike + * 22 April 2014 + */ + else if (((ed->file->version >= 3) && (ed->file->minor >= 6)) || + params->type.text.ellipsis) + evas_object_text_ellipsis_set(ep->object, + chosen_desc->text.min_x ? -1 : params->type.text.ellipsis); - eina_stringshare_replace(&ep->typedata.text->cache.out_str, text); - ep->typedata.text->cache.in_w = sw; - ep->typedata.text->cache.in_h = sh; - ep->typedata.text->cache.in_font = font; - ep->typedata.text->cache.out_size = size; - ep->typedata.text->cache.align_x = params->type.text.align.x; - ep->typedata.text->cache.align_y = params->type.text.align.y; - ep->typedata.text->cache.ellipsis = params->type.text.ellipsis; - ep->typedata.text->cache.fit_x = chosen_desc->text.fit_x; - ep->typedata.text->cache.fit_y = chosen_desc->text.fit_y; + eina_stringshare_replace(&ep->typedata.text->cache.out_str, text); + ep->typedata.text->cache.in_w = sw; + ep->typedata.text->cache.in_h = sh; + ep->typedata.text->cache.in_font = font; + ep->typedata.text->cache.out_size = size; + ep->typedata.text->cache.align_x = params->type.text.align.x; + ep->typedata.text->cache.align_y = params->type.text.align.y; + ep->typedata.text->cache.ellipsis = params->type.text.ellipsis; + ep->typedata.text->cache.fit_x = chosen_desc->text.fit_x; + ep->typedata.text->cache.fit_y = chosen_desc->text.fit_y; arrange_text: - eo_do(ep->object, - if (inlined_font) efl_text_properties_font_source_set(ed->path); - else efl_text_properties_font_source_set(NULL); + eo_do(ep->object, + if (inlined_font) efl_text_properties_font_source_set(ed->path); + else efl_text_properties_font_source_set(NULL); - if (ep->part->scale) evas_obj_scale_set(TO_DOUBLE(sc)); + if (ep->part->scale) evas_obj_scale_set(TO_DOUBLE(sc)); - efl_text_properties_font_set(font, size), - efl_text_set(text)); - part_get_geometry(ep, &tw, &th); + efl_text_properties_font_set(font, size), + efl_text_set(text)); + part_get_geometry(ep, &tw, &th); - /* filters */ - eo_do(ep->object, - EINA_LIST_FOREACH(prev_sources, li, source_name) - evas_obj_text_filter_source_set(source_name, NULL); + /* filters */ + eo_do(ep->object, + EINA_LIST_FOREACH(prev_sources, li, source_name) + evas_obj_text_filter_source_set(source_name, NULL); - EINA_LIST_FOREACH(filter_sources, li, source_name) - { - Edje_Real_Part *rp = _edje_real_part_get(ed, source_name); - evas_obj_text_filter_source_set(source_name, rp ? rp->object : NULL); - }; - evas_obj_text_filter_program_set(filter)); + EINA_LIST_FOREACH(filter_sources, li, source_name) + { + Edje_Real_Part *rp = _edje_real_part_get(ed, source_name); + evas_obj_text_filter_source_set(source_name, rp ? rp->object : NULL); + } + evas_obj_text_filter_program_set(filter)); - /* Handle alignment */ - { - FLOAT_T align_x; - if (params->type.text.align.x < FROM_INT(0)) - { - if (evas_object_text_direction_get(ep->object) == - EVAS_BIDI_DIRECTION_RTL) + /* Handle alignment */ { - align_x = FROM_INT(1); + FLOAT_T align_x; + if (params->type.text.align.x < FROM_INT(0)) + { + if (evas_object_text_direction_get(ep->object) == + EVAS_BIDI_DIRECTION_RTL) + { + align_x = FROM_INT(1); + } + else + { + align_x = FROM_INT(0); + } + } + else + { + align_x = params->type.text.align.x; + } + ep->typedata.text->offset.x = TO_INT(SCALE(align_x, (sw - tw))); + ep->typedata.text->offset.y = TO_INT(SCALE(params->type.text.align.y, (sh - th))); } - else + + if (!calc_only) { - align_x = FROM_INT(0); + eo_do(ep->object, + efl_gfx_position_set(ed->x + TO_INT(params->eval.x) + ep->typedata.text->offset.x, + ed->y + TO_INT(params->eval.y) + ep->typedata.text->offset.y); + + efl_gfx_visible_set(params->visible)); } - } - else - { - align_x = params->type.text.align.x; - } - ep->typedata.text->offset.x = TO_INT(SCALE(align_x, (sw - tw))); - ep->typedata.text->offset.y = TO_INT(SCALE(params->type.text.align.y, (sh - th))); - } - if (!calc_only) - { - eo_do(ep->object, - efl_gfx_position_set(ed->x + TO_INT(params->eval.x) + ep->typedata.text->offset.x, - ed->y + TO_INT(params->eval.y) + ep->typedata.text->offset.y); + { + Evas_Text_Style_Type style; + Edje_Text_Effect effect; - efl_gfx_visible_set(params->visible)); - } + style = EVAS_TEXT_STYLE_PLAIN; + evas_object_color_set(ep->object, + (params->color.r * params->color.a) / 255, + (params->color.g * params->color.a) / 255, + (params->color.b * params->color.a) / 255, + params->color.a); + effect = ep->part->effect; + switch (effect & EDJE_TEXT_EFFECT_MASK_BASIC) + { + case EDJE_TEXT_EFFECT_NONE: + case EDJE_TEXT_EFFECT_PLAIN: + style = EVAS_TEXT_STYLE_PLAIN; + break; - { - Evas_Text_Style_Type style; - Edje_Text_Effect effect; + case EDJE_TEXT_EFFECT_OUTLINE: + style = EVAS_TEXT_STYLE_OUTLINE; + evas_object_text_outline_color_set(ep->object, + (params->type.text.color2.r * params->type.text.color2.a) / 255, + (params->type.text.color2.g * params->type.text.color2.a) / 255, + (params->type.text.color2.b * params->type.text.color2.a) / 255, + params->type.text.color2.a); + break; - style = EVAS_TEXT_STYLE_PLAIN; + case EDJE_TEXT_EFFECT_SOFT_OUTLINE: + style = EVAS_TEXT_STYLE_SOFT_OUTLINE; + evas_object_text_outline_color_set(ep->object, + (params->type.text.color2.r * params->type.text.color2.a) / 255, + (params->type.text.color2.g * params->type.text.color2.a) / 255, + (params->type.text.color2.b * params->type.text.color2.a) / 255, + params->type.text.color2.a); + break; - evas_object_color_set(ep->object, - (params->color.r * params->color.a) / 255, - (params->color.g * params->color.a) / 255, - (params->color.b * params->color.a) / 255, - params->color.a); - effect = ep->part->effect; - switch (effect & EDJE_TEXT_EFFECT_MASK_BASIC) - { - case EDJE_TEXT_EFFECT_NONE: - case EDJE_TEXT_EFFECT_PLAIN: - style = EVAS_TEXT_STYLE_PLAIN; - break; - case EDJE_TEXT_EFFECT_OUTLINE: - style = EVAS_TEXT_STYLE_OUTLINE; - evas_object_text_outline_color_set(ep->object, - (params->type.text.color2.r * params->type.text.color2.a) / 255, - (params->type.text.color2.g * params->type.text.color2.a) / 255, - (params->type.text.color2.b * params->type.text.color2.a) / 255, - params->type.text.color2.a); - break; - case EDJE_TEXT_EFFECT_SOFT_OUTLINE: - style = EVAS_TEXT_STYLE_SOFT_OUTLINE; - evas_object_text_outline_color_set(ep->object, - (params->type.text.color2.r * params->type.text.color2.a) / 255, - (params->type.text.color2.g * params->type.text.color2.a) / 255, - (params->type.text.color2.b * params->type.text.color2.a) / 255, - params->type.text.color2.a); - break; - case EDJE_TEXT_EFFECT_SHADOW: - style = EVAS_TEXT_STYLE_SHADOW; - evas_object_text_shadow_color_set(ep->object, - (params->type.text.color3.r * params->type.text.color3.a) / 255, - (params->type.text.color3.g * params->type.text.color3.a) / 255, - (params->type.text.color3.b * params->type.text.color3.a) / 255, - params->type.text.color3.a); - break; - case EDJE_TEXT_EFFECT_SOFT_SHADOW: - style = EVAS_TEXT_STYLE_SOFT_SHADOW; - evas_object_text_shadow_color_set(ep->object, - (params->type.text.color3.r * params->type.text.color3.a) / 255, - (params->type.text.color3.g * params->type.text.color3.a) / 255, - (params->type.text.color3.b * params->type.text.color3.a) / 255, - params->type.text.color3.a); - break; - case EDJE_TEXT_EFFECT_OUTLINE_SHADOW: - style = EVAS_TEXT_STYLE_OUTLINE_SHADOW; - eo_do(ep->object, - evas_obj_text_outline_color_set((params->type.text.color2.r * params->type.text.color2.a) / 255, - (params->type.text.color2.g * params->type.text.color2.a) / 255, - (params->type.text.color2.b * params->type.text.color2.a) / 255, - params->type.text.color2.a), - evas_obj_text_shadow_color_set((params->type.text.color3.r * params->type.text.color3.a) / 255, - (params->type.text.color3.g * params->type.text.color3.a) / 255, - (params->type.text.color3.b * params->type.text.color3.a) / 255, - params->type.text.color3.a)); - break; - case EDJE_TEXT_EFFECT_OUTLINE_SOFT_SHADOW: - style = EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW; - eo_do(ep->object, - evas_obj_text_outline_color_set((params->type.text.color2.r * params->type.text.color2.a) / 255, - (params->type.text.color2.g * params->type.text.color2.a) / 255, - (params->type.text.color2.b * params->type.text.color2.a) / 255, - params->type.text.color2.a), - evas_obj_text_shadow_color_set((params->type.text.color3.r * params->type.text.color3.a) / 255, - (params->type.text.color3.g * params->type.text.color3.a) / 255, - (params->type.text.color3.b * params->type.text.color3.a) / 255, - params->type.text.color3.a)); - break; - case EDJE_TEXT_EFFECT_FAR_SHADOW: - style = EVAS_TEXT_STYLE_FAR_SHADOW; - evas_object_text_shadow_color_set(ep->object, - (params->type.text.color3.r * params->type.text.color3.a) / 255, - (params->type.text.color3.g * params->type.text.color3.a) / 255, - (params->type.text.color3.b * params->type.text.color3.a) / 255, - params->type.text.color3.a); - break; - case EDJE_TEXT_EFFECT_FAR_SOFT_SHADOW: - style = EVAS_TEXT_STYLE_FAR_SOFT_SHADOW; - evas_object_text_shadow_color_set(ep->object, - (params->type.text.color3.r * params->type.text.color3.a) / 255, - (params->type.text.color3.g * params->type.text.color3.a) / 255, - (params->type.text.color3.b * params->type.text.color3.a) / 255, - params->type.text.color3.a); - break; - case EDJE_TEXT_EFFECT_GLOW: - style = EVAS_TEXT_STYLE_GLOW; - eo_do(ep->object, - evas_obj_text_glow_color_set((params->type.text.color2.r * params->type.text.color2.a) / 255, - (params->type.text.color2.g * params->type.text.color2.a) / 255, - (params->type.text.color2.b * params->type.text.color2.a) / 255, - params->type.text.color2.a), - evas_obj_text_glow2_color_set((params->type.text.color3.r * params->type.text.color3.a) / 255, - (params->type.text.color3.g * params->type.text.color3.a) / 255, - (params->type.text.color3.b * params->type.text.color3.a) / 255, - params->type.text.color3.a)); - break; - default: - style = EVAS_TEXT_STYLE_PLAIN; - break; - } + case EDJE_TEXT_EFFECT_SHADOW: + style = EVAS_TEXT_STYLE_SHADOW; + evas_object_text_shadow_color_set(ep->object, + (params->type.text.color3.r * params->type.text.color3.a) / 255, + (params->type.text.color3.g * params->type.text.color3.a) / 255, + (params->type.text.color3.b * params->type.text.color3.a) / 255, + params->type.text.color3.a); + break; - switch (effect & EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION) - { - case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_RIGHT: - EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET - (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT); - break; - case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM: - EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET - (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM); - break; - case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_LEFT: - EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET - (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT); - break; - case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_LEFT: - EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET - (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT); - break; - case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_LEFT: - EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET - (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT); - break; - case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP: - EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET - (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP); - break; - case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_RIGHT: - EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET - (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT); - break; - case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_RIGHT: - EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET - (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_RIGHT); - break; - default: - break; - } - evas_object_text_style_set(ep->object, style); - } + case EDJE_TEXT_EFFECT_SOFT_SHADOW: + style = EVAS_TEXT_STYLE_SOFT_SHADOW; + evas_object_text_shadow_color_set(ep->object, + (params->type.text.color3.r * params->type.text.color3.a) / 255, + (params->type.text.color3.g * params->type.text.color3.a) / 255, + (params->type.text.color3.b * params->type.text.color3.a) / 255, + params->type.text.color3.a); + break; - if (free_text) free((char *)text); - if (font2) free(font2); - if (sfont) free(sfont); -} + case EDJE_TEXT_EFFECT_OUTLINE_SHADOW: + style = EVAS_TEXT_STYLE_OUTLINE_SHADOW; + eo_do(ep->object, + evas_obj_text_outline_color_set((params->type.text.color2.r * params->type.text.color2.a) / 255, + (params->type.text.color2.g * params->type.text.color2.a) / 255, + (params->type.text.color2.b * params->type.text.color2.a) / 255, + params->type.text.color2.a), + evas_obj_text_shadow_color_set((params->type.text.color3.r * params->type.text.color3.a) / 255, + (params->type.text.color3.g * params->type.text.color3.a) / 255, + (params->type.text.color3.b * params->type.text.color3.a) / 255, + params->type.text.color3.a)); + break; -Evas_Font_Size -_edje_text_size_calc(Evas_Font_Size size, Edje_Text_Class *tc) -{ - int val; + case EDJE_TEXT_EFFECT_OUTLINE_SOFT_SHADOW: + style = EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW; + eo_do(ep->object, + evas_obj_text_outline_color_set((params->type.text.color2.r * params->type.text.color2.a) / 255, + (params->type.text.color2.g * params->type.text.color2.a) / 255, + (params->type.text.color2.b * params->type.text.color2.a) / 255, + params->type.text.color2.a), + evas_obj_text_shadow_color_set((params->type.text.color3.r * params->type.text.color3.a) / 255, + (params->type.text.color3.g * params->type.text.color3.a) / 255, + (params->type.text.color3.b * params->type.text.color3.a) / 255, + params->type.text.color3.a)); + break; - if (tc->size == 0) - { - val = size; - } - else if (tc->size > 0.0) - { - val = tc->size; - } - else - { - val = (size * -tc->size) / 100; - } - return val; -} + case EDJE_TEXT_EFFECT_FAR_SHADOW: + style = EVAS_TEXT_STYLE_FAR_SHADOW; + evas_object_text_shadow_color_set(ep->object, + (params->type.text.color3.r * params->type.text.color3.a) / 255, + (params->type.text.color3.g * params->type.text.color3.a) / 255, + (params->type.text.color3.b * params->type.text.color3.a) / 255, + params->type.text.color3.a); + break; + + case EDJE_TEXT_EFFECT_FAR_SOFT_SHADOW: + style = EVAS_TEXT_STYLE_FAR_SOFT_SHADOW; + evas_object_text_shadow_color_set(ep->object, + (params->type.text.color3.r * params->type.text.color3.a) / 255, + (params->type.text.color3.g * params->type.text.color3.a) / 255, + (params->type.text.color3.b * params->type.text.color3.a) / 255, + params->type.text.color3.a); + break; + + case EDJE_TEXT_EFFECT_GLOW: + style = EVAS_TEXT_STYLE_GLOW; + eo_do(ep->object, + evas_obj_text_glow_color_set((params->type.text.color2.r * params->type.text.color2.a) / 255, + (params->type.text.color2.g * params->type.text.color2.a) / 255, + (params->type.text.color2.b * params->type.text.color2.a) / 255, + params->type.text.color2.a), + evas_obj_text_glow2_color_set((params->type.text.color3.r * params->type.text.color3.a) / 255, + (params->type.text.color3.g * params->type.text.color3.a) / 255, + (params->type.text.color3.b * params->type.text.color3.a) / 255, + params->type.text.color3.a)); + break; + + default: + style = EVAS_TEXT_STYLE_PLAIN; + break; + } + + switch (effect & EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION) + { + case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_RIGHT: + EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET + (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT); + break; + + case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM: + EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET + (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM); + break; + + case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_LEFT: + EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET + (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT); + break; + + case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_LEFT: + EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET + (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT); + break; + + case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_LEFT: + EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET + (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT); + break; + + case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP: + EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET + (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP); + break; + + case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_RIGHT: + EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET + (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT); + break; + + case EDJE_TEXT_EFFECT_SHADOW_DIRECTION_RIGHT: + EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET + (style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_RIGHT); + break; + + default: + break; + } + evas_object_text_style_set(ep->object, style); + } + + if (free_text) free((char *)text); + if (font2) free(font2); + if (sfont) free(sfont); + } + + Evas_Font_Size + _edje_text_size_calc(Evas_Font_Size size, Edje_Text_Class * tc) + { + int val; + + if (tc->size == 0) + { + val = size; + } + else if (tc->size > 0.0) + { + val = tc->size; + } + else + { + val = (size * -tc->size) / 100; + } + return val; + } diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index c496ce2ba4..0cf8a05315 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -34,7 +34,7 @@ _edje_format_parse(const char **s) p = *s; if ((!p) || (*p == 0)) return NULL; - for (;;) + for (;; ) { if (!s1) { @@ -87,44 +87,44 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag **tag_ret) s = str; while ((item = _edje_format_parse(&s))) { - if (_edje_format_is_param(item)) - { - char *key = NULL, *val = NULL; + if (_edje_format_is_param(item)) + { + char *key = NULL, *val = NULL; - _edje_format_param_parse(item, &key, &val); - if (!strcmp(key, "font_source")) - { - /* dont allow font sources */ - } - else if (!strcmp(key, "text_class")) - { - if (tag_ret) - (*tag_ret)->text_class = eina_stringshare_add(val); - } - else if (!strcmp(key, "font_size")) - { - if (tag_ret) - (*tag_ret)->font_size = atof(val); - } - else if (!strcmp(key, "font")) /* Fix fonts */ - { - if (tag_ret) - { - if (_edje_font_is_embedded(edf, val)) - { - if (!tmp) - tmp = eina_strbuf_new(); - eina_strbuf_append(tmp, "edje/fonts/"); - eina_strbuf_append(tmp, val); - (*tag_ret)->font = eina_stringshare_add(eina_strbuf_string_get(tmp)); - eina_strbuf_reset(tmp); - } - else - { - (*tag_ret)->font = eina_stringshare_add(val); - } - } - } + _edje_format_param_parse(item, &key, &val); + if (!strcmp(key, "font_source")) + { + /* dont allow font sources */ + } + else if (!strcmp(key, "text_class")) + { + if (tag_ret) + (*tag_ret)->text_class = eina_stringshare_add(val); + } + else if (!strcmp(key, "font_size")) + { + if (tag_ret) + (*tag_ret)->font_size = atof(val); + } + else if (!strcmp(key, "font")) /* Fix fonts */ + { + if (tag_ret) + { + if (_edje_font_is_embedded(edf, val)) + { + if (!tmp) + tmp = eina_strbuf_new(); + eina_strbuf_append(tmp, "edje/fonts/"); + eina_strbuf_append(tmp, val); + (*tag_ret)->font = eina_stringshare_add(eina_strbuf_string_get(tmp)); + eina_strbuf_reset(tmp); + } + else + { + (*tag_ret)->font = eina_stringshare_add(val); + } + } + } s2 = eina_str_escape(item); if (s2) { @@ -132,14 +132,14 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag **tag_ret) eina_strbuf_append(txt, s2); free(s2); } - free(key); - free(val); - } - else - { - if (eina_strbuf_length_get(txt)) eina_strbuf_append(txt, " "); - eina_strbuf_append(txt, item); - } + free(key); + free(val); + } + else + { + if (eina_strbuf_length_get(txt)) eina_strbuf_append(txt, " "); + eina_strbuf_append(txt, item); + } free(item); } if (tmp) @@ -173,7 +173,7 @@ _edje_textblock_style_all_update(Edje *ed) if (!stl->style) break; /* No need to compute it again and again and again */ - if (stl->cache) continue; + if (stl->cache) continue; /* Make sure the style contains a text_class */ EINA_LIST_FOREACH(stl->tags, ll, tag) @@ -227,7 +227,7 @@ _edje_textblock_style_all_update(Edje *ed) if (tc && tc->size) snprintf(font_size, sizeof(font_size), "%f", - (double) _edje_text_size_calc(tag->font_size, tc)); + (double)_edje_text_size_calc(tag->font_size, tc)); else snprintf(font_size, sizeof(font_size), "%f", tag->font_size); @@ -291,7 +291,7 @@ _edje_textblock_style_member_add(Edje *ed, Edje_Style *stl) Edje_Style_Tag *tag; Eina_List *l; - if (!stl) return ; + if (!stl) return; EINA_LIST_FOREACH(stl->tags, l, tag) { @@ -434,78 +434,78 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf) EINA_LIST_FOREACH(edf->styles, l, stl) { - Edje_Style_Tag *tag; - char *fontset = NULL, *fontsource = NULL, *ts; + Edje_Style_Tag *tag; + char *fontset = NULL, *fontsource = NULL, *ts; - if (stl->style) break; + if (stl->style) break; - if (!txt) - txt = eina_strbuf_new(); + if (!txt) + txt = eina_strbuf_new(); - stl->style = evas_textblock_style_new(); - evas_textblock_style_set(stl->style, NULL); + stl->style = evas_textblock_style_new(); + evas_textblock_style_set(stl->style, NULL); - if (_edje_fontset_append) - fontset = eina_str_escape(_edje_fontset_append); - fontsource = eina_str_escape(edf->path); + if (_edje_fontset_append) + fontset = eina_str_escape(_edje_fontset_append); + fontsource = eina_str_escape(edf->path); - /* Build the style from each tag */ - EINA_LIST_FOREACH(stl->tags, ll, tag) - { - if (!tag->key) continue; + /* Build the style from each tag */ + EINA_LIST_FOREACH(stl->tags, ll, tag) + { + if (!tag->key) continue; - /* Add Tag Key */ - eina_strbuf_append(txt, tag->key); - eina_strbuf_append(txt, "='"); + /* Add Tag Key */ + eina_strbuf_append(txt, tag->key); + eina_strbuf_append(txt, "='"); - ts = _edje_format_reparse(edf, tag->value, &(tag)); + ts = _edje_format_reparse(edf, tag->value, &(tag)); - /* Add and Handle tag parsed data */ - if (ts) - { - if (eet_dictionary_string_check(eet_dictionary_get(edf->ef), tag->value) == 0) - eina_stringshare_del(tag->value); - tag->value = eina_stringshare_add(ts); - eina_strbuf_append(txt, tag->value); - free(ts); - } + /* Add and Handle tag parsed data */ + if (ts) + { + if (eet_dictionary_string_check(eet_dictionary_get(edf->ef), tag->value) == 0) + eina_stringshare_del(tag->value); + tag->value = eina_stringshare_add(ts); + eina_strbuf_append(txt, tag->value); + free(ts); + } - if (!strcmp(tag->key, "DEFAULT")) - { - if (fontset) - { - eina_strbuf_append(txt, " "); - eina_strbuf_append(txt, "font_fallbacks="); - eina_strbuf_append(txt, fontset); - } - eina_strbuf_append(txt, " "); - eina_strbuf_append(txt, "font_source="); - eina_strbuf_append(txt, fontsource); - } - if (tag->font_size > 0) - { - char font_size[32]; + if (!strcmp(tag->key, "DEFAULT")) + { + if (fontset) + { + eina_strbuf_append(txt, " "); + eina_strbuf_append(txt, "font_fallbacks="); + eina_strbuf_append(txt, fontset); + } + eina_strbuf_append(txt, " "); + eina_strbuf_append(txt, "font_source="); + eina_strbuf_append(txt, fontsource); + } + if (tag->font_size > 0) + { + char font_size[32]; - snprintf(font_size, sizeof(font_size), "%f", tag->font_size); - eina_strbuf_append(txt, " "); - eina_strbuf_append(txt, "font_size="); - eina_strbuf_append(txt, font_size); - } - /* Add font name last to save evas from multiple loads */ - if (tag->font) - { - eina_strbuf_append(txt, " "); - eina_strbuf_append(txt, "font="); - eina_strbuf_append_escaped(txt, tag->font); - } - eina_strbuf_append(txt, "'"); - } - if (fontset) free(fontset); - if (fontsource) free(fontsource); + snprintf(font_size, sizeof(font_size), "%f", tag->font_size); + eina_strbuf_append(txt, " "); + eina_strbuf_append(txt, "font_size="); + eina_strbuf_append(txt, font_size); + } + /* Add font name last to save evas from multiple loads */ + if (tag->font) + { + eina_strbuf_append(txt, " "); + eina_strbuf_append(txt, "font="); + eina_strbuf_append_escaped(txt, tag->font); + } + eina_strbuf_append(txt, "'"); + } + if (fontset) free(fontset); + if (fontsource) free(fontsource); - /* Configure the style */ - evas_textblock_style_set(stl->style, eina_strbuf_string_get(txt)); - eina_strbuf_reset(txt); + /* Configure the style */ + evas_textblock_style_set(stl->style, eina_strbuf_string_get(txt)); + eina_strbuf_reset(txt); } if (txt) eina_strbuf_free(txt); @@ -521,8 +521,8 @@ _edje_textblock_style_cleanup(Edje_File *edf) Edje_Style_Tag *tag; EINA_LIST_FREE(stl->tags, tag) - { - if (tag->value && eet_dictionary_string_check(eet_dictionary_get(edf->ef), tag->value) == 0) + { + if (tag->value && eet_dictionary_string_check(eet_dictionary_get(edf->ef), tag->value) == 0) eina_stringshare_del(tag->value); if (edf->free_strings) { @@ -532,9 +532,10 @@ _edje_textblock_style_cleanup(Edje_File *edf) if (tag->font) eina_stringshare_del(tag->font); } free(tag); - } + } if (edf->free_strings && stl->name) eina_stringshare_del(stl->name); - if (stl->style) evas_textblock_style_free(stl->style); - free(stl); + if (stl->style) evas_textblock_style_free(stl->style); + free(stl); } } + diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index 7c93697b9f..d99084b276 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -5,11 +5,11 @@ struct _Edje_Box_Layout { EINA_RBTREE; Evas_Object_Box_Layout func; - void *(*layout_data_get)(void *); - void (*layout_data_free)(void *); - void *data; - void (*free_data)(void *); - char name[]; + void *(*layout_data_get)(void *); + void (*layout_data_free)(void *); + void *data; + void (*free_data)(void *); + char name[]; }; static Eina_Hash *_edje_color_class_hash = NULL; @@ -47,12 +47,12 @@ struct _Edje_Refcount static Eina_Bool _edje_color_class_list_foreach(const Eina_Hash *hash, const void *key, void *data, void *fdata); static Eina_Bool _edje_text_class_list_foreach(const Eina_Hash *hash, const void *key, void *data, void *fdata); -static void _edje_object_image_preload_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void _edje_object_signal_preload_cb(void *data, Evas_Object *obj, const char *emission, const char *source); -static void _edje_user_def_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *child EINA_UNUSED, void *einfo EINA_UNUSED); -static void _edje_child_remove(Edje *ed, Edje_Real_Part *rp, Evas_Object *child); +static void _edje_object_image_preload_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _edje_object_signal_preload_cb(void *data, Evas_Object *obj, const char *emission, const char *source); +static void _edje_user_def_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *child EINA_UNUSED, void *einfo EINA_UNUSED); +static void _edje_child_remove(Edje *ed, Edje_Real_Part *rp, Evas_Object *child); -Edje_Real_Part *_edje_real_part_recursive_get_helper(Edje **ed, char **path); +Edje_Real_Part *_edje_real_part_recursive_get_helper(Edje **ed, char **path); static Edje_User_Defined * _edje_user_definition_new(Edje_User_Defined_Type type, const char *part, Edje *ed) @@ -91,44 +91,47 @@ _edje_user_definition_free(Edje_User_Defined *eud) switch (eud->type) { case EDJE_USER_SWALLOW: - child = eud->u.swallow.child; - rp = _edje_real_part_recursive_get(&eud->ed, eud->part); - if (rp) - { - _edje_real_part_swallow_clear(eud->ed, rp); - if ((rp->type == EDJE_RP_TYPE_SWALLOW) && - (rp->typedata.swallow)) - { - rp->typedata.swallow->swallowed_object = NULL; - rp->typedata.swallow->swallow_params.min.w = 0; - rp->typedata.swallow->swallow_params.min.h = 0; - rp->typedata.swallow->swallow_params.max.w = 0; - rp->typedata.swallow->swallow_params.max.h = 0; - } - eud->ed->dirty = EINA_TRUE; - eud->ed->recalc_call = EINA_TRUE; + child = eud->u.swallow.child; + rp = _edje_real_part_recursive_get(&eud->ed, eud->part); + if (rp) + { + _edje_real_part_swallow_clear(eud->ed, rp); + if ((rp->type == EDJE_RP_TYPE_SWALLOW) && + (rp->typedata.swallow)) + { + rp->typedata.swallow->swallowed_object = NULL; + rp->typedata.swallow->swallow_params.min.w = 0; + rp->typedata.swallow->swallow_params.min.h = 0; + rp->typedata.swallow->swallow_params.max.w = 0; + rp->typedata.swallow->swallow_params.max.h = 0; + } + eud->ed->dirty = EINA_TRUE; + eud->ed->recalc_call = EINA_TRUE; #ifdef EDJE_CALC_CACHE - rp->invalidate = EINA_TRUE; + rp->invalidate = EINA_TRUE; #endif - _edje_recalc_do(eud->ed); - } - break; + _edje_recalc_do(eud->ed); + } + break; + case EDJE_USER_BOX_PACK: - child = eud->u.box.child; - rp = _edje_real_part_recursive_get(&eud->ed, eud->part); - if (rp) _edje_child_remove(eud->ed, rp, child); - break; + child = eud->u.box.child; + rp = _edje_real_part_recursive_get(&eud->ed, eud->part); + if (rp) _edje_child_remove(eud->ed, rp, child); + break; + case EDJE_USER_TABLE_PACK: - child = eud->u.table.child; - rp = _edje_real_part_recursive_get(&eud->ed, eud->part); - if (rp) _edje_child_remove(eud->ed, rp, child); - break; + child = eud->u.table.child; + rp = _edje_real_part_recursive_get(&eud->ed, eud->part); + if (rp) _edje_child_remove(eud->ed, rp, child); + break; + case EDJE_USER_STRING: case EDJE_USER_DRAG_STEP: case EDJE_USER_DRAG_PAGE: case EDJE_USER_DRAG_VALUE: case EDJE_USER_DRAG_SIZE: - break; + break; } _edje_user_definition_remove(eud, child); @@ -233,7 +236,7 @@ _edje_class_members_clean(Edje *ed, Eina_Hash *ghash) Eina_Iterator *it; Eina_Hash *members; - if (!ed || !ghash) return ; + if (!ed || !ghash) return; it = eina_hash_iterator_data_new(ghash); EINA_ITERATOR_FOREACH(it, members) @@ -252,7 +255,6 @@ _edje_class_members_clean(Edje *ed, Eina_Hash *ghash) eina_iterator_free(it); } - /************************** API Routines **************************/ #define FASTFREEZE 1 @@ -297,6 +299,7 @@ _edje_util_thaw_edje(Edje *ed) } if ((ed->recalc) && (ed->freeze <= 0)) _edje_recalc_do(ed); } + #endif void @@ -311,25 +314,25 @@ _edje_language_signal_emit(Edje *ed, Evas_Object *obj, char *signal) if (rp->part->type == EDJE_PART_TYPE_TEXT || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK) { - Edje_Part_Description_Text *text; + Edje_Part_Description_Text *text; - text = (Edje_Part_Description_Text *) rp->param1.description; - if (text->text.text.translated) - text->text.text.translated = NULL; + text = (Edje_Part_Description_Text *)rp->param1.description; + if (text->text.text.translated) + text->text.text.translated = NULL; - if (rp->param2) - { - text = (Edje_Part_Description_Text *) rp->param2->description; - if (text->text.text.translated) - text->text.text.translated = NULL; - } + if (rp->param2) + { + text = (Edje_Part_Description_Text *)rp->param2->description; + if (text->text.text.translated) + text->text.text.translated = NULL; + } - if (rp->custom) - { - text = (Edje_Part_Description_Text *) rp->custom->description; - if (text->text.text.translated) - text->text.text.translated = NULL; - } + if (rp->custom) + { + text = (Edje_Part_Description_Text *)rp->custom->description; + if (text->text.text.translated) + text->text.text.translated = NULL; + } } } edje_object_signal_emit(obj, signal, "edje"); @@ -354,7 +357,7 @@ _edje_object_language_set(Eo *obj, Edje *ed, const char *locale) _edje_language_signal_emit(ed, obj, signal); } -EOLIAN const char* +EOLIAN const char * _edje_object_language_get(Eo *obj EINA_UNUSED, Edje *ed) { if (!ed->language) @@ -363,7 +366,6 @@ _edje_object_language_get(Eo *obj EINA_UNUSED, Edje *ed) return ed->language; } - EAPI void edje_language_set(const char *locale) { @@ -375,7 +377,7 @@ edje_language_set(const char *locale) int length; lookup = strstr(locale, "."); - length = lookup ? lookup - locale : (int) strlen(locale); + length = lookup ? lookup - locale : (int)strlen(locale); loc = alloca(length + 1); memcpy(loc, locale, length); loc[length] = '\0'; @@ -393,7 +395,6 @@ edje_language_set(const char *locale) continue; _edje_language_signal_emit(ed, obj, signal); - } } @@ -415,7 +416,7 @@ edje_thaw(void) } } #else - Evas_Object *data; + Evas_Object *data; // FIXME: could just have a global freeze instead of per object // comment as above.. why? @@ -455,7 +456,7 @@ edje_scale_set(double scale) EAPI double edje_scale_get(void) { - return TO_DOUBLE(_edje_scale); + return TO_DOUBLE(_edje_scale); } EAPI void @@ -483,7 +484,7 @@ _edje_object_scale_set(Eo *obj EINA_UNUSED, Edje *ed, double scale) if (ed->scale == scale) return EINA_TRUE; ed->scale = FROM_DOUBLE(scale); EINA_LIST_FOREACH(ed->groups, l, ged) - edje_object_scale_set(ged->obj, scale); + edje_object_scale_set(ged->obj, scale); for (i = 0; i < ed->table_parts_size; i++) { Edje_Real_Part *ep; @@ -538,7 +539,7 @@ _edje_object_mirrored_set(Eo *obj, Edje *ed, Eina_Bool rtl) ed->is_rtl = rtl; - for (i = 0 ; i < ed->table_parts_size ; i++) + for (i = 0; i < ed->table_parts_size; i++) { Edje_Real_Part *ep; const char *s; @@ -546,8 +547,8 @@ _edje_object_mirrored_set(Eo *obj, Edje *ed, Eina_Bool rtl) ep = ed->table_parts[i]; s = ep->param1.description->state.name, - v = ep->param1.description->state.value; - _edje_part_description_apply(ed, ep, s, v , NULL, 0.0); + v = ep->param1.description->state.value; + _edje_part_description_apply(ed, ep, s, v, NULL, 0.0); ep->chosen_description = ep->param1.description; } _edje_recalc_do(ed); @@ -557,7 +558,7 @@ _edje_object_mirrored_set(Eo *obj, Edje *ed, Eina_Bool rtl) return; } -EOLIAN const char* +EOLIAN const char * _edje_object_data_get(Eo *obj EINA_UNUSED, Edje *ed, const char *key) { if ((!ed) || (!key)) @@ -631,14 +632,18 @@ edje_color_class_set(const char *color_class, int r, int g, int b, int a, int r2 eina_hash_add(_edje_color_class_hash, color_class, cc); } - if (r < 0) r = 0; - else if (r > 255) r = 255; - if (g < 0) g = 0; - else if (g > 255) g = 255; - if (b < 0) b = 0; - else if (b > 255) b = 255; - if (a < 0) a = 0; - else if (a > 255) a = 255; + if (r < 0) r = 0; + else if (r > 255) + r = 255; + if (g < 0) g = 0; + else if (g > 255) + g = 255; + if (b < 0) b = 0; + else if (b > 255) + b = 255; + if (a < 0) a = 0; + else if (a > 255) + a = 255; if ((cc->r == r) && (cc->g == g) && (cc->b == b) && (cc->a == a) && (cc->r2 == r2) && (cc->g2 == g2) && @@ -688,7 +693,8 @@ edje_color_class_get(const char *color_class, int *r, int *g, int *b, int *a, in if (cc) { -#define X(C) if (C) *C = cc->C +#define X(C) if (C) \ + *C = cc->C #define S(_r, _g, _b, _a) X(_r); X(_g); X(_b); X(_a) S(r, g, b, a); S(r2, g2, b2, a2); @@ -699,7 +705,8 @@ edje_color_class_get(const char *color_class, int *r, int *g, int *b, int *a, in } else { -#define X(C) if (C) *C = 0 +#define X(C) if (C) \ + *C = 0 #define S(_r, _g, _b, _a) X(_r); X(_g); X(_b); X(_a) S(r, g, b, a); S(r2, g2, b2, a2); @@ -758,41 +765,41 @@ edje_color_class_list(void) typedef struct _Edje_Active_Color_Class_Iterator Edje_Active_Color_Class_Iterator; struct _Edje_Active_Color_Class_Iterator { - Eina_Iterator iterator; + Eina_Iterator iterator; Edje_Color_Class cc; - Eina_Iterator *classes; + Eina_Iterator *classes; }; static Eina_Bool _edje_color_class_active_iterator_next(Eina_Iterator *it, void **data) { - Edje_Active_Color_Class_Iterator *et = (void*) it; + Edje_Active_Color_Class_Iterator *et = (void *)it; Eina_Hash_Tuple *tuple = NULL; Edje_Refcount *er = NULL; Eina_Iterator *ith; Edje_Color_Class *cc; - if (!eina_iterator_next(et->classes, (void**) &tuple)) return EINA_FALSE; + if (!eina_iterator_next(et->classes, (void **)&tuple)) return EINA_FALSE; if (!tuple) return EINA_FALSE; ith = eina_hash_iterator_data_new(tuple->data); - if (!eina_iterator_next(ith, (void**) &er)) return EINA_FALSE; + if (!eina_iterator_next(ith, (void **)&er)) return EINA_FALSE; /* - We actually need to ask on an object to get the correct value. - It is being assumed that the color key are the same for all object here. - This can some times not be the case, but for now we should be fine. + We actually need to ask on an object to get the correct value. + It is being assumed that the color key are the same for all object here. + This can some times not be the case, but for now we should be fine. */ cc = _edje_color_class_find(er->ed, tuple->key); if (!cc) return EINA_FALSE; et->cc = *cc; /* - Any of the Edje object referenced should have a file with a valid - description for this color class. Let's bet on that for now. - */ + Any of the Edje object referenced should have a file with a valid + description for this color class. Let's bet on that for now. + */ cc = eina_hash_find(er->ed->file->color_hash, tuple->key); if (!cc) return EINA_FALSE; et->cc.desc = cc->desc; @@ -810,7 +817,7 @@ _edje_color_class_active_iterator_container(Eina_Iterator *it EINA_UNUSED) static void _edje_color_class_active_iterator_free(Eina_Iterator *it) { - Edje_Active_Color_Class_Iterator *et = (void*) it; + Edje_Active_Color_Class_Iterator *et = (void *)it; eina_iterator_free(et->classes); EINA_MAGIC_SET(&et->iterator, 0); @@ -854,14 +861,18 @@ _edje_object_color_class_set(Eo *obj EINA_UNUSED, Edje *ed, const char *color_cl unsigned int i; if ((!ed) || (!color_class)) return EINA_FALSE; - if (r < 0) r = 0; - else if (r > 255) r = 255; - if (g < 0) g = 0; - else if (g > 255) g = 255; - if (b < 0) b = 0; - else if (b > 255) b = 255; - if (a < 0) a = 0; - else if (a > 255) a = 255; + if (r < 0) r = 0; + else if (r > 255) + r = 255; + if (g < 0) g = 0; + else if (g > 255) + g = 255; + if (b < 0) b = 0; + else if (b > 255) + b = 255; + if (a < 0) a = 0; + else if (a > 255) + a = 255; cc = eina_hash_find(ed->color_classes, color_class); if (cc) { @@ -935,7 +946,8 @@ _edje_object_color_class_get(Eo *obj EINA_UNUSED, Edje *ed, const char *color_cl if (cc) { -#define X(C) if (C) *C = cc->C +#define X(C) if (C) \ + *C = cc->C #define S(_r, _g, _b, _a) X(_r); X(_g); X(_b); X(_a) S(r, g, b, a); S(r2, g2, b2, a2); @@ -946,7 +958,8 @@ _edje_object_color_class_get(Eo *obj EINA_UNUSED, Edje *ed, const char *color_cl } else { -#define X(C) if (C) *C = 0 +#define X(C) if (C) \ + *C = 0 #define S(_r, _g, _b, _a) X(_r); X(_g); X(_b); X(_a) S(r, g, b, a); S(r2, g2, b2, a2); @@ -1005,17 +1018,17 @@ struct _Edje_File_Color_Class_Iterator { Edje_Active_Color_Class_Iterator it; - Edje_File *edf; + Edje_File *edf; }; static Eina_Bool _edje_mmap_color_class_iterator_next(Eina_Iterator *it, void **data) { - Edje_File_Color_Class_Iterator *et = (void*) it; + Edje_File_Color_Class_Iterator *et = (void *)it; Eina_Hash_Tuple *tuple = NULL; Edje_Color_Class *cc = NULL; - if (!eina_iterator_next(et->it.classes, (void**) &tuple)) return EINA_FALSE; + if (!eina_iterator_next(et->it.classes, (void **)&tuple)) return EINA_FALSE; if (!tuple) return EINA_FALSE; cc = tuple->data; @@ -1029,7 +1042,7 @@ _edje_mmap_color_class_iterator_next(Eina_Iterator *it, void **data) static void * _edje_mmap_color_class_iterator_container(Eina_Iterator *it) { - Edje_File_Color_Class_Iterator *et = (void*) it; + Edje_File_Color_Class_Iterator *et = (void *)it; return et->edf->f; } @@ -1037,7 +1050,7 @@ _edje_mmap_color_class_iterator_container(Eina_Iterator *it) static void _edje_mmap_color_class_iterator_free(Eina_Iterator *it) { - Edje_File_Color_Class_Iterator *et = (void*) it; + Edje_File_Color_Class_Iterator *et = (void *)it; eina_iterator_free(et->it.classes); _edje_cache_file_unref(et->edf); @@ -1069,7 +1082,7 @@ edje_mmap_color_class_iterator_new(Eina_File *f) return &it->it.iterator; - on_error: +on_error: _edje_cache_file_unref(edf); return NULL; } @@ -1315,7 +1328,7 @@ _edje_object_part_exists(Eo *obj EINA_UNUSED, Edje *ed, const char *part) return EINA_TRUE; } -EOLIAN const Evas_Object* +EOLIAN const Evas_Object * _edje_object_part_object_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part) { Edje_Real_Part *rp; @@ -1400,10 +1413,10 @@ _edje_object_part_text_raw_set(Edje *ed, Evas_Object *obj, Edje_Real_Part *rp, c if ((rp->type != EDJE_RP_TYPE_TEXT) || (!rp->typedata.text)) return EINA_TRUE; if ((!rp->typedata.text->text) && (!text)) - return EINA_TRUE; /* nothing to do, no error */ + return EINA_TRUE; /* nothing to do, no error */ if ((rp->typedata.text->text) && (text) && (!strcmp(rp->typedata.text->text, text))) - return EINA_TRUE; /* nothing to do, no error */ + return EINA_TRUE; /* nothing to do, no error */ if (rp->typedata.text->text) { eina_stringshare_del(rp->typedata.text->text); @@ -1412,7 +1425,8 @@ _edje_object_part_text_raw_set(Edje *ed, Evas_Object *obj, Edje_Real_Part *rp, c if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) _edje_entry_text_markup_set(rp, text); else - if (text) rp->typedata.text->text = eina_stringshare_add(text); + if (text) + rp->typedata.text->text = eina_stringshare_add(text); ed->dirty = EINA_TRUE; ed->recalc_call = EINA_TRUE; ed->recalc_hints = EINA_TRUE; @@ -1502,7 +1516,7 @@ _edje_object_part_text_style_user_pop(Eo *obj EINA_UNUSED, Edje *ed, const char _edje_recalc(ed); } -EOLIAN const char* +EOLIAN const char * _edje_object_part_text_style_user_peek(Eo *obj EINA_UNUSED, Edje *ed, const char *part) { Edje_Real_Part *rp; @@ -1515,7 +1529,7 @@ _edje_object_part_text_style_user_peek(Eo *obj EINA_UNUSED, Edje *ed, const char ts = evas_object_textblock_style_user_peek(rp->object); if (ts) - return evas_textblock_style_get(ts); + return evas_textblock_style_get(ts); return NULL; } @@ -1524,8 +1538,8 @@ static void _edje_user_define_string(Edje *ed, const char *part, const char *raw_text) { /* NOTE: This one is tricky, text is referenced in rp->typedata.text->text for the life of the - rp. So on edje_object_file_set, we should first ref it, before destroying the old - layout. */ + rp. So on edje_object_file_set, we should first ref it, before destroying the old + layout. */ Edje_User_Defined *eud; Eina_List *l; @@ -1567,7 +1581,7 @@ _edje_object_part_text_set(Eo *obj, Edje *ed, const char *part, const char *text return int_ret; } -EOLIAN const char* +EOLIAN const char * _edje_object_part_text_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part) { Edje_Real_Part *rp; @@ -1623,7 +1637,7 @@ _edje_object_part_text_escaped_set(Eo *obj, Edje *ed, const char *part, const ch sbuf = eina_strbuf_new(); p = (char *)text; s = p; - for (;;) + for (;; ) { if ((*p == 0) || (esc_end) || (esc_start)) { @@ -1632,13 +1646,13 @@ _edje_object_part_text_escaped_set(Eo *obj, Edje *ed, const char *part, const ch const char *escape; escape = evas_textblock_escape_string_range_get - (esc_start, esc_end + 1); + (esc_start, esc_end + 1); if (escape) eina_strbuf_append(sbuf, escape); esc_start = esc_end = NULL; } else if (*p == 0) { - if (!s) s = esc_start; /* This would happen when there is & that isn't escaped */ + if (!s) s = esc_start; /* This would happen when there is & that isn't escaped */ eina_strbuf_append_length(sbuf, s, p - s); s = NULL; } @@ -1648,7 +1662,7 @@ _edje_object_part_text_escaped_set(Eo *obj, Edje *ed, const char *part, const ch if (*p == '&') { - if (!s) s = esc_start; /* This would happen when there is & that isn't escaped */ + if (!s) s = esc_start; /* This would happen when there is & that isn't escaped */ esc_start = p; esc_end = NULL; eina_strbuf_append_length(sbuf, s, p - s); @@ -1808,7 +1822,7 @@ _edje_object_part_text_unescaped_set(Eo *obj, Edje *ed, const char *part, const return int_ret; } -EOLIAN char* +EOLIAN char * _edje_object_part_text_unescaped_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part) { Edje_Real_Part *rp; @@ -1843,7 +1857,7 @@ _edje_object_part_text_unescaped_get(Eo *obj EINA_UNUSED, Edje *ed, const char * return NULL; } -EOLIAN const char* +EOLIAN const char * _edje_object_part_text_selection_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part) { Edje_Real_Part *rp; @@ -1852,7 +1866,7 @@ _edje_object_part_text_selection_get(Eo *obj EINA_UNUSED, Edje *ed, const char * rp = _edje_real_part_recursive_get(&ed, part); if (!rp) return NULL; if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) - return _edje_entry_selection_get(rp); + return _edje_entry_selection_get(rp); return NULL; } @@ -1924,7 +1938,7 @@ _edje_object_part_text_append(Eo *obj, Edje *ed, const char *part, const char *t ed->text_change.func(ed->text_change.data, obj, part); } -EOLIAN const Eina_List* +EOLIAN const Eina_List * _edje_object_part_text_anchor_list_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part) { Edje_Real_Part *rp; @@ -1938,7 +1952,7 @@ _edje_object_part_text_anchor_list_get(Eo *obj EINA_UNUSED, Edje *ed, const char return NULL; } -EOLIAN const Eina_List* +EOLIAN const Eina_List * _edje_object_part_text_anchor_geometry_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part, const char *anchor) { Edje_Real_Part *rp; @@ -1952,7 +1966,7 @@ _edje_object_part_text_anchor_geometry_get(Eo *obj EINA_UNUSED, Edje *ed, const return NULL; } -EOLIAN const Eina_List* +EOLIAN const Eina_List * _edje_object_part_text_item_list_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part) { Edje_Real_Part *rp; @@ -2062,7 +2076,7 @@ _edje_object_part_text_select_extend(Eo *obj EINA_UNUSED, Edje *ed, const char * _edje_entry_select_extend(rp); } -EOLIAN void* +EOLIAN void * _edje_object_part_text_imf_context_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part) { Edje_Real_Part *rp; @@ -2259,7 +2273,7 @@ _edje_object_part_text_cursor_is_visible_format_get(Eo *obj EINA_UNUSED, Edje *e return EINA_FALSE; } -EOLIAN char* +EOLIAN char * _edje_object_part_text_cursor_content_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Edje_Cursor cur) { Edje_Real_Part *rp; @@ -2704,7 +2718,7 @@ _edje_object_text_insert_filter_callback_add(Eo *obj EINA_UNUSED, Edje *ed, cons eina_list_append(ed->text_insert_filter_callbacks, cb); } -EOLIAN void* +EOLIAN void * _edje_object_text_insert_filter_callback_del(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Edje_Text_Filter_Cb func) { Edje_Text_Insert_Filter_Callback *cb; @@ -2717,7 +2731,7 @@ _edje_object_text_insert_filter_callback_del(Eo *obj EINA_UNUSED, Edje *ed, cons { void *data = cb->data; ed->text_insert_filter_callbacks = - eina_list_remove_list(ed->text_insert_filter_callbacks, l); + eina_list_remove_list(ed->text_insert_filter_callbacks, l); eina_stringshare_del(cb->part); free(cb); return data; @@ -2727,7 +2741,7 @@ _edje_object_text_insert_filter_callback_del(Eo *obj EINA_UNUSED, Edje *ed, cons return NULL; } -EOLIAN void* +EOLIAN void * _edje_object_text_insert_filter_callback_del_full(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Edje_Text_Filter_Cb func, void *data) { Edje_Text_Insert_Filter_Callback *cb; @@ -2741,7 +2755,7 @@ _edje_object_text_insert_filter_callback_del_full(Eo *obj EINA_UNUSED, Edje *ed, { void *tmp = cb->data; ed->text_insert_filter_callbacks = - eina_list_remove_list(ed->text_insert_filter_callbacks, l); + eina_list_remove_list(ed->text_insert_filter_callbacks, l); eina_stringshare_del(cb->part); free(cb); return tmp; @@ -2765,7 +2779,7 @@ _edje_object_text_markup_filter_callback_add(Eo *obj EINA_UNUSED, Edje *ed, cons eina_list_append(ed->markup_filter_callbacks, cb); } -EOLIAN void* +EOLIAN void * _edje_object_text_markup_filter_callback_del(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Edje_Markup_Filter_Cb func) { Edje_Markup_Filter_Callback *cb; @@ -2778,7 +2792,7 @@ _edje_object_text_markup_filter_callback_del(Eo *obj EINA_UNUSED, Edje *ed, cons { void *data = cb->data; ed->markup_filter_callbacks = - eina_list_remove_list(ed->markup_filter_callbacks, l); + eina_list_remove_list(ed->markup_filter_callbacks, l); eina_stringshare_del(cb->part); free(cb); return data; @@ -2788,7 +2802,7 @@ _edje_object_text_markup_filter_callback_del(Eo *obj EINA_UNUSED, Edje *ed, cons return NULL; } -EOLIAN void* +EOLIAN void * _edje_object_text_markup_filter_callback_del_full(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Edje_Markup_Filter_Cb func, void *data) { Edje_Markup_Filter_Callback *cb; @@ -2802,7 +2816,7 @@ _edje_object_text_markup_filter_callback_del_full(Eo *obj EINA_UNUSED, Edje *ed, { void *tmp = cb->data; ed->markup_filter_callbacks = - eina_list_remove_list(ed->markup_filter_callbacks, l); + eina_list_remove_list(ed->markup_filter_callbacks, l); eina_stringshare_del(cb->part); free(cb); return tmp; @@ -2896,10 +2910,15 @@ edje_extern_object_aspect_set(Evas_Object *obj, Edje_Aspect_Control aspect, Evas switch (aspect) { case EDJE_ASPECT_CONTROL_NONE: asp = EVAS_ASPECT_CONTROL_NONE; break; + case EDJE_ASPECT_CONTROL_NEITHER: asp = EVAS_ASPECT_CONTROL_NEITHER; break; + case EDJE_ASPECT_CONTROL_HORIZONTAL: asp = EVAS_ASPECT_CONTROL_HORIZONTAL; break; + case EDJE_ASPECT_CONTROL_VERTICAL: asp = EVAS_ASPECT_CONTROL_VERTICAL; break; + case EDJE_ASPECT_CONTROL_BOTH: asp = EVAS_ASPECT_CONTROL_BOTH; break; + default: break; } if (aw < 1) aw = 1; @@ -2907,8 +2926,9 @@ edje_extern_object_aspect_set(Evas_Object *obj, Edje_Aspect_Control aspect, Evas evas_object_size_hint_aspect_set(obj, asp, aw, ah); } -struct edje_box_layout_builtin { - const char *name; +struct edje_box_layout_builtin +{ + const char *name; Evas_Object_Box_Layout cb; }; @@ -2916,32 +2936,35 @@ static Evas_Object_Box_Layout _edje_box_layout_builtin_find(const char *name) { const struct edje_box_layout_builtin _edje_box_layout_builtin[] = { - {"horizontal", evas_object_box_layout_horizontal}, - {"horizontal_flow", evas_object_box_layout_flow_horizontal}, - {"horizontal_homogeneous", evas_object_box_layout_homogeneous_horizontal}, - {"horizontal_max", evas_object_box_layout_homogeneous_max_size_horizontal}, - {"stack", evas_object_box_layout_stack}, - {"vertical", evas_object_box_layout_vertical}, - {"vertical_flow", evas_object_box_layout_flow_vertical}, - {"vertical_homogeneous", evas_object_box_layout_homogeneous_vertical}, - {"vertical_max", evas_object_box_layout_homogeneous_max_size_vertical}, - {NULL, NULL} + {"horizontal", evas_object_box_layout_horizontal}, + {"horizontal_flow", evas_object_box_layout_flow_horizontal}, + {"horizontal_homogeneous", evas_object_box_layout_homogeneous_horizontal}, + {"horizontal_max", evas_object_box_layout_homogeneous_max_size_horizontal}, + {"stack", evas_object_box_layout_stack}, + {"vertical", evas_object_box_layout_vertical}, + {"vertical_flow", evas_object_box_layout_flow_vertical}, + {"vertical_homogeneous", evas_object_box_layout_homogeneous_vertical}, + {"vertical_max", evas_object_box_layout_homogeneous_max_size_vertical}, + {NULL, NULL} }; const struct edje_box_layout_builtin *base; switch (name[0]) { case 'h': - base = _edje_box_layout_builtin + 0; - break; + base = _edje_box_layout_builtin + 0; + break; + case 's': - base = _edje_box_layout_builtin + 4; - break; + base = _edje_box_layout_builtin + 4; + break; + case 'v': - base = _edje_box_layout_builtin + 5; - break; + base = _edje_box_layout_builtin + 5; + break; + default: - return NULL; + return NULL; } for (; (base->name) && (base->name[0] == name[0]); base++) @@ -2974,12 +2997,12 @@ static Edje_Box_Layout * _edje_box_layout_external_find(const char *name) { return (Edje_Box_Layout *)eina_rbtree_inline_lookup - (_edje_box_layout_registry, name, 0, _edje_box_layout_external_find_cmp, - NULL); + (_edje_box_layout_registry, name, 0, _edje_box_layout_external_find_cmp, + NULL); } Eina_Bool -_edje_box_layout_find(const char *name, Evas_Object_Box_Layout *cb, void **data, void (**free_data)(void *data)) +_edje_box_layout_find(const char *name, Evas_Object_Box_Layout *cb, void **data, void(**free_data) (void *data)) { const Edje_Box_Layout *l; @@ -3063,12 +3086,12 @@ edje_box_layout_register(const char *name, Evas_Object_Box_Layout func, void *(* } l = _edje_box_layout_external_new - (name, func, layout_data_get, layout_data_free, free_data, data); + (name, func, layout_data_get, layout_data_free, free_data, data); if (!l) return; _edje_box_layout_registry = eina_rbtree_inline_insert - (_edje_box_layout_registry, (Eina_Rbtree *)l, + (_edje_box_layout_registry, (Eina_Rbtree *)l, _edje_box_layout_external_node_cmp, NULL); } else @@ -3088,7 +3111,7 @@ edje_box_layout_register(const char *name, Evas_Object_Box_Layout func, void *(* if (data && free_data) free_data(data); _edje_box_layout_registry = eina_rbtree_inline_remove - (_edje_box_layout_registry, (Eina_Rbtree *)l, + (_edje_box_layout_registry, (Eina_Rbtree *)l, _edje_box_layout_external_node_cmp, NULL); _edje_box_layout_external_free((Eina_Rbtree *)l, NULL); } @@ -3157,7 +3180,7 @@ _edje_object_part_unswallow(Eo *obj EINA_UNUSED, Edje *ed, Evas_Object *obj_swal } } -EOLIAN Evas_Object* +EOLIAN Evas_Object * _edje_object_part_swallow_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part) { Edje_Real_Part *rp; @@ -3394,8 +3417,8 @@ again: if (!ep->chosen_description->fixed.h) { if ((ep->part->type != EDJE_PART_TYPE_TEXTBLOCK) || - ((Edje_Part_Description_Text *)ep->chosen_description)->text.min_x || - !skip_h) + ((Edje_Part_Description_Text *)ep->chosen_description)->text.min_x || + !skip_h) { if (over_h > max_over_h) { @@ -3466,7 +3489,7 @@ again: } /* FIXME: Correctly return other states */ -EOLIAN const char* +EOLIAN const char * _edje_object_part_state_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part, double *val_ret) { const char *ret; @@ -3531,8 +3554,10 @@ _edje_object_part_drag_dir_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part) rp = _edje_real_part_recursive_get(&ed, part); if (!rp) return ret; if ((rp->part->dragable.x) && (rp->part->dragable.y)) ret = EDJE_DRAG_DIR_XY; - else if (rp->part->dragable.x) ret = EDJE_DRAG_DIR_X; - else if (rp->part->dragable.y) ret = EDJE_DRAG_DIR_Y; + else if (rp->part->dragable.x) + ret = EDJE_DRAG_DIR_X; + else if (rp->part->dragable.y) + ret = EDJE_DRAG_DIR_Y; return ret; } @@ -3649,13 +3674,15 @@ _edje_object_part_drag_size_set(Eo *obj EINA_UNUSED, Edje *ed, const char *part, { eud->u.drag_size.w = dw; eud->u.drag_size.h = dh; - } + } } if (dw < 0.0) dw = 0.0; - else if (dw > 1.0) dw = 1.0; + else if (dw > 1.0) + dw = 1.0; if (dh < 0.0) dh = 0.0; - else if (dh > 1.0) dh = 1.0; + else if (dh > 1.0) + dh = 1.0; if ((rp->drag->size.x == FROM_DOUBLE(dw)) && (rp->drag->size.y == FROM_DOUBLE(dh))) { return EINA_TRUE; @@ -3726,13 +3753,15 @@ _edje_object_part_drag_step_set(Eo *obj EINA_UNUSED, Edje *ed, const char *part, { eud->u.drag_position.x = dx; eud->u.drag_position.y = dy; - } + } } if (dx < 0.0) dx = 0.0; - else if (dx > 1.0) dx = 1.0; + else if (dx > 1.0) + dx = 1.0; if (dy < 0.0) dy = 0.0; - else if (dy > 1.0) dy = 1.0; + else if (dy > 1.0) + dy = 1.0; rp->drag->step.x = FROM_DOUBLE(dx); rp->drag->step.y = FROM_DOUBLE(dy); #ifdef EDJE_CALC_CACHE @@ -3796,13 +3825,15 @@ _edje_object_part_drag_page_set(Eo *obj EINA_UNUSED, Edje *ed, const char *part, { eud->u.drag_position.x = dx; eud->u.drag_position.y = dy; - } + } } if (dx < 0.0) dx = 0.0; - else if (dx > 1.0) dx = 1.0; + else if (dx > 1.0) + dx = 1.0; if (dy < 0.0) dy = 0.0; - else if (dy > 1.0) dy = 1.0; + else if (dy > 1.0) + dy = 1.0; rp->drag->page.x = FROM_DOUBLE(dx); rp->drag->page.y = FROM_DOUBLE(dy); #ifdef EDJE_CALC_CACHE @@ -3877,8 +3908,8 @@ _edje_object_part_drag_step(Eo *obj EINA_UNUSED, Edje *ed, const char *part, dou MUL(rp->drag->step.x, rp->part->dragable.x))); rp->drag->val.y = ADD(py, MUL(FROM_DOUBLE(dy), MUL(rp->drag->step.y, rp->part->dragable.y))); - rp->drag->val.x = CLAMP (rp->drag->val.x, ZERO, FROM_DOUBLE(1.0)); - rp->drag->val.y = CLAMP (rp->drag->val.y, ZERO, FROM_DOUBLE(1.0)); + rp->drag->val.x = CLAMP(rp->drag->val.x, ZERO, FROM_DOUBLE(1.0)); + rp->drag->val.y = CLAMP(rp->drag->val.y, ZERO, FROM_DOUBLE(1.0)); if ((px == rp->drag->val.x) && (py == rp->drag->val.y)) { return EINA_TRUE; @@ -3927,8 +3958,8 @@ _edje_object_part_drag_page(Eo *obj EINA_UNUSED, Edje *ed, const char *part, dou py = rp->drag->val.y; rp->drag->val.x = ADD(px, MUL(FROM_DOUBLE(dx), MUL(rp->drag->page.x, rp->part->dragable.x))); rp->drag->val.y = ADD(py, MUL(FROM_DOUBLE(dy), MUL(rp->drag->page.y, rp->part->dragable.y))); - rp->drag->val.x = CLAMP (rp->drag->val.x, ZERO, FROM_DOUBLE(1.0)); - rp->drag->val.y = CLAMP (rp->drag->val.y, ZERO, FROM_DOUBLE(1.0)); + rp->drag->val.x = CLAMP(rp->drag->val.x, ZERO, FROM_DOUBLE(1.0)); + rp->drag->val.y = CLAMP(rp->drag->val.y, ZERO, FROM_DOUBLE(1.0)); if ((px == rp->drag->val.x) && (py == rp->drag->val.y)) { return EINA_TRUE; @@ -3945,7 +3976,6 @@ _edje_object_part_drag_page(Eo *obj EINA_UNUSED, Edje *ed, const char *part, dou void _edje_box_init(void) { - } void @@ -4072,7 +4102,7 @@ _edje_object_part_box_insert_at(Eo *obj EINA_UNUSED, Edje *ed, const char *part, return ret; } -EOLIAN Evas_Object* +EOLIAN Evas_Object * _edje_object_part_box_remove(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Evas_Object *child) { Edje_Real_Part *rp; @@ -4101,7 +4131,7 @@ _edje_object_part_box_remove(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Ev return r; } -EOLIAN Evas_Object* +EOLIAN Evas_Object * _edje_object_part_box_remove_at(Eo *obj EINA_UNUSED, Edje *ed, const char *part, unsigned int pos) { Edje_Real_Part *rp; @@ -4160,7 +4190,7 @@ _edje_object_part_box_remove_all(Eo *obj EINA_UNUSED, Edje *ed, const char *part return ret; } -EOLIAN Eina_List* +EOLIAN Eina_List * _edje_object_access_part_list_get(Eo *obj EINA_UNUSED, Edje *ed) { Eina_List *access_parts = NULL; @@ -4379,7 +4409,7 @@ _edje_real_part_box_remove_all(Edje *ed, Edje_Real_Part *rp, Eina_Bool clear) return EINA_TRUE; } -EOLIAN Evas_Object* +EOLIAN Evas_Object * _edje_object_part_table_child_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part, unsigned int col, unsigned int row) { Edje_Real_Part *rp; @@ -4647,14 +4677,14 @@ _edje_object_perspective_set(Eo *obj, Edje *ed, Edje_Perspective *ps) _edje_recalc_do(ed); } -EOLIAN const Edje_Perspective* +EOLIAN const Edje_Perspective * _edje_object_perspective_get(Eo *obj EINA_UNUSED, Edje *ed) { return ed->persp; } #define EDJE_PRELOAD_EMISSION "preload,done" -#define EDJE_PRELOAD_SOURCE NULL +#define EDJE_PRELOAD_SOURCE NULL EOLIAN Eina_Bool _edje_object_preload(Eo *obj, Edje *ed, Eina_Bool cancel) @@ -4802,7 +4832,7 @@ _edje_real_part_table_clear(Edje *ed, Edje_Real_Part *rp, Eina_Bool clear) _edje_child_remove(ed, rp, child_obj); if (!evas_object_data_get(child_obj, "\377 edje.table_item")) { - evas_object_table_unpack(rp->object, child_obj); + evas_object_table_unpack(rp->object, child_obj); if (clear) evas_object_del(child_obj); } @@ -4886,15 +4916,18 @@ _edje_children_get(Edje_Real_Part *rp, const char *partid) if ((rp->type != EDJE_RP_TYPE_SWALLOW) || (!rp->typedata.swallow)) return NULL; return _edje_external_content_get - (rp->typedata.swallow->swallowed_object, partid); + (rp->typedata.swallow->swallowed_object, partid); + case EDJE_PART_TYPE_BOX: - it = evas_object_box_iterator_new(rp->object); - break; + it = evas_object_box_iterator_new(rp->object); + break; + case EDJE_PART_TYPE_TABLE: - it = evas_object_table_iterator_new(rp->object); - break; + it = evas_object_table_iterator_new(rp->object); + break; + default: - return NULL; + return NULL; } v = strtol(partid, &p, 10); @@ -4929,7 +4962,7 @@ _edje_children_get(Edje_Real_Part *rp, const char *partid) /* rebuild alternative path */ char * -_edje_merge_path(const char *alias, char * const *path) +_edje_merge_path(const char *alias, char *const *path) { char *tmp; unsigned int length = 1; @@ -4956,7 +4989,6 @@ _edje_merge_path(const char *alias, char * const *path) return tmp; } - Edje_Real_Part * _edje_real_part_recursive_get_helper(Edje **ed, char **path) { @@ -4972,11 +5004,12 @@ _edje_real_part_recursive_get_helper(Edje **ed, char **path) char *alias; alias = _edje_merge_path(eina_hash_find((*ed)->collection->alias, path[0]), path + 1); - if (alias) { - rp = _edje_real_part_recursive_get(ed, alias); - free(alias); - return rp; - } + if (alias) + { + rp = _edje_real_part_recursive_get(ed, alias); + free(alias); + return rp; + } } //printf(" lookup: %s on %s\n", path[0], ed->parent ? ed->parent : "-"); @@ -5001,27 +5034,29 @@ _edje_real_part_recursive_get_helper(Edje **ed, char **path) switch (rp->part->type) { case EDJE_PART_TYPE_GROUP: - if ((rp->type != EDJE_RP_TYPE_SWALLOW) || - (!rp->typedata.swallow)) return NULL; - if (!rp->typedata.swallow->swallowed_object) return NULL; - *ed = _edje_fetch(rp->typedata.swallow->swallowed_object); - if (!*ed) return NULL; - path++; - return _edje_real_part_recursive_get_helper(ed, path); + if ((rp->type != EDJE_RP_TYPE_SWALLOW) || + (!rp->typedata.swallow)) return NULL; + if (!rp->typedata.swallow->swallowed_object) return NULL; + *ed = _edje_fetch(rp->typedata.swallow->swallowed_object); + if (!*ed) return NULL; + path++; + return _edje_real_part_recursive_get_helper(ed, path); + case EDJE_PART_TYPE_BOX: case EDJE_PART_TYPE_TABLE: case EDJE_PART_TYPE_EXTERNAL: - if (!idx) return rp; - path++; + if (!idx) return rp; + path++; - child = _edje_children_get(rp, idx); + child = _edje_children_get(rp, idx); - *ed = _edje_fetch(child); + *ed = _edje_fetch(child); + + if (!*ed) return NULL; + return _edje_real_part_recursive_get_helper(ed, path); - if (!*ed) return NULL; - return _edje_real_part_recursive_get_helper(ed, path); default: - return NULL; + return NULL; } } @@ -5302,8 +5337,8 @@ _edje_real_part_swallow_hints_update(Edje_Real_Part *rp) rp->typedata.swallow->swallow_params.max.h = h; } else if (eo_isa(rp->typedata.swallow->swallowed_object, EVAS_TEXT_CLASS) || - eo_isa(rp->typedata.swallow->swallowed_object, EVAS_POLYGON_CLASS) || - eo_isa(rp->typedata.swallow->swallowed_object, EVAS_LINE_CLASS)) + eo_isa(rp->typedata.swallow->swallowed_object, EVAS_POLYGON_CLASS) || + eo_isa(rp->typedata.swallow->swallowed_object, EVAS_LINE_CLASS)) { Evas_Coord w = 0, h = 0; @@ -5315,44 +5350,49 @@ _edje_real_part_swallow_hints_update(Edje_Real_Part *rp) rp->typedata.swallow->swallow_params.max.w = w; rp->typedata.swallow->swallow_params.max.h = h; } - { - Evas_Coord w1 = 0, h1 = 0, w2 = 0, h2 = 0, aw = 0, ah = 0; - Evas_Aspect_Control am = EVAS_ASPECT_CONTROL_NONE; + { + Evas_Coord w1 = 0, h1 = 0, w2 = 0, h2 = 0, aw = 0, ah = 0; + Evas_Aspect_Control am = EVAS_ASPECT_CONTROL_NONE; - evas_object_size_hint_min_get(rp->typedata.swallow->swallowed_object, &w1, &h1); - evas_object_size_hint_max_get(rp->typedata.swallow->swallowed_object, &w2, &h2); - evas_object_size_hint_aspect_get(rp->typedata.swallow->swallowed_object, &am, &aw, &ah); - rp->typedata.swallow->swallow_params.min.w = w1; - rp->typedata.swallow->swallow_params.min.h = h1; - if (w2 > 0) rp->typedata.swallow->swallow_params.max.w = w2; - if (h2 > 0) rp->typedata.swallow->swallow_params.max.h = h2; - switch (am) - { - case EVAS_ASPECT_CONTROL_NONE: - rp->typedata.swallow->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_NONE; - break; - case EVAS_ASPECT_CONTROL_NEITHER: - rp->typedata.swallow->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_NEITHER; - break; - case EVAS_ASPECT_CONTROL_HORIZONTAL: - rp->typedata.swallow->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_HORIZONTAL; - break; - case EVAS_ASPECT_CONTROL_VERTICAL: - rp->typedata.swallow->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_VERTICAL; - break; - case EVAS_ASPECT_CONTROL_BOTH: - rp->typedata.swallow->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_BOTH; - break; - default: - break; - } - rp->typedata.swallow->swallow_params.aspect.w = aw; - rp->typedata.swallow->swallow_params.aspect.h = ah; - evas_object_data_set(rp->typedata.swallow->swallowed_object, "\377 edje.swallowing_part", rp); - } + evas_object_size_hint_min_get(rp->typedata.swallow->swallowed_object, &w1, &h1); + evas_object_size_hint_max_get(rp->typedata.swallow->swallowed_object, &w2, &h2); + evas_object_size_hint_aspect_get(rp->typedata.swallow->swallowed_object, &am, &aw, &ah); + rp->typedata.swallow->swallow_params.min.w = w1; + rp->typedata.swallow->swallow_params.min.h = h1; + if (w2 > 0) rp->typedata.swallow->swallow_params.max.w = w2; + if (h2 > 0) rp->typedata.swallow->swallow_params.max.h = h2; + switch (am) + { + case EVAS_ASPECT_CONTROL_NONE: + rp->typedata.swallow->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_NONE; + break; + + case EVAS_ASPECT_CONTROL_NEITHER: + rp->typedata.swallow->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_NEITHER; + break; + + case EVAS_ASPECT_CONTROL_HORIZONTAL: + rp->typedata.swallow->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_HORIZONTAL; + break; + + case EVAS_ASPECT_CONTROL_VERTICAL: + rp->typedata.swallow->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_VERTICAL; + break; + + case EVAS_ASPECT_CONTROL_BOTH: + rp->typedata.swallow->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_BOTH; + break; + + default: + break; + } + rp->typedata.swallow->swallow_params.aspect.w = aw; + rp->typedata.swallow->swallow_params.aspect.h = ah; + evas_object_data_set(rp->typedata.swallow->swallowed_object, "\377 edje.swallowing_part", rp); + } #ifdef EDJE_CALC_CACHE - rp->invalidate = EINA_TRUE; + rp->invalidate = EINA_TRUE; #endif } @@ -5401,7 +5441,7 @@ _edje_object_part_swallow_image_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_ void _edje_real_part_swallow(Edje *ed, - Edje_Real_Part *rp, + Edje_Real_Part *rp, Evas_Object *obj_swallow, Eina_Bool hints_update) { @@ -5432,10 +5472,10 @@ _edje_real_part_swallow(Edje *ed, evas_object_smart_member_add(rp->typedata.swallow->swallowed_object, ed->obj); if (rp->part->clip_to_id >= 0) { - Edje_Real_Part *clip_to; + Edje_Real_Part *clip_to; - clip_to = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size]; - evas_object_clip_set(rp->typedata.swallow->swallowed_object, clip_to->object); + clip_to = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size]; + evas_object_clip_set(rp->typedata.swallow->swallowed_object, clip_to->object); } else evas_object_clip_set(rp->typedata.swallow->swallowed_object, ed->base->clipper); //FIXME: I'm not sure why Edje Nested is a parent of the rp->object here. Is it normal case? @@ -5537,7 +5577,7 @@ _edje_object_signal_preload_cb(void *data, Evas_Object *obj, EINA_UNUSED const c /** * @internal - * + * * for edje_cc */ EAPI void @@ -5579,7 +5619,7 @@ _edje_program_remove(Edje_Part_Collection *edc, Edje_Program *p) for (i = 0; i < *count; ++i) if ((*array)[i] == p) { - memmove(*array + i, *array + i + 1, sizeof (Edje_Program *) * (*count - i -1)); + memmove(*array + i, *array + i + 1, sizeof (Edje_Program *) * (*count - i - 1)); (*count)--; break; } @@ -5587,7 +5627,7 @@ _edje_program_remove(Edje_Part_Collection *edc, Edje_Program *p) /** * @internal - * + * * for edje_cc */ EAPI void diff --git a/src/lib/edje/edje_var.c b/src/lib/edje/edje_var.c index 14f7d2df84..6c2ddf26f3 100644 --- a/src/lib/edje/edje_var.c +++ b/src/lib/edje/edje_var.c @@ -4,7 +4,7 @@ static Eina_Bool _edje_var_timer_cb(void *data); static Eina_Bool _edje_var_anim_cb(void *data); static Ecore_Animator *_edje_animator = NULL; -static Eina_List *_edje_anim_list = NULL; +static Eina_List *_edje_anim_list = NULL; static Eina_Bool _edje_var_timer_cb(void *data) @@ -23,38 +23,38 @@ _edje_var_timer_cb(void *data) ed->var_pool->timers = eina_list_remove(ed->var_pool->timers, et); fn = et->func; free(et); - { - void *pdata; - int ret; + { + void *pdata; + int ret; - pdata = embryo_program_data_get(ed->collection->script); - embryo_program_data_set(ed->collection->script, ed); - embryo_program_max_cycle_run_set(ed->collection->script, 5000000); - ret = embryo_program_run(ed->collection->script, fn); - if (ret == EMBRYO_PROGRAM_FAIL) - { - ERR("ERROR with embryo script (timer callback). " - "OBJECT NAME: '%s', " - "OBJECT FILE: '%s', " - "ERROR: '%s'", - ed->collection->part, - ed->file->path, - embryo_error_string_get(embryo_program_error_get(ed->collection->script))); - } - else if (ret == EMBRYO_PROGRAM_TOOLONG) - { - ERR("ERROR with embryo script (timer callback). " - "OBJECT NAME: '%s', " - "OBJECT FILE: '%s', " - "ERROR: 'Script exceeded maximum allowed cycle count of %i'", - ed->collection->part, - ed->file->path, - embryo_program_max_cycle_run_get(ed->collection->script)); - } - embryo_program_data_set(ed->collection->script, pdata); - embryo_program_vm_pop(ed->collection->script); - _edje_recalc(ed); - } + pdata = embryo_program_data_get(ed->collection->script); + embryo_program_data_set(ed->collection->script, ed); + embryo_program_max_cycle_run_set(ed->collection->script, 5000000); + ret = embryo_program_run(ed->collection->script, fn); + if (ret == EMBRYO_PROGRAM_FAIL) + { + ERR("ERROR with embryo script (timer callback). " + "OBJECT NAME: '%s', " + "OBJECT FILE: '%s', " + "ERROR: '%s'", + ed->collection->part, + ed->file->path, + embryo_error_string_get(embryo_program_error_get(ed->collection->script))); + } + else if (ret == EMBRYO_PROGRAM_TOOLONG) + { + ERR("ERROR with embryo script (timer callback). " + "OBJECT NAME: '%s', " + "OBJECT FILE: '%s', " + "ERROR: 'Script exceeded maximum allowed cycle count of %i'", + ed->collection->part, + ed->file->path, + embryo_program_max_cycle_run_get(ed->collection->script)); + } + embryo_program_data_set(ed->collection->script, pdata); + embryo_program_vm_pop(ed->collection->script); + _edje_recalc(ed); + } return ECORE_CALLBACK_CANCEL; } @@ -70,105 +70,105 @@ _edje_var_anim_cb(void *data EINA_UNUSED) tl = eina_list_append(tl, tmp); while (tl) { - Edje *ed; - Eina_List *tl2; - Edje_Var_Animator *ea; + Edje *ed; + Eina_List *tl2; + Edje_Var_Animator *ea; - ed = eina_list_data_get(tl); - _edje_ref(ed); - _edje_block(ed); - _edje_util_freeze(ed); - tl = eina_list_remove(tl, ed); - if (!ed->var_pool) continue; - tl2 = NULL; - EINA_LIST_FOREACH(ed->var_pool->animators, l, tmp) - tl2 = eina_list_append(tl2, tmp); - ed->var_pool->walking_list++; - while (tl2) - { - ea = eina_list_data_get(tl2); - if ((ed->var_pool) && (!ea->delete_me)) - { - if ((!ed->paused) && (!ed->delete_me)) - { - Embryo_Function fn; - float v; + ed = eina_list_data_get(tl); + _edje_ref(ed); + _edje_block(ed); + _edje_util_freeze(ed); + tl = eina_list_remove(tl, ed); + if (!ed->var_pool) continue; + tl2 = NULL; + EINA_LIST_FOREACH(ed->var_pool->animators, l, tmp) + tl2 = eina_list_append(tl2, tmp); + ed->var_pool->walking_list++; + while (tl2) + { + ea = eina_list_data_get(tl2); + if ((ed->var_pool) && (!ea->delete_me)) + { + if ((!ed->paused) && (!ed->delete_me)) + { + Embryo_Function fn; + float v; int ret; - v = (t - ea->start) / ea->len; - if (v > 1.0) v= 1.0; + v = (t - ea->start) / ea->len; + if (v > 1.0) v = 1.0; // _edje_embryo_script_reset(ed); - embryo_program_vm_push(ed->collection->script); - _edje_embryo_globals_init(ed); - embryo_parameter_cell_push(ed->collection->script, (Embryo_Cell)ea->val); - embryo_parameter_cell_push(ed->collection->script, EMBRYO_FLOAT_TO_CELL(v)); - fn = ea->func; - { - void *pdata; + embryo_program_vm_push(ed->collection->script); + _edje_embryo_globals_init(ed); + embryo_parameter_cell_push(ed->collection->script, (Embryo_Cell)ea->val); + embryo_parameter_cell_push(ed->collection->script, EMBRYO_FLOAT_TO_CELL(v)); + fn = ea->func; + { + void *pdata; - pdata = embryo_program_data_get(ed->collection->script); - embryo_program_data_set(ed->collection->script, ed); - embryo_program_max_cycle_run_set(ed->collection->script, 5000000); - ret = embryo_program_run(ed->collection->script, fn); - if (ret == EMBRYO_PROGRAM_FAIL) - { - ERR("ERROR with embryo script (anim callback). " - "OBJECT NAME: '%s', " - "OBJECT FILE: '%s', " - "ERROR: '%s'", - ed->collection->part, - ed->file->path, - embryo_error_string_get(embryo_program_error_get(ed->collection->script))); - } - else if (ret == EMBRYO_PROGRAM_TOOLONG) - { - ERR("ERROR with embryo script (anim callback). " - "OBJECT NAME: '%s', " - "OBJECT FILE: '%s', " - "ERROR: 'Script exceeded maximum allowed cycle count of %i'", - ed->collection->part, - ed->file->path, - embryo_program_max_cycle_run_get(ed->collection->script)); - } - embryo_program_data_set(ed->collection->script, pdata); - embryo_program_vm_pop(ed->collection->script); - _edje_recalc(ed); - } - if (v == 1.0) ea->delete_me = 1; - } - } - tl2 = eina_list_remove(tl2, ea); - if (ed->block_break) - { - eina_list_free(tl2); - break; - } - } - ed->var_pool->walking_list--; - EINA_LIST_FOREACH(ed->var_pool->animators, l, ea) - { - if (ea->delete_me) - { - l = eina_list_next(l); - ed->var_pool->animators = eina_list_remove(ed->var_pool->animators, ea); - free(ea); - } - else - l = eina_list_next(l); - } - if (!ed->var_pool->animators) - _edje_anim_list = eina_list_remove(_edje_anim_list, ed); - _edje_unblock(ed); - _edje_util_thaw(ed); - _edje_unref(ed); + pdata = embryo_program_data_get(ed->collection->script); + embryo_program_data_set(ed->collection->script, ed); + embryo_program_max_cycle_run_set(ed->collection->script, 5000000); + ret = embryo_program_run(ed->collection->script, fn); + if (ret == EMBRYO_PROGRAM_FAIL) + { + ERR("ERROR with embryo script (anim callback). " + "OBJECT NAME: '%s', " + "OBJECT FILE: '%s', " + "ERROR: '%s'", + ed->collection->part, + ed->file->path, + embryo_error_string_get(embryo_program_error_get(ed->collection->script))); + } + else if (ret == EMBRYO_PROGRAM_TOOLONG) + { + ERR("ERROR with embryo script (anim callback). " + "OBJECT NAME: '%s', " + "OBJECT FILE: '%s', " + "ERROR: 'Script exceeded maximum allowed cycle count of %i'", + ed->collection->part, + ed->file->path, + embryo_program_max_cycle_run_get(ed->collection->script)); + } + embryo_program_data_set(ed->collection->script, pdata); + embryo_program_vm_pop(ed->collection->script); + _edje_recalc(ed); + } + if (v == 1.0) ea->delete_me = 1; + } + } + tl2 = eina_list_remove(tl2, ea); + if (ed->block_break) + { + eina_list_free(tl2); + break; + } + } + ed->var_pool->walking_list--; + EINA_LIST_FOREACH(ed->var_pool->animators, l, ea) + { + if (ea->delete_me) + { + l = eina_list_next(l); + ed->var_pool->animators = eina_list_remove(ed->var_pool->animators, ea); + free(ea); + } + else + l = eina_list_next(l); + } + if (!ed->var_pool->animators) + _edje_anim_list = eina_list_remove(_edje_anim_list, ed); + _edje_unblock(ed); + _edje_util_thaw(ed); + _edje_unref(ed); } if (!_edje_anim_list) { - if (_edje_animator) - { - ecore_animator_del(_edje_animator); - _edje_animator = NULL; - } + if (_edje_animator) + { + ecore_animator_del(_edje_animator); + _edje_animator = NULL; + } } return !!_edje_animator; } @@ -184,10 +184,10 @@ _edje_var_free(Edje_Var *var) { if (var->type == EDJE_VAR_STRING) { - if (var->data.s.v) - { - free(var->data.s.v); - } + if (var->data.s.v) + { + free(var->data.s.v); + } } free(var); } @@ -214,57 +214,57 @@ _edje_var_shutdown(Edje *ed) if (!ed->var_pool) return; if (ed->var_pool->vars) { - int i; + int i; - for (i = 0; i < ed->var_pool->size; i++) - { - if (ed->var_pool->vars[i].type == EDJE_VAR_STRING) - { - if (ed->var_pool->vars[i].data.s.v) - { - free(ed->var_pool->vars[i].data.s.v); - ed->var_pool->vars[i].data.s.v = NULL; - } - } - else if (ed->var_pool->vars[i].type == EDJE_VAR_LIST) - { - while (ed->var_pool->vars[i].data.l.v) - { - _edje_var_free(eina_list_data_get(ed->var_pool->vars[i].data.l.v)); - ed->var_pool->vars[i].data.l.v = eina_list_remove_list(ed->var_pool->vars[i].data.l.v, ed->var_pool->vars[i].data.l.v); - } - } - } - free(ed->var_pool->vars); + for (i = 0; i < ed->var_pool->size; i++) + { + if (ed->var_pool->vars[i].type == EDJE_VAR_STRING) + { + if (ed->var_pool->vars[i].data.s.v) + { + free(ed->var_pool->vars[i].data.s.v); + ed->var_pool->vars[i].data.s.v = NULL; + } + } + else if (ed->var_pool->vars[i].type == EDJE_VAR_LIST) + { + while (ed->var_pool->vars[i].data.l.v) + { + _edje_var_free(eina_list_data_get(ed->var_pool->vars[i].data.l.v)); + ed->var_pool->vars[i].data.l.v = eina_list_remove_list(ed->var_pool->vars[i].data.l.v, ed->var_pool->vars[i].data.l.v); + } + } + } + free(ed->var_pool->vars); } while (ed->var_pool->timers) { - Edje_Var_Timer *et; + Edje_Var_Timer *et; - et = eina_list_data_get(ed->var_pool->timers); - ed->var_pool->timers = eina_list_remove(ed->var_pool->timers, et); - ecore_timer_del(et->timer); - free(et); + et = eina_list_data_get(ed->var_pool->timers); + ed->var_pool->timers = eina_list_remove(ed->var_pool->timers, et); + ecore_timer_del(et->timer); + free(et); } if (ed->var_pool->animators) { - _edje_anim_list = eina_list_remove(_edje_anim_list, ed); - if (!_edje_anim_list) - { - if (_edje_animator) - { - ecore_animator_del(_edje_animator); - _edje_animator = NULL; - } - } + _edje_anim_list = eina_list_remove(_edje_anim_list, ed); + if (!_edje_anim_list) + { + if (_edje_animator) + { + ecore_animator_del(_edje_animator); + _edje_animator = NULL; + } + } } while (ed->var_pool->animators) { - Edje_Var_Animator *ea; + Edje_Var_Animator *ea; - ea = eina_list_data_get(ed->var_pool->animators); - ed->var_pool->animators = eina_list_remove(ed->var_pool->animators, ea); - free(ea); + ea = eina_list_data_get(ed->var_pool->animators); + ed->var_pool->animators = eina_list_remove(ed->var_pool->animators, ea); + free(ea); } free(ed->var_pool); ed->var_pool = NULL; @@ -280,7 +280,7 @@ _edje_var_string_id_get(Edje *ed, const char *string) if (!ed->collection->script) return 0; if (!string) return 0; cell = embryo_program_variable_find(ed->collection->script, (char *)string); - if (cell == EMBRYO_CELL_NONE) return 0; + if (cell == EMBRYO_CELL_NONE) return 0; cptr = embryo_data_address_get(ed->collection->script, cell); if (!cptr) return 0; return (int)(*cptr); @@ -292,33 +292,33 @@ _edje_var_var_int_get(Edje *ed EINA_UNUSED, Edje_Var *var) /* auto-cast */ if (var->type == EDJE_VAR_STRING) { - if (var->data.s.v) - { - double f; + if (var->data.s.v) + { + double f; - f = atof(var->data.s.v); - free(var->data.s.v); - var->data.s.v = NULL; - var->data.i.v = (int)f; - } - var->type = EDJE_VAR_INT; + f = atof(var->data.s.v); + free(var->data.s.v); + var->data.s.v = NULL; + var->data.i.v = (int)f; + } + var->type = EDJE_VAR_INT; } else if (var->type == EDJE_VAR_FLOAT) { - var->data.i.v = (int)(var->data.f.v); - var->type = EDJE_VAR_INT; + var->data.i.v = (int)(var->data.f.v); + var->type = EDJE_VAR_INT; } else if (var->type == EDJE_VAR_NONE) { - var->type = EDJE_VAR_INT; + var->type = EDJE_VAR_INT; } else if (var->type == EDJE_VAR_LIST) { - return 0; + return 0; } else if (var->type == EDJE_VAR_HASH) { - return 0; + return 0; } return var->data.i.v; } @@ -329,28 +329,28 @@ _edje_var_var_int_set(Edje *ed EINA_UNUSED, Edje_Var *var, int v) /* auto-cast */ if (var->type == EDJE_VAR_STRING) { - if (var->data.s.v) - { - free(var->data.s.v); - var->data.s.v = NULL; - } - var->type = EDJE_VAR_INT; + if (var->data.s.v) + { + free(var->data.s.v); + var->data.s.v = NULL; + } + var->type = EDJE_VAR_INT; } else if (var->type == EDJE_VAR_FLOAT) { - var->type = EDJE_VAR_INT; + var->type = EDJE_VAR_INT; } else if (var->type == EDJE_VAR_NONE) { - var->type = EDJE_VAR_INT; + var->type = EDJE_VAR_INT; } else if (var->type == EDJE_VAR_LIST) { - return; + return; } else if (var->type == EDJE_VAR_HASH) { - return; + return; } var->data.i.v = v; } @@ -361,33 +361,33 @@ _edje_var_var_float_get(Edje *ed EINA_UNUSED, Edje_Var *var) /* auto-cast */ if (var->type == EDJE_VAR_STRING) { - if (var->data.s.v) - { - double f; + if (var->data.s.v) + { + double f; - f = atof(var->data.s.v); - free(var->data.s.v); - var->data.s.v = NULL; - var->data.f.v = f; - } - var->type = EDJE_VAR_FLOAT; + f = atof(var->data.s.v); + free(var->data.s.v); + var->data.s.v = NULL; + var->data.f.v = f; + } + var->type = EDJE_VAR_FLOAT; } else if (var->type == EDJE_VAR_INT) { - var->data.f.v = (double)(var->data.i.v); - var->type = EDJE_VAR_FLOAT; + var->data.f.v = (double)(var->data.i.v); + var->type = EDJE_VAR_FLOAT; } else if (var->type == EDJE_VAR_NONE) { - var->type = EDJE_VAR_FLOAT; + var->type = EDJE_VAR_FLOAT; } else if (var->type == EDJE_VAR_LIST) { - return 0.0; + return 0.0; } else if (var->type == EDJE_VAR_HASH) { - return 0.0; + return 0.0; } return var->data.f.v; } @@ -398,29 +398,29 @@ _edje_var_var_float_set(Edje *ed EINA_UNUSED, Edje_Var *var, double v) /* auto-cast */ if (var->type == EDJE_VAR_STRING) { - if (var->data.s.v) - { - free(var->data.s.v); - var->data.s.v = NULL; - } - var->type = EDJE_VAR_FLOAT; + if (var->data.s.v) + { + free(var->data.s.v); + var->data.s.v = NULL; + } + var->type = EDJE_VAR_FLOAT; } else if (var->type == EDJE_VAR_INT) { - var->data.f.v = 0; - var->type = EDJE_VAR_FLOAT; + var->data.f.v = 0; + var->type = EDJE_VAR_FLOAT; } else if (var->type == EDJE_VAR_NONE) { - var->type = EDJE_VAR_FLOAT; + var->type = EDJE_VAR_FLOAT; } else if (var->type == EDJE_VAR_LIST) { - return; + return; } else if (var->type == EDJE_VAR_HASH) { - return; + return; } var->data.f.v = v; } @@ -431,32 +431,32 @@ _edje_var_var_str_get(Edje *ed EINA_UNUSED, Edje_Var *var) /* auto-cast */ if (var->type == EDJE_VAR_INT) { - char buf[64]; + char buf[64]; - snprintf(buf, sizeof(buf), "%i", var->data.i.v); - var->data.s.v = strdup(buf); - var->type = EDJE_VAR_STRING; + snprintf(buf, sizeof(buf), "%i", var->data.i.v); + var->data.s.v = strdup(buf); + var->type = EDJE_VAR_STRING; } else if (var->type == EDJE_VAR_FLOAT) { - char buf[64]; + char buf[64]; - snprintf(buf, sizeof(buf), "%f", var->data.f.v); - var->data.s.v = strdup(buf); - var->type = EDJE_VAR_STRING; + snprintf(buf, sizeof(buf), "%f", var->data.f.v); + var->data.s.v = strdup(buf); + var->type = EDJE_VAR_STRING; } else if (var->type == EDJE_VAR_NONE) { - var->data.s.v = strdup(""); - var->type = EDJE_VAR_STRING; + var->data.s.v = strdup(""); + var->type = EDJE_VAR_STRING; } else if (var->type == EDJE_VAR_LIST) { - return NULL; + return NULL; } else if (var->type == EDJE_VAR_HASH) { - return NULL; + return NULL; } return var->data.s.v; } @@ -467,31 +467,31 @@ _edje_var_var_str_set(Edje *ed EINA_UNUSED, Edje_Var *var, const char *str) /* auto-cast */ if (var->type == EDJE_VAR_STRING) { - if (var->data.s.v) - { - free(var->data.s.v); - var->data.s.v = NULL; - } + if (var->data.s.v) + { + free(var->data.s.v); + var->data.s.v = NULL; + } } else if (var->type == EDJE_VAR_INT) { - var->type = EDJE_VAR_STRING; + var->type = EDJE_VAR_STRING; } else if (var->type == EDJE_VAR_FLOAT) { - var->type = EDJE_VAR_STRING; + var->type = EDJE_VAR_STRING; } else if (var->type == EDJE_VAR_NONE) { - var->type = EDJE_VAR_STRING; + var->type = EDJE_VAR_STRING; } else if (var->type == EDJE_VAR_LIST) { - return; + return; } else if (var->type == EDJE_VAR_HASH) { - return; + return; } var->data.s.v = strdup(str); } @@ -623,7 +623,8 @@ _edje_var_list_count_get(Edje *ed, int id) if ((id < 0) || (id >= ed->var_pool->size)) return 0; if (ed->var_pool->vars[id].type == EDJE_VAR_NONE) ed->var_pool->vars[id].type = EDJE_VAR_LIST; - else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return 0; + else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) + return 0; return eina_list_count(ed->var_pool->vars[id].data.l.v); } @@ -636,17 +637,18 @@ _edje_var_list_remove_nth(Edje *ed, int id, int n) if ((id < 0) || (id >= ed->var_pool->size)) return; if (ed->var_pool->vars[id].type == EDJE_VAR_NONE) ed->var_pool->vars[id].type = EDJE_VAR_LIST; - else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return; - { - Eina_List *nth; + else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) + return; + { + Eina_List *nth; - nth = eina_list_nth_list(ed->var_pool->vars[id].data.l.v, n); - if (nth) - { - _edje_var_free(eina_list_data_get(nth)); - ed->var_pool->vars[id].data.l.v = eina_list_remove_list(ed->var_pool->vars[id].data.l.v, nth); - } - } + nth = eina_list_nth_list(ed->var_pool->vars[id].data.l.v, n); + if (nth) + { + _edje_var_free(eina_list_data_get(nth)); + ed->var_pool->vars[id].data.l.v = eina_list_remove_list(ed->var_pool->vars[id].data.l.v, nth); + } + } } int @@ -658,15 +660,16 @@ _edje_var_list_nth_int_get(Edje *ed, int id, int n) if ((id < 0) || (id >= ed->var_pool->size)) return 0; if (ed->var_pool->vars[id].type == EDJE_VAR_NONE) ed->var_pool->vars[id].type = EDJE_VAR_LIST; - else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return 0; - { - Edje_Var *var; + else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) + return 0; + { + Edje_Var *var; - id += EDJE_VAR_MAGIC_BASE; - var = _edje_var_list_nth(ed, id, n); - if (!var) return 0; - return _edje_var_var_int_get(ed, var); - } + id += EDJE_VAR_MAGIC_BASE; + var = _edje_var_list_nth(ed, id, n); + if (!var) return 0; + return _edje_var_var_int_get(ed, var); + } } void @@ -678,15 +681,16 @@ _edje_var_list_nth_int_set(Edje *ed, int id, int n, int v) if ((id < 0) || (id >= ed->var_pool->size)) return; if (ed->var_pool->vars[id].type == EDJE_VAR_NONE) ed->var_pool->vars[id].type = EDJE_VAR_LIST; - else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return; - { - Edje_Var *var; + else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) + return; + { + Edje_Var *var; - id += EDJE_VAR_MAGIC_BASE; - var = _edje_var_list_nth(ed, id, n); - if (!var) return; - _edje_var_var_int_set(ed, var, v); - } + id += EDJE_VAR_MAGIC_BASE; + var = _edje_var_list_nth(ed, id, n); + if (!var) return; + _edje_var_var_int_set(ed, var, v); + } } void @@ -698,16 +702,17 @@ _edje_var_list_int_append(Edje *ed, int id, int v) if ((id < 0) || (id >= ed->var_pool->size)) return; if (ed->var_pool->vars[id].type == EDJE_VAR_NONE) ed->var_pool->vars[id].type = EDJE_VAR_LIST; - else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return; - { - Edje_Var *var; + else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) + return; + { + Edje_Var *var; - var = _edje_var_new(); - if (!var) return; - id += EDJE_VAR_MAGIC_BASE; - _edje_var_var_int_set(ed, var, v); - _edje_var_list_var_append(ed, id, var); - } + var = _edje_var_new(); + if (!var) return; + id += EDJE_VAR_MAGIC_BASE; + _edje_var_var_int_set(ed, var, v); + _edje_var_list_var_append(ed, id, var); + } } void @@ -719,16 +724,17 @@ _edje_var_list_int_prepend(Edje *ed, int id, int v) if ((id < 0) || (id >= ed->var_pool->size)) return; if (ed->var_pool->vars[id].type == EDJE_VAR_NONE) ed->var_pool->vars[id].type = EDJE_VAR_LIST; - else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return; - { - Edje_Var *var; + else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) + return; + { + Edje_Var *var; - var = _edje_var_new(); - if (!var) return; - id += EDJE_VAR_MAGIC_BASE; - _edje_var_var_int_set(ed, var, v); - _edje_var_list_var_prepend(ed, id, var); - } + var = _edje_var_new(); + if (!var) return; + id += EDJE_VAR_MAGIC_BASE; + _edje_var_var_int_set(ed, var, v); + _edje_var_list_var_prepend(ed, id, var); + } } void @@ -740,20 +746,21 @@ _edje_var_list_int_insert(Edje *ed, int id, int n, int v) if ((id < 0) || (id >= ed->var_pool->size)) return; if (ed->var_pool->vars[id].type == EDJE_VAR_NONE) ed->var_pool->vars[id].type = EDJE_VAR_LIST; - else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return; - { - Edje_Var *var, *var_rel; + else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) + return; + { + Edje_Var *var, *var_rel; - var = _edje_var_new(); - if (!var) return; - id += EDJE_VAR_MAGIC_BASE; - _edje_var_var_int_set(ed, var, v); - var_rel = _edje_var_list_nth(ed, id, n); - if (!var_rel) - _edje_var_list_var_append(ed, id, var); - else - _edje_var_list_var_prepend_relative(ed, id, var, var_rel); - } + var = _edje_var_new(); + if (!var) return; + id += EDJE_VAR_MAGIC_BASE; + _edje_var_var_int_set(ed, var, v); + var_rel = _edje_var_list_nth(ed, id, n); + if (!var_rel) + _edje_var_list_var_append(ed, id, var); + else + _edje_var_list_var_prepend_relative(ed, id, var, var_rel); + } } double @@ -765,15 +772,16 @@ _edje_var_list_nth_float_get(Edje *ed, int id, int n) if ((id < 0) || (id >= ed->var_pool->size)) return 0; if (ed->var_pool->vars[id].type == EDJE_VAR_NONE) ed->var_pool->vars[id].type = EDJE_VAR_LIST; - else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return 0; - { - Edje_Var *var; + else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) + return 0; + { + Edje_Var *var; - id += EDJE_VAR_MAGIC_BASE; - var = _edje_var_list_nth(ed, id, n); - if (!var) return 0; - return _edje_var_var_float_get(ed, var); - } + id += EDJE_VAR_MAGIC_BASE; + var = _edje_var_list_nth(ed, id, n); + if (!var) return 0; + return _edje_var_var_float_get(ed, var); + } } void @@ -785,15 +793,16 @@ _edje_var_list_nth_float_set(Edje *ed, int id, int n, double v) if ((id < 0) || (id >= ed->var_pool->size)) return; if (ed->var_pool->vars[id].type == EDJE_VAR_NONE) ed->var_pool->vars[id].type = EDJE_VAR_LIST; - else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return; - { - Edje_Var *var; + else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) + return; + { + Edje_Var *var; - id += EDJE_VAR_MAGIC_BASE; - var = _edje_var_list_nth(ed, id, n); - if (!var) return; - _edje_var_var_float_set(ed, var, v); - } + id += EDJE_VAR_MAGIC_BASE; + var = _edje_var_list_nth(ed, id, n); + if (!var) return; + _edje_var_var_float_set(ed, var, v); + } } void @@ -805,16 +814,17 @@ _edje_var_list_float_append(Edje *ed, int id, double v) if ((id < 0) || (id >= ed->var_pool->size)) return; if (ed->var_pool->vars[id].type == EDJE_VAR_NONE) ed->var_pool->vars[id].type = EDJE_VAR_LIST; - else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return; - { - Edje_Var *var; + else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) + return; + { + Edje_Var *var; - var = _edje_var_new(); - if (!var) return; - id += EDJE_VAR_MAGIC_BASE; - _edje_var_var_float_set(ed, var, v); - _edje_var_list_var_append(ed, id, var); - } + var = _edje_var_new(); + if (!var) return; + id += EDJE_VAR_MAGIC_BASE; + _edje_var_var_float_set(ed, var, v); + _edje_var_list_var_append(ed, id, var); + } } void @@ -826,16 +836,17 @@ _edje_var_list_float_prepend(Edje *ed, int id, double v) if ((id < 0) || (id >= ed->var_pool->size)) return; if (ed->var_pool->vars[id].type == EDJE_VAR_NONE) ed->var_pool->vars[id].type = EDJE_VAR_LIST; - else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return; - { - Edje_Var *var; + else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) + return; + { + Edje_Var *var; - var = _edje_var_new(); - if (!var) return; - id += EDJE_VAR_MAGIC_BASE; - _edje_var_var_float_set(ed, var, v); - _edje_var_list_var_prepend(ed, id, var); - } + var = _edje_var_new(); + if (!var) return; + id += EDJE_VAR_MAGIC_BASE; + _edje_var_var_float_set(ed, var, v); + _edje_var_list_var_prepend(ed, id, var); + } } void @@ -847,20 +858,21 @@ _edje_var_list_float_insert(Edje *ed, int id, int n, double v) if ((id < 0) || (id >= ed->var_pool->size)) return; if (ed->var_pool->vars[id].type == EDJE_VAR_NONE) ed->var_pool->vars[id].type = EDJE_VAR_LIST; - else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return; - { - Edje_Var *var, *var_rel; + else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) + return; + { + Edje_Var *var, *var_rel; - var = _edje_var_new(); - if (!var) return; - id += EDJE_VAR_MAGIC_BASE; - _edje_var_var_float_set(ed, var, v); - var_rel = _edje_var_list_nth(ed, id, n); - if (!var_rel) - _edje_var_list_var_append(ed, id, var); - else - _edje_var_list_var_prepend_relative(ed, id, var, var_rel); - } + var = _edje_var_new(); + if (!var) return; + id += EDJE_VAR_MAGIC_BASE; + _edje_var_var_float_set(ed, var, v); + var_rel = _edje_var_list_nth(ed, id, n); + if (!var_rel) + _edje_var_list_var_append(ed, id, var); + else + _edje_var_list_var_prepend_relative(ed, id, var, var_rel); + } } const char * @@ -872,15 +884,16 @@ _edje_var_list_nth_str_get(Edje *ed, int id, int n) if ((id < 0) || (id >= ed->var_pool->size)) return NULL; if (ed->var_pool->vars[id].type == EDJE_VAR_NONE) ed->var_pool->vars[id].type = EDJE_VAR_LIST; - else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return NULL; - { - Edje_Var *var; + else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) + return NULL; + { + Edje_Var *var; - id += EDJE_VAR_MAGIC_BASE; - var = _edje_var_list_nth(ed, id, n); - if (!var) return NULL; - return _edje_var_var_str_get(ed, var); - } + id += EDJE_VAR_MAGIC_BASE; + var = _edje_var_list_nth(ed, id, n); + if (!var) return NULL; + return _edje_var_var_str_get(ed, var); + } } void @@ -892,15 +905,16 @@ _edje_var_list_nth_str_set(Edje *ed, int id, int n, const char *v) if ((id < 0) || (id >= ed->var_pool->size)) return; if (ed->var_pool->vars[id].type == EDJE_VAR_NONE) ed->var_pool->vars[id].type = EDJE_VAR_LIST; - else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return; - { - Edje_Var *var; + else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) + return; + { + Edje_Var *var; - id += EDJE_VAR_MAGIC_BASE; - var = _edje_var_list_nth(ed, id, n); - if (!var) return; - _edje_var_var_str_set(ed, var, v); - } + id += EDJE_VAR_MAGIC_BASE; + var = _edje_var_list_nth(ed, id, n); + if (!var) return; + _edje_var_var_str_set(ed, var, v); + } } void @@ -912,16 +926,17 @@ _edje_var_list_str_append(Edje *ed, int id, const char *v) if ((id < 0) || (id >= ed->var_pool->size)) return; if (ed->var_pool->vars[id].type == EDJE_VAR_NONE) ed->var_pool->vars[id].type = EDJE_VAR_LIST; - else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return; - { - Edje_Var *var; + else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) + return; + { + Edje_Var *var; - var = _edje_var_new(); - if (!var) return; - id += EDJE_VAR_MAGIC_BASE; - _edje_var_var_str_set(ed, var, v); - _edje_var_list_var_append(ed, id, var); - } + var = _edje_var_new(); + if (!var) return; + id += EDJE_VAR_MAGIC_BASE; + _edje_var_var_str_set(ed, var, v); + _edje_var_list_var_append(ed, id, var); + } } void @@ -933,16 +948,17 @@ _edje_var_list_str_prepend(Edje *ed, int id, const char *v) if ((id < 0) || (id >= ed->var_pool->size)) return; if (ed->var_pool->vars[id].type == EDJE_VAR_NONE) ed->var_pool->vars[id].type = EDJE_VAR_LIST; - else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return; - { - Edje_Var *var; + else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) + return; + { + Edje_Var *var; - var = _edje_var_new(); - if (!var) return; - id += EDJE_VAR_MAGIC_BASE; - _edje_var_var_str_set(ed, var, v); - _edje_var_list_var_prepend(ed, id, var); - } + var = _edje_var_new(); + if (!var) return; + id += EDJE_VAR_MAGIC_BASE; + _edje_var_var_str_set(ed, var, v); + _edje_var_list_var_prepend(ed, id, var); + } } void @@ -954,20 +970,21 @@ _edje_var_list_str_insert(Edje *ed, int id, int n, const char *v) if ((id < 0) || (id >= ed->var_pool->size)) return; if (ed->var_pool->vars[id].type == EDJE_VAR_NONE) ed->var_pool->vars[id].type = EDJE_VAR_LIST; - else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) return; - { - Edje_Var *var, *var_rel; + else if (ed->var_pool->vars[id].type != EDJE_VAR_LIST) + return; + { + Edje_Var *var, *var_rel; - var = _edje_var_new(); - if (!var) return; - id += EDJE_VAR_MAGIC_BASE; - _edje_var_var_str_set(ed, var, v); - var_rel = _edje_var_list_nth(ed, id, n); - if (!var_rel) - _edje_var_list_var_append(ed, id, var); - else - _edje_var_list_var_prepend_relative(ed, id, var, var_rel); - } + var = _edje_var_new(); + if (!var) return; + id += EDJE_VAR_MAGIC_BASE; + _edje_var_var_str_set(ed, var, v); + var_rel = _edje_var_list_nth(ed, id, n); + if (!var_rel) + _edje_var_list_var_append(ed, id, var); + else + _edje_var_list_var_prepend_relative(ed, id, var, var_rel); + } } int @@ -988,8 +1005,8 @@ _edje_var_timer_add(Edje *ed, double in, const char *fname, int val) et->timer = ecore_timer_add(in, _edje_var_timer_cb, et); if (!et->timer) { - free(et); - return 0; + free(et); + return 0; } ed->var_pool->timers = eina_list_prepend(ed->var_pool->timers, et); return et->id; @@ -1082,8 +1099,8 @@ _edje_var_anim_del(Edje *ed, int id) if (ed->var_pool->walking_list) { - ea->delete_me = 1; - return; + ea->delete_me = 1; + return; } ed->var_pool->animators = eina_list_remove(ed->var_pool->animators, ea); @@ -1094,10 +1111,11 @@ _edje_var_anim_del(Edje *ed, int id) _edje_anim_list = eina_list_remove(_edje_anim_list, ed); if (!_edje_anim_list) { - if (_edje_animator) - { - ecore_animator_del(_edje_animator); - _edje_animator = NULL; - } + if (_edje_animator) + { + ecore_animator_del(_edje_animator); + _edje_animator = NULL; + } } } +