cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=a06279e4eff9b4f02c1d1b16caff496239d32390

commit a06279e4eff9b4f02c1d1b16caff496239d32390
Author: Kateryna Fesyna <[email protected]>
Date:   Fri Jun 13 17:54:52 2014 +0200

    edje: Edje_Edit - add functions to provide the ability to set and get the 
values of step parameter in parts state description
    
    Summary:
    This commit contains two new functions that provide the ability to set and
    get the values of step parameter in parts state description. Also the 
printing of step value
    on code generation is added.
    
    Reviewers: cedric, Hermet, seoz, raster
    
    CC: reutskiy.v.v, cedric
    
    Differential Revision: https://phab.enlightenment.org/D1032
    
    Signed-off-by: Cedric BAIL <[email protected]>
---
 src/lib/edje/Edje_Edit.h | 35 +++++++++++++++++++++++++++++++++++
 src/lib/edje/edje_edit.c | 21 ++++++++++++++++++++-
 2 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h
index 02f3719..7eeb8b6 100644
--- a/src/lib/edje/Edje_Edit.h
+++ b/src/lib/edje/Edje_Edit.h
@@ -2773,6 +2773,41 @@ EAPI Eina_Bool 
edje_edit_state_external_param_string_set(Evas_Object *obj, const
  */
 EAPI Eina_Bool edje_edit_state_external_param_choice_set(Evas_Object *obj, 
const char *part, const char *state, double value, const char *param, const 
char *val);
 
+/** Set the states step parameter values.
+ *
+ * Step parameter restricts resizing of each dimension to values divisibles by
+ * its value. This causes the part to jump from value to value while resizing.
+ * The default value is "0 0" disabling stepping.
+ *
+ * @param obj Object being edited.
+ * @param part Part that contain state.
+ * @param state The name of the state to set fill horizontal size
+ * relative value (not including the state value).
+ * @param value The state value.
+ * @param x The horizontal step value.
+ * @param y The vertical step value.
+ *
+ * @return EINA_TRUE in case of success, EINA_FALSE otherwise.
+ * @see edje_edit_state_step_get()
+ */
+EAPI Eina_Bool edje_edit_state_step_set(Evas_Object *obj, const char *part, 
const char *state, double value, int step_x, int step_y);
+
+/** Get the states step values.
+ *
+ * @param obj Object being edited.
+ * @param part Part that contain state.
+ * @param state The name of the state to set fill horizontal size
+ * relative value (not including the state value).
+ * @param value The state value.
+ * @param x The pointer to the variable where horizontal step value should be 
written.
+ * @param y The pointer to the variable where vertical step value should be 
written.
+ *
+ * @return EINA_TRUE in case of success, EINA_FALSE otherwise.
+ * @see edje_edit_state_step_set()
+ */
+EAPI Eina_Bool
+edje_edit_state_step_get(Evas_Object *obj, const char *part, const char 
*state, double value, int *step_x, int *step_y);
+
 
 //@}
 
/******************************************************************************/
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 216bd15..1d0409a 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -5166,6 +5166,24 @@ edje_edit_state_external_param_choice_set(Evas_Object 
*obj, const char *part, co
    return edje_edit_state_external_param_set(obj, part, state, value, param, 
EDJE_EXTERNAL_PARAM_TYPE_CHOICE, val);
 }
 
+EAPI Eina_Bool
+edje_edit_state_step_set(Evas_Object *obj, const char *part, const char 
*state, double value, int step_x, int step_y)
+{
+   GET_PD_OR_RETURN(EINA_FALSE);
+   pd->step.x = step_x;
+   pd->step.y = step_y;
+   return EINA_TRUE;
+}
+
+EAPI Eina_Bool
+edje_edit_state_step_get(Evas_Object *obj, const char *part, const char 
*state, double value, int *step_x, int *step_y)
+{
+   GET_PD_OR_RETURN(EINA_FALSE);
+   if (step_x) *step_x = (int)pd->step.x;
+   if (step_y) *step_y = (int)pd->step.y;
+   return EINA_TRUE;
+}
+
 /**************/
 /*  TEXT API */
 /**************/
@@ -8586,7 +8604,8 @@ _edje_generate_source_of_state(Evas_Object *obj, const 
char *part, const char *s
    if (pd->minmul.w != 0 || pd->minmul.h != 0)
      BUF_APPENDF(I5"minmul: %g %g;\n", TO_DOUBLE(pd->minmul.w), 
TO_DOUBLE(pd->minmul.h));
 
-   //TODO Support step
+   if (pd->step.x && pd->step.y)
+     BUF_APPENDF(I5"step: %d %d;\n", TO_INT(pd->step.x), TO_INT(pd->step.y));
 
    if (pd->aspect.min || pd->aspect.max)
       BUF_APPENDF(I5"aspect: %g %g;\n", TO_DOUBLE(pd->aspect.min), 
TO_DOUBLE(pd->aspect.max));

-- 


Reply via email to