From 036267c4f576f2687e75748b50d8bf43873bc110 Mon Sep 17 00:00:00 2001 From: Igor Gala Date: Tue, 17 Jun 2014 08:46:41 +0200 Subject: [PATCH] edje: Edje_Edit - add edje_edit_state_map_rotation_center_xet() Summary: There are new 'get and set' API for block 'map'. Those functions return or set part's name which is used as center for rotation. @feature Reviewers: seoz, cedric, raster, Hermet CC: reutskiy.v.v, cedric Differential Revision: https://phab.enlightenment.org/D1050 Signed-off-by: Cedric BAIL --- src/lib/edje/Edje_Edit.h | 27 +++++++++++++++++++++++++-- src/lib/edje/edje_edit.c | 26 +++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index 78b1fbdda9..11ae4af19d 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -3204,8 +3204,6 @@ EAPI Eina_Bool edje_edit_state_limit_set(Evas_Object *obj, const char *part, con */ EAPI unsigned char edje_edit_state_limit_get(Evas_Object *obj, const char *part, const char *state, double value); - - /** Get the part's name that is used as the 'light' for calculating the brightness. * * @param obj Object being edited. @@ -3233,7 +3231,32 @@ edje_edit_state_map_light_get(Evas_Object *obj, const char *part, const char *st EAPI Eina_Bool edje_edit_state_map_light_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source_part); +/** Get the part's name that is used as the center rotation. + * + * @param obj Object being edited. + * @param part The name of the part. + * @param state The name of the state (not including the state value). + * @param value The state value. + * + * @return The name of the source part that is used as center rotation. + * @since 1.11 + **/ +EAPI const char * +edje_edit_state_map_rotation_center_get(Evas_Object *obj, const char *part, const char *state, double value); +/** This sets the part that is used as the center of rotation when rotating the part with this description. If no center is given, the parts original center itself is used for the rotation center. + * + * @param obj Object being edited. + * @param part The name of the part. + * @param state The name of the state (not including the state value). + * @param value The state value. + * @param source_part The source part's name. + * + * @return EINA_TRUE in case of success, EINA_FALSE otherwise. + * @since 1.11 + **/ +EAPI Eina_Bool +edje_edit_state_map_rotation_center_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source_part); //@} /******************************************************************************/ diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 9c6a8f940f..94401f82eb 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -5649,7 +5649,6 @@ edje_edit_state_limit_get(Evas_Object *obj, const char *part, const char *state, } - EAPI const char * edje_edit_state_map_light_get(Evas_Object *obj, const char *part, const char *state, double value) { @@ -5664,6 +5663,20 @@ edje_edit_state_map_light_get(Evas_Object *obj, const char *part, const char *st return NULL; } +EAPI const char * +edje_edit_state_map_rotation_center_get(Evas_Object *obj, const char *part, const char *state, double value) +{ + Edje_Real_Part *erl; + + GET_PD_OR_RETURN(NULL); + + erl = ed->table_parts[pd->map.rot.id_center % ed->table_parts_size]; + if (erl->part->name) + return eina_stringshare_add(erl->part->name); + + return NULL; +} + EAPI Eina_Bool edje_edit_state_map_light_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source_part) { @@ -5676,6 +5689,17 @@ edje_edit_state_map_light_set(Evas_Object *obj, const char *part, const char *st return EINA_TRUE; } +EAPI Eina_Bool +edje_edit_state_map_rotation_center_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source_part) +{ + if (!source_part) return EINA_FALSE; + GET_PD_OR_RETURN(EINA_FALSE); + + pd->map.rot.id_center = _edje_part_id_find(ed, source_part); + + edje_object_calc_force(obj); + return EINA_TRUE; +} /**************/ /* TEXT API */