edje: Edje_Edit - add edje_edit_program_transition_state_set
authorAndrii Kroitor <an.kroitor@samsung.com>
Fri, 12 Sep 2014 21:02:31 +0000 (23:02 +0200)
committerCedric BAIL <cedric@osg.samsung.com>
Fri, 12 Sep 2014 21:04:53 +0000 (23:04 +0200)
Summary:
Set parts into intermediate state of programs transition.
0.0 represents the start state, 1.0 - the final state. Other values will set
parts to an intermediate state taking into account programs transition type.

Reviewers: seoz, Hermet, cedric

Reviewed By: cedric

Subscribers: cedric, reutskiy.v.v

Differential Revision: https://phab.enlightenment.org/D1435

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

index 55b68ce..d9600d7 100644 (file)
@@ -5444,6 +5444,18 @@ EAPI Eina_Bool edje_edit_program_run(Evas_Object *obj, const char *prog);
  */
 EAPI Eina_Bool edje_edit_program_stop_all(Evas_Object *obj);
 
+/** Set parts into intermediate state of programs transition.
+ *
+ * @param obj Object being edited.
+ * @param prog The name of the program to use. Program should have action STATE_SET.
+ * @param pos State of transition to be setted. Value from 0.0 to 1.0.
+ * 0.0 represents the start state, 1.0 - the final state. Other values will set
+ * parts to an intermediate state taking into account programs transition type.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ */
+EAPI Eina_Bool edje_edit_program_transition_state_set(Evas_Object *obj, const char *prog, double pos);
+
 /** Set a new name for the given program
  *
  * @param obj Object being edited.
index d8c8cc4..3aec4bc 100644 (file)
@@ -8117,6 +8117,44 @@ edje_edit_program_stop_all(Evas_Object *obj)
 }
 
 EAPI Eina_Bool
+edje_edit_program_transition_state_set(Evas_Object *obj, const char *prog, double position)
+{
+   Edje_Program_Target *pt;
+   Edje_Real_Part *rp;
+   Eina_List *l;
+
+   GET_ED_OR_RETURN(EINA_FALSE);
+   GET_EPR_OR_RETURN(EINA_FALSE);
+   if (position < 0 || position > 1) return EINA_FALSE;
+   if (epr->action != EDJE_ACTION_TYPE_STATE_SET) return EINA_FALSE;
+
+   EINA_LIST_FOREACH(epr->targets, l, pt)
+     {
+        if (pt->id >= 0)
+          {
+             rp = ed->table_parts[pt->id % ed->table_parts_size];
+             if (rp)
+               {
+                  _edje_part_description_apply(ed, rp,
+                                               rp->param1.description->state.name,
+                                               rp->param1.description->state.value,
+                                               epr->state,
+                                               epr->value);
+                  _edje_part_pos_set(ed, rp,
+                                     epr->tween.mode, position,
+                                     epr->tween.v1,
+                                     epr->tween.v2,
+                                     epr->tween.v3,
+                                     epr->tween.v4);
+               }
+          }
+     }
+   _edje_recalc(ed);
+
+   return EINA_TRUE;
+}
+
+EAPI Eina_Bool
 edje_edit_program_name_set(Evas_Object *obj, const char *prog, const char* new_name)
 {
    GET_EED_OR_RETURN(EINA_FALSE);