diff --git a/legacy/edje/ChangeLog b/legacy/edje/ChangeLog index 3e1d73e433..2d239c1795 100644 --- a/legacy/edje/ChangeLog +++ b/legacy/edje/ChangeLog @@ -490,14 +490,18 @@ * Add edje_object_access_part_list_get and acess flags in edc file. -2012-05-21 Carsten Haitzler (The Rasterman) +2012-06-21 Carsten Haitzler (The Rasterman) * Improve edje_cc slightly to use prefix for full path to embryo_cc. this still like before requires embryo and edje to share the same install prefix for edje_cc to work. -2012-06-12 Michael Bouchaud (yoz) +2012-06-12 Michael Bouchaud (yoz) * The aliases are now inherited from the targeted group * Aliases can be usable with edje programs, if the part is in the group + +2012-06-24 Cedric Bail + + * Emit signal for flagged part when their size get to zero. diff --git a/legacy/edje/NEWS b/legacy/edje/NEWS index 214695fd4a..fb4e059c8a 100644 --- a/legacy/edje/NEWS +++ b/legacy/edje/NEWS @@ -10,6 +10,7 @@ Additions: * Add SPACER part. This part are not putting anything into the canvas. So lighter and faster to process (Use it to replace RECT part that are never visible and never catch any event). * Add accessibility flags and API to retrieve the relevant part. + * Emit signal when flagged part size get to zero. Improvements: * Allocate once and reuse Evas_Map. diff --git a/legacy/edje/src/bin/edje_cc_handlers.c b/legacy/edje/src/bin/edje_cc_handlers.c index cd0f564b24..44a8129b78 100644 --- a/legacy/edje/src/bin/edje_cc_handlers.c +++ b/legacy/edje/src/bin/edje_cc_handlers.c @@ -171,6 +171,7 @@ static void st_collections_group_parts_part_description_inherit(void); static void st_collections_group_parts_part_description_source(void); static void st_collections_group_parts_part_description_state(void); static void st_collections_group_parts_part_description_visible(void); +static void st_collections_group_parts_part_description_limit(void); static void st_collections_group_parts_part_description_align(void); static void st_collections_group_parts_part_description_fixed(void); static void st_collections_group_parts_part_description_min(void); @@ -436,6 +437,7 @@ New_Statement_Handler statement_handlers[] = {"collections.group.parts.part.description.source", st_collections_group_parts_part_description_source}, {"collections.group.parts.part.description.state", st_collections_group_parts_part_description_state}, {"collections.group.parts.part.description.visible", st_collections_group_parts_part_description_visible}, + {"collections.group.parts.part.description.limit", st_collections_group_parts_part_description_limit}, {"collections.group.parts.part.description.align", st_collections_group_parts_part_description_align}, {"collections.group.parts.part.description.fixed", st_collections_group_parts_part_description_fixed}, {"collections.group.parts.part.description.min", st_collections_group_parts_part_description_min}, @@ -2258,7 +2260,6 @@ st_collections_group_inherit(void) Edje_Pack_Element_Parser *pitem; Edje_Part_Description_Common *ed, *ed2; Edje_List_Foreach_Data fdata; - Edje_String *es; Eina_List *l; char *parent_name; unsigned int i, j; @@ -4260,6 +4261,7 @@ ob_collections_group_parts_part_description(void) } ed->visible = 1; + ed->limit = 0; ed->align.x = FROM_DOUBLE(0.5); ed->align.y = FROM_DOUBLE(0.5); ed->min.w = 0; @@ -4673,6 +4675,42 @@ st_collections_group_parts_part_description_visible(void) current_desc->visible = parse_bool(0); } +/** + @page edcref + @property + limit + @parameters + [NONE, WIDTH, HEIGHT or BOTH] + @effect + Emit a signal when the part size change from zero or to a zero size + ('limit,width,over', 'limit,width,zero'). By default no signal are + emitted. + @endproperty +*/ +static void +st_collections_group_parts_part_description_limit(void) +{ + check_arg_count(1); + + current_desc->limit = parse_enum(0, + "NONE", 0, + "WIDTH", 1, + "HEIGHT", 2, + "BOTH", 3); + + if (current_desc->limit) + { + Edje_Part_Collection *pc; + int count; + + pc = eina_list_data_get(eina_list_last(edje_collections)); + count = pc->limits.parts_count++; + pc->limits.parts = realloc(pc->limits.parts, + pc->limits.parts_count * sizeof (Edje_Part_Limit)); + data_queue_part_lookup(pc, current_part->name, + &(pc->limits.parts[count].part)); + } +} /** @page edcref diff --git a/legacy/edje/src/lib/edje_calc.c b/legacy/edje/src/lib/edje_calc.c index 2ee79edd76..dd79b9d569 100644 --- a/legacy/edje/src/lib/edje_calc.c +++ b/legacy/edje/src/lib/edje_calc.c @@ -667,6 +667,79 @@ _edje_recalc_do(Edje *ed) edje_object_size_min_calc(ed->obj, &w, &h); evas_object_size_hint_min_set(ed->obj, w, h); } + + if (!ed->collection) return ; + + for (i = 0; i < ed->collection->limits.parts_count; i++) + { + const char *name; + unsigned char limit; + int part; + + name = ed->collection->parts[i]->name; + part = ed->collection->limits.parts[i].part; + limit = ed->table_parts[part]->chosen_description->limit; + switch (limit) + { + case 0: + ed->collection->limits.parts[i].width = 2; + ed->collection->limits.parts[i].height = 2; + break; + case 1: + ed->collection->limits.parts[i].height = 2; + break; + case 2: + ed->collection->limits.parts[i].width = 2; + break; + case 3: + break; + } + + if (limit | 1) + { + if (ed->table_parts[part]->w > 0 && + (ed->collection->limits.parts[i].width <= 0 || + ed->collection->limits.parts[i].width == 2)) + { + ed->collection->limits.parts[i].width = 1; + _edje_emit(ed, "limit,width,over", name); + } + else if (ed->table_parts[part]->w < 0 && + ed->collection->limits.parts[i].width >= 0) + { + ed->collection->limits.parts[i].width = -1; + _edje_emit(ed, "limit,width,below", name); + } + else if (ed->table_parts[part]->w == 0 && + ed->collection->limits.parts[i].width != 0) + { + ed->collection->limits.parts[i].width = 0; + _edje_emit(ed, "limit,width,zero", name); + } + } + if (limit | 2) + { + if (ed->table_parts[part]->h > 0 && + (ed->collection->limits.parts[i].height <= 0 || + ed->collection->limits.parts[i].height == 2)) + { + ed->collection->limits.parts[i].height = 1; + _edje_emit(ed, "limit,height,over", name); + } + else if (ed->table_parts[part]->h < 0 && + ed->collection->limits.parts[i].height >= 0) + { + ed->collection->limits.parts[i].height = -1; + _edje_emit(ed, "limit,height,beloh", name); + } + else if (ed->table_parts[part]->h == 0 && + ed->collection->limits.parts[i].height != 0) + { + ed->collection->limits.parts[i].height = 0; + _edje_emit(ed, "limit,height,zero", name); + } + } + } } void diff --git a/legacy/edje/src/lib/edje_data.c b/legacy/edje/src/lib/edje_data.c index cc46fbaed3..da3032905c 100644 --- a/legacy/edje/src/lib/edje_data.c +++ b/legacy/edje/src/lib/edje_data.c @@ -55,6 +55,7 @@ Eet_Data_Descriptor *_edje_edd_edje_part_description_external_pointer = NULL; Eet_Data_Descriptor *_edje_edd_edje_part_image_id = NULL; Eet_Data_Descriptor *_edje_edd_edje_part_image_id_pointer = NULL; Eet_Data_Descriptor *_edje_edd_edje_external_param = NULL; +Eet_Data_Descriptor *_edje_edd_edje_part_limit = NULL; #define EMP(Type, Minus) \ Eina_Mempool *_emp_##Type = NULL; \ @@ -218,6 +219,7 @@ _edje_edd_shutdown(void) FREED(_edje_edd_edje_external_param); FREED(_edje_edd_edje_image_directory_set); FREED(_edje_edd_edje_image_directory_set_entry); + FREED(_edje_edd_edje_part_limit); } #define EDJE_DEFINE_POINTER_TYPE(Type, Name) \ @@ -454,6 +456,7 @@ _edje_edd_init(void) 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_BASIC(Edd, Type, "fixed.w", fixed.w, EET_T_UCHAR); \ @@ -867,6 +870,11 @@ _edje_edd_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "api.name", api.name, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "api.description", api.description, EET_T_STRING); + EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Limit); + _edje_edd_edje_part_limit = eet_data_descriptor_file_new(&eddc); + + 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 = eet_data_descriptor_file_new(&eddc); @@ -884,6 +892,7 @@ _edje_edd_init(void) EDJE_DEFINE_POINTER_TYPE(Limit, limit); EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, Edje_Part_Collection, "limits.vertical", limits.vertical, _edje_edd_edje_limit_pointer); EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, Edje_Part_Collection, "limits.horizontal", limits.horizontal, _edje_edd_edje_limit_pointer); + EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, Edje_Part_Collection, "limits.parts", limits.parts, _edje_edd_edje_part_limit); EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_part_collection, Edje_Part_Collection, "data", data, _edje_edd_edje_string); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "id", id, EET_T_INT); diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h index 36c74e1295..2acdd6fab0 100644 --- a/legacy/edje/src/lib/edje_private.h +++ b/legacy/edje/src/lib/edje_private.h @@ -195,7 +195,7 @@ struct _Edje_Smart_Api /* increment this when you add new feature to edje file format without * breaking backward compatibility. */ -#define EDJE_FILE_MINOR 3 +#define EDJE_FILE_MINOR 4 /* FIXME: * @@ -321,6 +321,7 @@ typedef struct _Edje_Part_Description_Spec_Box Edje_Part_Description_Spec_ typedef struct _Edje_Part_Description_Spec_Table Edje_Part_Description_Spec_Table; typedef struct _Edje_Patterns Edje_Patterns; typedef struct _Edje_Part_Box_Animation Edje_Part_Box_Animation; +typedef struct _Edje_Part_Limit Edje_Part_Limit; typedef struct _Edje Edje; typedef struct _Edje_Real_Part_State Edje_Real_Part_State; @@ -726,6 +727,14 @@ struct _Edje_Pack_Element unsigned short colspan, rowspan; }; +struct _Edje_Part_Limit +{ + int part; + + signed char width; /* -1, 0 or 1 */ + signed char height; /* -1, 0, or 1 */ +}; + /*----------*/ struct _Edje_Part_Collection @@ -753,6 +762,9 @@ struct _Edje_Part_Collection Edje_Limit **horizontal; unsigned int horizontal_count; + + Edje_Part_Limit *parts; + unsigned int parts_count; } limits; Edje_Part **parts; /* an array of Edje_Part */ @@ -914,6 +926,7 @@ struct _Edje_Part_Description_Common } persp; unsigned char visible; /* is it shown */ + unsigned char limit; /* 0 == no, 1 = width, 2 = height, 3 = both */ }; struct _Edje_Part_Description_Spec_Fill