cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=8ae41a547b8f4c918de17fe889123f34d2d34ce1
commit 8ae41a547b8f4c918de17fe889123f34d2d34ce1 Author: Kateryna Fesyna <k.fes...@samsung.com> Date: Mon Jun 16 16:55:21 2014 +0200 edje: Edje_Edit - add functions that allow user to set and get value of fill type Summary: This commit contains two new functions for setting and getting value of fill type of IMAGE and PROXY parts: edje_edit_state_fill_type_get() and edje_edit_state_fill_type_set() Also with this commit printing of not default value of fill type (TILE) on generation of edc code is added. Reviewers: cedric, Hermet, seoz, raster CC: reutskiy.v.v, cedric Differential Revision: https://phab.enlightenment.org/D1044 Signed-off-by: Cedric BAIL <c.b...@partner.samsung.com> --- src/lib/edje/Edje_Edit.h | 39 ++++++++++++++++++++++++++++++ src/lib/edje/edje_edit.c | 58 ++++++++++++++++++++++++++++++++++++++++++++- src/lib/edje/edje_private.h | 3 ++- 3 files changed, 98 insertions(+), 2 deletions(-) diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index c8f5122..6a282e2 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -2579,6 +2579,45 @@ edje_edit_state_fill_smooth_get(Evas_Object *obj, const char *part, const char * EAPI Eina_Bool edje_edit_state_fill_smooth_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool smooth); +/** Get the fill type property for given part state. + * + * @param obj Object being edited. + * @param part Part that contain state. + * @param state The name of the state. + * @param value The state value. + * + * @return The value that represents fill type: 0 for SCALE or 1 for TILE. In case of error (for example, if part type does not match) returns 2. + * @see edje_edit_state_fill_type_set() + * @since 1.11 + */ +EAPI unsigned char edje_edit_state_fill_type_get(Evas_Object *obj, const char *part, const char *state, double value); + + +/** Set the fill type property for given part state. + * + * Sets the image fill type. The available types are: + * <dl> + * <dt>SCALE</dt> + * <dd>image will be scaled accordingly to the 'relative' and 'offset' params values from 'origin' and 'size' blocks.</dd> + * <dt>TILE</dt> + * <dd>image will be tiled accordingly to the 'relative' and 'offset' params values from 'origin' and 'size' blocks.</dd> + * </dl> + * <b>Important</b>: the part parameter 'min' must be set, it's size of tiled image. + * If parameter 'max' is set tiled area will be resized accordingly to the 'max' values of part. + * The default value of fill type is SCALE. + * + * @param obj Object being edited. + * @param part Part that contain state. + * @param state The name of the state. + * @param value The state value. + * @param fill_type The value that represents fill type: 0 for SCALE or 1 for TILE. + * + * @return EINA_TRUE in case of success, EINA_FALSE otherwise. + * @see edje_edit_state_fill_type_get() + * @since 1.11 + */ +EAPI Eina_Bool edje_edit_state_fill_type_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char fill_type); + /** Get the fill horizontal origin relative value of a part state. * * @param obj Object being edited. diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index aabb975..6b3e5c2 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -4853,6 +4853,58 @@ edje_edit_state_fill_smooth_set(Evas_Object *obj, const char *part, const char * return EINA_FALSE; } +EAPI Eina_Bool +edje_edit_state_fill_type_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char fill_type) +{ + GET_PD_OR_RETURN(EINA_FALSE) + if (fill_type >= EDJE_FILL_TYPE_LAST) + 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.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; + } + } + + return EINA_FALSE; +} + +EAPI unsigned char +edje_edit_state_fill_type_get(Evas_Object *obj, const char *part, const char *state, double value) +{ + GET_PD_OR_RETURN(EDJE_FILL_TYPE_LAST) + + 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; + } + case EDJE_PART_TYPE_PROXY: + { + 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) \ @@ -8953,7 +9005,8 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s 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.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) @@ -8981,6 +9034,7 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s BUF_APPENDF(I7"offset: %d %d;\n", img->image.fill.abs_x, img->image.fill.abs_y); BUF_APPEND(I6"}\n"); } + BUF_APPEND(I6"type: TILE;\n"); BUF_APPEND(I5"}\n"); } @@ -9021,6 +9075,8 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s 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"); BUF_APPEND(I5"}\n"); } diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 54fe09a..bf2fd64 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -1804,7 +1804,8 @@ struct _Edje_Message typedef enum _Edje_Fill { EDJE_FILL_TYPE_SCALE = 0, - EDJE_FILL_TYPE_TILE + EDJE_FILL_TYPE_TILE = 1, + EDJE_FILL_TYPE_LAST = 2 } Edje_Fill; typedef enum _Edje_Match_Error --