From 6f8b1c1b02e4b59da437e40acd2f3434e78d1c7a Mon Sep 17 00:00:00 2001 From: "m.biliavskyi" Date: Fri, 1 Nov 2013 11:17:24 +0900 Subject: [PATCH] edje: make functions "edje_edit_state_fill/aspect/align..." return Eina_Bool Make the following function return Eina_Bool so the caller can detect errors : List of updated functions: edje_edit_state_align_x_set edje_edit_state_align_y_set edje_edit_state_aspect_min_set edje_edit_state_aspect_max_set edje_edit_state_aspect_pref_set edje_edit_state_fill_origin_relative_x_set edje_edit_state_fill_origin_relative_y_set edje_edit_state_fill_origin_offset_x_set edje_edit_state_fill_origin_offset_y_set edje_edit_state_fill_size_relative_x_set edje_edit_state_fill_size_relative_y_set edje_edit_state_fill_size_offset_x_set edje_edit_state_fill_size_offset_y_set Reviewers: cedric, seoz Reviewed By: cedric CC: reutskiy.v.v Differential Revision: https://phab.enlightenment.org/D300 Signed-off-by: Cedric Bail --- src/lib/edje/Edje_Edit.h | 52 ++++++++++++++++++++++++++++++++++++------------ src/lib/edje/edje_edit.c | 33 ++++++++++++++++-------------- 2 files changed, 57 insertions(+), 28 deletions(-) diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index 10ad69f..2a2f5e1 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -1648,8 +1648,10 @@ EAPI double edje_edit_state_align_y_get(Evas_Object *obj, const char *part, cons * @param state The name of the state to get horizontal align (not including the state value). * @param value The state value. * @param align The new vertical align value. + * + * @return EINA_TRUE if the parameter was found, EINA_FALSE otherwise. */ -EAPI void edje_edit_state_align_x_set(Evas_Object *obj, const char *part, const char *state, double value, double align); +EAPI Eina_Bool edje_edit_state_align_x_set(Evas_Object *obj, const char *part, const char *state, double value, double align); /** Set the vertical align value of a part state. * @@ -1658,8 +1660,10 @@ EAPI void edje_edit_state_align_x_set(Evas_Object *obj, const char *part, const * @param state The name of the state to get vertical align (not including the state value). * @param value The state value. * @param align The new vertical align value. + * + * @return EINA_TRUE if the parameter was found, EINA_FALSE otherwise. */ -EAPI void edje_edit_state_align_y_set(Evas_Object *obj, const char *part, const char *state, double value, double align); +EAPI Eina_Bool edje_edit_state_align_y_set(Evas_Object *obj, const char *part, const char *state, double value, double align); /** Get the minimum width value of a part state. * @@ -1790,8 +1794,10 @@ EAPI double edje_edit_state_aspect_max_get(Evas_Object *obj, const char *part, c * @param state The name of the state to set minimum aspect (not including the state value). * @param value The state value. * @param aspect Minimum aspect value. + * + * @return EINA_TRUE if the parameter was found, EINA_FALSE otherwise. */ -EAPI void edje_edit_state_aspect_min_set(Evas_Object *obj, const char *part, const char *state, double value, double aspect); +EAPI Eina_Bool edje_edit_state_aspect_min_set(Evas_Object *obj, const char *part, const char *state, double value, double aspect); /** Set the maximum aspect value of a part state. * @@ -1800,8 +1806,10 @@ EAPI void edje_edit_state_aspect_min_set(Evas_Object *obj, const char *part, con * @param state The name of the state to set maximum aspect (not including the state value). * @param value The state value. * @param aspect Maximum aspect value. + * + * @return EINA_TRUE if the parameter was found, EINA_FALSE otherwise. */ -EAPI void edje_edit_state_aspect_max_set(Evas_Object *obj, const char *part, const char *state, double value, double aspect); +EAPI Eina_Bool edje_edit_state_aspect_max_set(Evas_Object *obj, const char *part, const char *state, double value, double aspect); /** Get the aspect preference of a part state. * @@ -1823,8 +1831,10 @@ EAPI unsigned char edje_edit_state_aspect_pref_get(Evas_Object *obj, const char * @param value The state value. * @param pref The aspect preference to set (0 = None, 1 = Vertical, 2 * = Horizontal, 3 = Both) + * + * @return EINA_TRUE if the parameter was found, EINA_FALSE otherwise. */ -EAPI void edje_edit_state_aspect_pref_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char pref); +EAPI Eina_Bool edje_edit_state_aspect_pref_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char pref); /** Get the fill horizontal origin relative value of a part state. * @@ -1877,8 +1887,10 @@ EAPI int edje_edit_state_fill_origin_offset_y_get(Evas_Object *obj, const char * * @param state The name of the state to set fill horizontal origin relative to area (not including the state value). * @param value The state value. * @param x The fill horizontal origin value. + * + * @return EINA_TRUE if the parameter was found, EINA_FALSE otherwise. */ -EAPI void edje_edit_state_fill_origin_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x); +EAPI Eina_Bool edje_edit_state_fill_origin_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x); /** Set the fill horizontal origin relative value of a part state. * @@ -1887,8 +1899,10 @@ EAPI void edje_edit_state_fill_origin_relative_x_set(Evas_Object *obj, const cha * @param state The name of the state to set fill vertical origin relative to area (not including the state value). * @param value The state value. * @param y The fill vertical origin value. + * + * @return EINA_TRUE if the parameter was found, EINA_FALSE otherwise. */ -EAPI void edje_edit_state_fill_origin_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y); +EAPI Eina_Bool edje_edit_state_fill_origin_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y); /** Set the fill horizontal origin offset value of a part state. * @@ -1897,8 +1911,10 @@ EAPI void edje_edit_state_fill_origin_relative_y_set(Evas_Object *obj, const cha * @param state The name of the state to set fill horizontal origin offset relative to area (not including the state value). * @param value The state value. * @param x The fill horizontal origin offset value. + * + * @return EINA_TRUE if the parameter was found, EINA_FALSE otherwise. */ -EAPI void edje_edit_state_fill_origin_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x); +EAPI Eina_Bool edje_edit_state_fill_origin_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x); /** Set the fill vertical origin offset value of a part state. * @@ -1907,8 +1923,10 @@ EAPI void edje_edit_state_fill_origin_offset_x_set(Evas_Object *obj, const char * @param state The name of the state to set fill vertical origin offset relative to area (not including the state value). * @param value The state value. * @param y The fill vertical origin offset value. + * + * @return EINA_TRUE if the parameter was found, EINA_FALSE otherwise. */ -EAPI void edje_edit_state_fill_origin_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y); +EAPI Eina_Bool edje_edit_state_fill_origin_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y); /** Get the fill horizontal size relative value of a part state. * @@ -1964,8 +1982,10 @@ EAPI int edje_edit_state_fill_size_offset_y_get(Evas_Object *obj, const char *pa * relative value (not including the state value). * @param value The state value. * @param x The horizontal size relative value. + * + * @return EINA_TRUE if the parameter was found, EINA_FALSE otherwise. */ -EAPI void edje_edit_state_fill_size_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x); +EAPI Eina_Bool edje_edit_state_fill_size_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x); /** Set the fill vertical size relative value of a part state. * @@ -1975,8 +1995,10 @@ EAPI void edje_edit_state_fill_size_relative_x_set(Evas_Object *obj, const char * relative value (not including the state value). * @param value The state value. * @param x The vertical size relative value. + * + * @return EINA_TRUE if the parameter was found, EINA_FALSE otherwise. */ -EAPI void edje_edit_state_fill_size_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double x); +EAPI Eina_Bool edje_edit_state_fill_size_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double x); /** Set the fill horizontal size offset value of a part state. * @@ -1986,8 +2008,10 @@ EAPI void edje_edit_state_fill_size_relative_y_set(Evas_Object *obj, const char * offset relative value (not including the state value). * @param value The state value. * @param x The horizontal size offset value. + * + * @return EINA_TRUE if the parameter was found, EINA_FALSE otherwise. */ -EAPI void edje_edit_state_fill_size_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x); +EAPI Eina_Bool edje_edit_state_fill_size_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x); /** Set the fill vertical size offset value of a part state. * @@ -1997,8 +2021,10 @@ EAPI void edje_edit_state_fill_size_offset_x_set(Evas_Object *obj, const char *p * relative value (not including the state value). * @param value The state value. * @param y The vertical size offset value. + * + * @return EINA_TRUE if the parameter was found, EINA_FALSE otherwise. */ -EAPI void edje_edit_state_fill_size_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y); +EAPI Eina_Bool edje_edit_state_fill_size_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y); /** Get the visibility of a part state. * diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 46ad74c..d75b55f 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -3357,12 +3357,13 @@ edje_edit_state_color3_set(Evas_Object *obj, const char *part, const char *state GET_PD_OR_RETURN(0); \ return TO_DOUBLE(pd->Class.Value); \ } \ - EAPI void \ + EAPI Eina_Bool \ edje_edit_state_##Class##_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \ { \ - GET_PD_OR_RETURN(); \ - pd->Class.Value = FROM_DOUBLE(v); \ + GET_PD_OR_RETURN(EINA_FALSE); \ + pd->Class.Value = FROM_DOUBLE(v); \ edje_object_calc_force(obj); \ + return EINA_TRUE; \ } #define FUNC_STATE_INT(Class, Value, Min) \ @@ -3421,10 +3422,10 @@ FUNC_STATE_DOUBLE(aspect, max); \ return 0; \ } \ - EAPI void \ + EAPI Eina_Bool \ edje_edit_state_fill_##Type##_relative_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \ { \ - GET_PD_OR_RETURN(); \ + GET_PD_OR_RETURN(EINA_FALSE); \ \ switch (rp->part->type) \ { \ @@ -3449,10 +3450,11 @@ FUNC_STATE_DOUBLE(aspect, max); break; \ } \ default: \ - return; \ + return EINA_FALSE; \ } \ \ edje_object_calc_force(obj); \ + return EINA_TRUE; \ } #define FUNC_STATE_INT_FILL(Class, Type, Value) \ @@ -3482,10 +3484,10 @@ FUNC_STATE_DOUBLE(aspect, max); } \ return 0; \ } \ - EAPI void \ + EAPI Eina_Bool \ edje_edit_state_fill_##Type##_offset_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \ { \ - GET_PD_OR_RETURN(); \ + GET_PD_OR_RETURN(EINA_FALSE); \ \ switch (rp->part->type) \ { \ @@ -3496,7 +3498,7 @@ FUNC_STATE_DOUBLE(aspect, max); img = (Edje_Part_Description_Image*) pd; \ \ img->image.fill.Class##abs_##Value = FROM_DOUBLE(v); \ - return; \ + break; \ } \ case EDJE_PART_TYPE_PROXY: \ { \ @@ -3505,13 +3507,14 @@ FUNC_STATE_DOUBLE(aspect, max); pro = (Edje_Part_Description_Proxy*) pd; \ \ pro->proxy.fill.Class##abs_##Value = FROM_DOUBLE(v); \ - return; \ + break; \ } \ default: \ - return; \ + return EINA_FALSE; \ } \ \ edje_object_calc_force(obj); \ + return EINA_TRUE; \ } FUNC_STATE_DOUBLE_FILL(pos_, origin, x); @@ -3556,13 +3559,13 @@ edje_edit_state_aspect_pref_get(Evas_Object *obj, const char *part, const char * return pd->aspect.prefer; } -EAPI void +EAPI Eina_Bool edje_edit_state_aspect_pref_set(Evas_Object *obj, const char *part, const char *state, double value, unsigned char pref) { - GET_PD_OR_RETURN(); - - //printf("SET ASPECT_PREF of state '%s' [to: %d]\n", state, pref); + GET_PD_OR_RETURN(EINA_FALSE); + if ((!pref) || (pref > 3)) return EINA_FALSE; pd->aspect.prefer = pref; + return EINA_TRUE; } EAPI const char* -- 2.7.4