From: cedric Date: Thu, 24 Feb 2011 14:41:08 +0000 (+0000) Subject: edje: fix signal comming from box/table part. X-Git-Tag: submit/trunk/20120815.180907~713 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cb65416185b5679c0b422a002298717b4850fcd1;p=profile%2Fivi%2Fedje.git edje: fix signal comming from box/table part. Thanks to the report by Jonathan "Watchwolf" Atton. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@57299 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/ChangeLog b/ChangeLog index f0a5df2..abeaabd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,3 +32,8 @@ 2011-02-10 Cedric BAIL * Fix propagation of recursive events on existing part. + +2011-02-24 Cedric BAIL + + * fix signal comming from box/table item to include their + index or name correctly. diff --git a/src/lib/edje_load.c b/src/lib/edje_load.c index 5edb012..fef632d 100644 --- a/src/lib/edje_load.c +++ b/src/lib/edje_load.c @@ -785,8 +785,8 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g return 0; } child_ed = _edje_fetch(child_obj); - child_ed->parent = eina_stringshare_add(rp->part->name); - + child_ed->parent = eina_stringshare_add(rp->part->name); + group_path = eina_list_remove(group_path, group_path_entry); eina_stringshare_del(group_path_entry); @@ -798,10 +798,13 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g } else { + pack_it->parent = rp; + _edje_object_pack_item_hints_set(child_obj, pack_it); evas_object_show(child_obj); if (pack_it->name) - evas_object_name_set(child_obj, pack_it->name); + evas_object_name_set(child_obj, pack_it->name); + if (rp->part->type == EDJE_PART_TYPE_BOX) { _edje_real_part_box_append(rp, child_obj); @@ -1421,26 +1424,77 @@ _edje_find_alias(Eina_Hash *aliased, char *src, int *length) static void _cb_signal_repeat(void *data, Evas_Object *obj, const char *signal, 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; parent = data; ed = _edje_fetch(obj); if (!ed) return; + + pack_it = evas_object_data_get(obj, "\377 edje.box_item"); + if (!pack_it) pack_it = evas_object_data_get(obj, "\377 edje.table_item"); + if (pack_it) + { + if (!pack_it->name) + { + Eina_List *child = NULL; + Evas_Object *o; + + if (pack_it->parent->part->type == EDJE_PART_TYPE_BOX) + { + child = evas_object_box_children_get(pack_it->parent->object); + } + else if (pack_it->parent->part->type == EDJE_PART_TYPE_TABLE) + { + child = evas_object_table_children_get(pack_it->parent->object); + } + + EINA_LIST_FREE(child, o) + { + if (o == obj) break; + i++; + } + + eina_list_free(child); + + length_index = 12; + } + else + { + length_index = strlen(pack_it->name) + 2; + } + } + /* Replace snprint("%s%c%s") == memcpy + *new_src + memcat */ if (ed->parent) length_parent = strlen(ed->parent); length_source = strlen(source); - if (length_source + length_parent + 2 > sizeof(new_src)) + if (length_source + length_parent + 2 + length_index > sizeof(new_src)) return; if (ed->parent) memcpy(new_src, ed->parent, length_parent); + if (ed->parent && length_index) + { + new_src[length_parent++] = EDJE_PART_PATH_SEPARATOR_INDEXL; + if (length_index == 12) + length_parent += eina_convert_itoa(i, new_src + length_parent); + else + { + memcpy(new_src + length_parent, pack_it->name, length_index); + length_parent += length_index - 2; + } + new_src[length_parent++] = EDJE_PART_PATH_SEPARATOR_INDEXR; + } + new_src[length_parent] = EDJE_PART_PATH_SEPARATOR; memcpy(new_src + length_parent + 1, source, length_source + 1); diff --git a/src/lib/edje_private.h b/src/lib/edje_private.h index 528f3fd..184958d 100644 --- a/src/lib/edje_private.h +++ b/src/lib/edje_private.h @@ -291,6 +291,30 @@ typedef struct _Edje_Part_Description_Spec_Table Edje_Part_Description_Spec_ typedef struct _Edje_Patterns Edje_Patterns; typedef struct _Edje_Part_Box_Animation Edje_Part_Box_Animation; +typedef struct _Edje Edje; +typedef struct _Edje_Real_Part_State Edje_Real_Part_State; +typedef struct _Edje_Real_Part_Drag Edje_Real_Part_Drag; +typedef struct _Edje_Real_Part_Set Edje_Real_Part_Set; +typedef struct _Edje_Real_Part Edje_Real_Part; +typedef struct _Edje_Running_Program Edje_Running_Program; +typedef struct _Edje_Signal_Callback Edje_Signal_Callback; +typedef struct _Edje_Calc_Params Edje_Calc_Params; +typedef struct _Edje_Pending_Program Edje_Pending_Program; +typedef struct _Edje_Text_Style Edje_Text_Style; +typedef struct _Edje_Color_Class Edje_Color_Class; +typedef struct _Edje_Text_Class Edje_Text_Class; +typedef struct _Edje_Var Edje_Var; +typedef struct _Edje_Var_Int Edje_Var_Int; +typedef struct _Edje_Var_Float Edje_Var_Float; +typedef struct _Edje_Var_String Edje_Var_String; +typedef struct _Edje_Var_List Edje_Var_List; +typedef struct _Edje_Var_Hash Edje_Var_Hash; +typedef struct _Edje_Var_Animator Edje_Var_Animator; +typedef struct _Edje_Var_Timer Edje_Var_Timer; +typedef struct _Edje_Var_Pool Edje_Var_Pool; +typedef struct _Edje_Signal_Source_Char Edje_Signal_Source_Char; +typedef struct _Edje_Text_Insert_Filter_Callback Edje_Text_Insert_Filter_Callback; + #define EDJE_INF_MAX_W 100000 #define EDJE_INF_MAX_H 100000 @@ -590,6 +614,7 @@ struct _Edje_Part_Collection_Directory_Entry struct _Edje_Pack_Element { unsigned char type; /* only GROUP supported for now */ + Edje_Real_Part *parent; /* pointer to the table/box that hold it, set at runtime */ const char *name; /* if != NULL, will be set with evas_object_name_set */ const char *source; /* group name to use as source for this element */ Edje_Size min, prefer, max; @@ -892,31 +917,6 @@ struct _Edje_Part_Description_External /*----------*/ - -typedef struct _Edje Edje; -typedef struct _Edje_Real_Part_State Edje_Real_Part_State; -typedef struct _Edje_Real_Part_Drag Edje_Real_Part_Drag; -typedef struct _Edje_Real_Part_Set Edje_Real_Part_Set; -typedef struct _Edje_Real_Part Edje_Real_Part; -typedef struct _Edje_Running_Program Edje_Running_Program; -typedef struct _Edje_Signal_Callback Edje_Signal_Callback; -typedef struct _Edje_Calc_Params Edje_Calc_Params; -typedef struct _Edje_Pending_Program Edje_Pending_Program; -typedef struct _Edje_Text_Style Edje_Text_Style; -typedef struct _Edje_Color_Class Edje_Color_Class; -typedef struct _Edje_Text_Class Edje_Text_Class; -typedef struct _Edje_Var Edje_Var; -typedef struct _Edje_Var_Int Edje_Var_Int; -typedef struct _Edje_Var_Float Edje_Var_Float; -typedef struct _Edje_Var_String Edje_Var_String; -typedef struct _Edje_Var_List Edje_Var_List; -typedef struct _Edje_Var_Hash Edje_Var_Hash; -typedef struct _Edje_Var_Animator Edje_Var_Animator; -typedef struct _Edje_Var_Timer Edje_Var_Timer; -typedef struct _Edje_Var_Pool Edje_Var_Pool; -typedef struct _Edje_Signal_Source_Char Edje_Signal_Source_Char; -typedef struct _Edje_Text_Insert_Filter_Callback Edje_Text_Insert_Filter_Callback; - struct _Edje_Signal_Source_Char { EINA_RBTREE;