From b6be7dce1fec22cbdb83b6df07081e106384e0b1 Mon Sep 17 00:00:00 2001 From: raster Date: Sat, 4 Jun 2011 15:58:02 +0000 Subject: [PATCH] whover did table and box support forgot: 1. table to have min.h/v ability like box 2. to ACTUALLY implement box h/v (and well of course implement tableh/v too) this basically fixes this working at all and completes the feature to table too. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@59960 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/bin/edje_cc_handlers.c | 39 +++++++++++++++++++++++++++++++++++++++ src/lib/edje_calc.c | 37 +++++++++++++++++++++++++++++++++++++ src/lib/edje_data.c | 2 ++ src/lib/edje_private.h | 5 ++++- 4 files changed, 82 insertions(+), 1 deletion(-) diff --git a/src/bin/edje_cc_handlers.c b/src/bin/edje_cc_handlers.c index 3d8af0c..6534f99 100644 --- a/src/bin/edje_cc_handlers.c +++ b/src/bin/edje_cc_handlers.c @@ -214,6 +214,7 @@ static void st_collections_group_parts_part_description_box_min(void); static void st_collections_group_parts_part_description_table_homogeneous(void); static void st_collections_group_parts_part_description_table_align(void); static void st_collections_group_parts_part_description_table_padding(void); +static void st_collections_group_parts_part_description_table_min(void); static void st_collections_group_parts_part_description_map_perspective(void); static void st_collections_group_parts_part_description_map_light(void); static void st_collections_group_parts_part_description_map_rotation_center(void); @@ -470,6 +471,7 @@ New_Statement_Handler statement_handlers[] = {"collections.group.parts.part.description.table.homogeneous", st_collections_group_parts_part_description_table_homogeneous}, {"collections.group.parts.part.description.table.align", st_collections_group_parts_part_description_table_align}, {"collections.group.parts.part.description.table.padding", st_collections_group_parts_part_description_table_padding}, + {"collections.group.parts.part.description.table.min", st_collections_group_parts_part_description_table_min}, {"collections.group.parts.part.description.map.perspective", st_collections_group_parts_part_description_map_perspective}, {"collections.group.parts.part.description.map.light", st_collections_group_parts_part_description_map_light}, {"collections.group.parts.part.description.map.rotation.center", st_collections_group_parts_part_description_map_rotation_center}, @@ -6106,6 +6108,7 @@ st_collections_group_parts_part_description_box_min(void) homogeneous: TABLE; padding: 0 2; align: 0.5 0.5; + min: 0 0; } .. } @@ -6143,6 +6146,16 @@ st_collections_group_parts_part_description_box_min(void) @effect Sets the space between cells in pixels. Defaults to 0 0. @endproperty + + @property + min + @parameters + [horizontal] [vertical] + @effect + When any of the parameters is enabled (1) it forces the minimum size of + the table to be equal to the minimum size of the items. The default + value is "0 0". + @endproperty */ static void st_collections_group_parts_part_description_table_homogeneous(void) { @@ -6225,6 +6238,32 @@ static void st_collections_group_parts_part_description_table_padding(void) ed->table.padding.y = parse_int_range(1, 0, 0x7fffffff); } +static void +st_collections_group_parts_part_description_table_min(void) +{ + Edje_Part_Collection *pc; + Edje_Part *ep; + Edje_Part_Description_Table *ed; + + check_arg_count(2); + + pc = eina_list_data_get(eina_list_last(edje_collections)); + ep = pc->parts[pc->parts_count - 1]; + + if (ep->type != EDJE_PART_TYPE_TABLE) + { + ERR("%s: Error. parse error %s:%i. " + "box attributes in non-TABLE part.", + progname, file_in, line - 1); + exit(-1); + } + + ed = (Edje_Part_Description_Table*) ep->default_desc; + if (ep->other.desc_count) ed = (Edje_Part_Description_Table*) ep->other.desc[ep->other.desc_count - 1]; + + ed->table.min.h = parse_bool(0); + ed->table.min.v = parse_bool(1); +} /** @edcsection{description_map,Map state description sub blocks} diff --git a/src/lib/edje_calc.c b/src/lib/edje_calc.c index 5dff9d9..e174c6c 100644 --- a/src/lib/edje_calc.c +++ b/src/lib/edje_calc.c @@ -1543,6 +1543,43 @@ _edje_part_recalc_single(Edje *ed, _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); + + if ((ep->part->type == EDJE_PART_TYPE_TABLE) && + (((((Edje_Part_Description_Table *)chosen_desc)->table.min.h) || + (((Edje_Part_Description_Table *)chosen_desc)->table.min.v)))) + { + Evas_Coord lminw = 0, lminh = 0; + + evas_object_smart_need_recalculate_set(ep->object, 1); + evas_object_smart_calculate(ep->object); + evas_object_size_hint_min_get(ep->object, &lminw, &lminh); + if (((Edje_Part_Description_Table *)chosen_desc)->table.min.h) + { + if (lminw > minw) minw = lminw; + } + if (((Edje_Part_Description_Table *)chosen_desc)->table.min.v) + { + if (lminh > minh) minh = lminh; + } + } + else if ((ep->part->type == EDJE_PART_TYPE_BOX) && + ((((Edje_Part_Description_Box *)chosen_desc)->box.min.h) || + (((Edje_Part_Description_Box *)chosen_desc)->box.min.v))) + { + Evas_Coord lminw = 0, lminh = 0; + + evas_object_smart_need_recalculate_set(ep->object, 1); + evas_object_smart_calculate(ep->object); + evas_object_size_hint_min_get(ep->object, &lminw, &lminh); + if (((Edje_Part_Description_Box *)chosen_desc)->box.min.h) + { + if (lminw > minw) minw = lminw; + } + if (((Edje_Part_Description_Box *)chosen_desc)->box.min.v) + { + if (lminh > minh) minh = lminh; + } + } /* remember what our size is BEFORE we go limit it */ params->req.x = params->x; diff --git a/src/lib/edje_data.c b/src/lib/edje_data.c index cfd03a4..48559ba 100644 --- a/src/lib/edje_data.c +++ b/src/lib/edje_data.c @@ -665,6 +665,8 @@ _edje_edd_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.align.y", table.align.y, EDJE_T_FLOAT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.padding.x", table.padding.x, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.padding.y", table.padding.y, EET_T_INT); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.min.h", table.min.h, EET_T_UCHAR); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_table, Edje_Part_Description_Table, "table.min.v", table.min.v, EET_T_UCHAR); EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_External); eddc.func.mem_free = mem_free_external; diff --git a/src/lib/edje_private.h b/src/lib/edje_private.h index 2bd70e9..65c52e7 100644 --- a/src/lib/edje_private.h +++ b/src/lib/edje_private.h @@ -887,7 +887,7 @@ struct _Edje_Part_Description_Spec_Box int x, y; } padding; struct { - Eina_Bool h, v; + unsigned char h, v; } min; }; @@ -898,6 +898,9 @@ struct _Edje_Part_Description_Spec_Table struct { int x, y; } padding; + struct { + unsigned char h, v; + } min; }; struct _Edje_Part_Description_Image -- 2.7.4