edje: make functions return Eina_Bool and fix documentation.
authorVorobiov Vitalii <vi.vorobiov@samsung.com>
Thu, 31 Oct 2013 02:05:42 +0000 (11:05 +0900)
committerCedric Bail <cedric.bail@samsung.com>
Thu, 31 Oct 2013 02:05:45 +0000 (11:05 +0900)
Make the following functions return Eina_Bool so the caller can detect errors:
edje_edit_state_font_set
edje_edit_part_effect_set

Also deleted duplicate of the "edje_edit_state_font_set" function in Edje_Edit.h
Moved some defines (EDJE_TEXT_EFFECT_MASK_BASIC, EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION etc),
so doxygen generation was fixed.
Also added link (see also) in "edje_edit_part_effect_set" to the Edje_Text_Effect enum.

Reviewers: cedric, seoz

CC: reutskiy.v.v
Differential Revision: https://phab.enlightenment.org/D302

Signed-off-by: Cedric Bail <cedric.bail@samsung.com>
src/lib/edje/Edje_Common.h
src/lib/edje/Edje_Edit.h
src/lib/edje/edje_edit.c

index 8ae1e57..8e72b75 100644 (file)
@@ -1211,11 +1211,16 @@ typedef enum _Edje_Part_Type
  * @{
  */
 
-typedef enum _Edje_Text_Effect
-{
 #define EDJE_TEXT_EFFECT_MASK_BASIC 0xf
 #define EDJE_TEXT_EFFECT_BASIC_SET(x, s) \
    do { x = ((x) & ~EDJE_TEXT_EFFECT_MASK_BASIC) | (s); } while (0)
+
+#define EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION (0x7 << 4)
+#define EDJE_TEXT_EFFECT_SHADOW_DIRECTION_SET(x, s) \
+   do { x = ((x) & ~EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION) | (s); } while (0)
+
+typedef enum _Edje_Text_Effect
+{
    EDJE_TEXT_EFFECT_NONE                = 0,
    EDJE_TEXT_EFFECT_PLAIN               = 1,
    EDJE_TEXT_EFFECT_OUTLINE             = 2,
@@ -1230,9 +1235,6 @@ typedef enum _Edje_Text_Effect
 
    EDJE_TEXT_EFFECT_LAST                = 11,
 
-#define EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION (0x7 << 4)
-#define EDJE_TEXT_EFFECT_SHADOW_DIRECTION_SET(x, s) \
-   do { x = ((x) & ~EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION) | (s); } while (0)
    EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_RIGHT = (0x0 << 4),
    EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM       = (0x1 << 4),
    EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_LEFT  = (0x2 << 4),
index efd7055..77dfff9 100644 (file)
@@ -908,12 +908,17 @@ EAPI Eina_Bool edje_edit_part_source_set(Evas_Object *obj, const char *part, con
 EAPI Edje_Text_Effect edje_edit_part_effect_get(Evas_Object *obj, const char *part);
 
 /** Set the effect for a given part.
+ * Effects and shadow directions can be combined.
+ *
+ * For effect and shadow direction list please look at Edje Part Text ref page.
  *
  * @param obj Object being edited.
  * @param part Part to set the effect to. Only makes sense on type TEXT.
  * @param effect Effect to set for the part.
+ *
+ * @see Edje_Part_Text
  */
-EAPI void edje_edit_part_effect_set(Evas_Object *obj, const char *part, Edje_Text_Effect effect);
+EAPI Eina_Bool edje_edit_part_effect_set(Evas_Object *obj, const char *part, Edje_Text_Effect effect);
 
 /** Get the current selected state in part.
  *
@@ -2254,8 +2259,10 @@ EAPI const char * edje_edit_state_font_get(Evas_Object *obj, const char *part, c
  * @param state State in which the font is set.
  * @param value Value of the state.
  * @param font The font name to use.
+ *
+ * @return EINA_TRUE if successful, EINA_FALSE - otherwise.
  */
-EAPI void edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font);
+EAPI Eina_Bool edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font);
 
 /** Get the text size of a part state
  *
@@ -2561,17 +2568,6 @@ EAPI const char *edje_edit_font_path_get(Evas_Object *obj, const char *alias);
  */
 EAPI const char * edje_edit_state_font_get(Evas_Object *obj, const char *part, const char *state, double value);
 
-/** Set font name for a given part state.
- *
- * @param obj Object being edited.
- * @param part Part that contain state.
- * @param state The name of the state to set the name of the font that will be used (not including the state value).
- * @param value The state value.
- * @param font The name of the font to use in the given part state.
- */
-EAPI void edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font);
-
-
 //@}
 /******************************************************************************/
 /**************************   IMAGES API   ************************************/
index 6cc37b2..34dfb45 100644 (file)
@@ -4262,16 +4262,18 @@ edje_edit_state_font_get(Evas_Object *obj, const char *part, const char *state,
    return eina_stringshare_add(edje_string_get(&txt->text.font));
 }
 
-EAPI void
+EAPI Eina_Bool
 edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font)
 {
    Edje_Part_Description_Text *txt;
 
-   GET_PD_OR_RETURN();
+   if ((!obj) || (!part) || (!state))
+     return EINA_FALSE;
+   GET_PD_OR_RETURN(EINA_FALSE);
 
    if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
        (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
-     return;
+     return EINA_FALSE;
 
    txt = (Edje_Part_Description_Text*) pd;
 
@@ -4280,6 +4282,7 @@ edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state,
    txt->text.font.id = 0;
 
    edje_object_calc_force(obj);
+   return EINA_TRUE;
 }
 
 EAPI Edje_Text_Effect
@@ -4291,15 +4294,19 @@ edje_edit_part_effect_get(Evas_Object *obj, const char *part)
    return rp->part->effect;
 }
 
-EAPI void
+EAPI Eina_Bool
 edje_edit_part_effect_set(Evas_Object *obj, const char *part, Edje_Text_Effect effect)
 {
-   GET_RP_OR_RETURN();
+   if ((!obj) || (!part)) return EINA_FALSE;
+   GET_RP_OR_RETURN(EINA_FALSE);
 
-   //printf("SET EFFECT of part: %s [%d]\n", part, effect);
+   if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
+       (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+     return EINA_FALSE;
    rp->part->effect = effect;
 
    edje_object_calc_force(obj);
+   return EINA_TRUE;
 }
 
 /****************/