edje: Edje_Edit - add API for program actions PLAY_SAMPLE and PLAY_TONE
authorAndrii Kroitor <an.kroitor@samsung.com>
Fri, 12 Dec 2014 03:33:26 +0000 (04:33 +0100)
committerCedric BAIL <cedric@osg.samsung.com>
Fri, 12 Dec 2014 03:33:30 +0000 (04:33 +0100)
Summary:
Added initialisation, deletion, getters and setters for following
programs fields: sample_name, speed, channel, tone_name, duration.

@feature

Reviewers: cedric, seoz, Hermet

Subscribers: cedric, reutskiy.v.v

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

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

index 35e7e6b..544ea07 100644 (file)
@@ -5952,6 +5952,101 @@ EAPI double edje_edit_program_transition_time_get(Evas_Object *obj, const char *
  */
 EAPI Eina_Bool edje_edit_program_transition_time_set(Evas_Object *obj, const char *prog, double seconds);
 
+/** Get sample name of the program.
+ *
+ * @param obj Object being edited.
+ * @param prog The name of the program.
+ *
+ * @return const char* sample_name on success, NULL otherwise.
+ */
+EAPI const char * edje_edit_program_sample_name_get(Evas_Object *obj, const char *prog);
+
+/** Set sample name of the program.
+ *
+ * @param obj Object being edited.
+ * @param prog The name of the program.
+ * @param name The name of the sample.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ */
+EAPI Eina_Bool edje_edit_program_sample_name_set(Evas_Object *obj, const char *prog, const char *name);
+
+/** Get tone name of the program.
+ *
+ * @param obj Object being edited.
+ * @param prog The name of the program.
+ *
+ * @return const char* tone_name on success, NULL otherwise.
+ */
+EAPI const char * edje_edit_program_tone_name_get(Evas_Object *obj, const char *prog);
+
+/** Set tone name of the program.
+ *
+ * @param obj Object being edited.
+ * @param prog The name of the program.
+ * @param name The name of the tone.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ */
+EAPI Eina_Bool edje_edit_program_tone_name_set(Evas_Object *obj, const char *prog, const char *name);
+
+/** Get sample speed of the program.
+ *
+ * @param obj Object being edited.
+ * @param prog The name of the program.
+ *
+ * @return double speed on success, -1 otherwise.
+ */
+EAPI double edje_edit_program_sample_speed_get(Evas_Object *obj, const char *prog);
+
+/** Set sample speed of the program.
+ *
+ * @param obj Object being edited.
+ * @param prog The name of the program.
+ * @param speed New speed value.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ */
+EAPI Eina_Bool edje_edit_program_sample_speed_set(Evas_Object *obj, const char *prog, double speed);
+
+/** Get tone duration of the program.
+ *
+ * @param obj Object being edited.
+ * @param prog The name of the program.
+ *
+ * @return double duration on success, -1 otherwise.
+ */
+EAPI double edje_edit_program_tone_duration_get(Evas_Object *obj, const char *prog);
+
+/** Set tone duration of the program.
+ *
+ * @param obj Object being edited.
+ * @param prog The name of the program.
+ * @param duration New duration value.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ */
+EAPI Eina_Bool edje_edit_program_tone_duration_set(Evas_Object *obj, const char *prog, double duration);
+
+/** Get sample channel of the program.
+ *
+ * @param obj Object being edited.
+ * @param prog The name of the program.
+ *
+ * @return channel on success, 0 otherwise.
+ */
+EAPI unsigned char edje_edit_program_channel_get(Evas_Object *obj, const char *prog);
+
+/** Set sample channel of the program.
+ *
+ * @param obj Object being edited.
+ * @param prog The name of the program.
+ * @param channel New channel value.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
+ */
+EAPI Eina_Bool edje_edit_program_channel_set(Evas_Object *obj, const char *prog, Edje_Channel channel);
+
 /** Get filter part name of the program.
  *
  * @param obj Object being edited.
index 12d6e51..c4e8252 100644 (file)
@@ -8040,7 +8040,11 @@ edje_edit_program_add(Evas_Object *obj, const char *name)
    epr->tween.time = ZERO;
    epr->targets = NULL;
    epr->after = NULL;
-
+   epr->sample_name = NULL;
+   epr->speed = 1.0;
+   epr->channel = EDJE_CHANNEL_EFFECT;
+   epr->tone_name = NULL;
+   epr->duration = 0.1;
 
    //Update table_programs
    ed->collection->patterns.table_programs_size++;
@@ -8125,6 +8129,8 @@ edje_edit_program_del(Evas_Object *obj, const char *prog)
    _edje_if_string_free(ed, epr->filter.state);
    _edje_if_string_free(ed, epr->state);
    _edje_if_string_free(ed, epr->state2);
+   _edje_if_string_free(ed, epr->sample_name);
+   _edje_if_string_free(ed, epr->tone_name);
 
    EINA_LIST_FREE(epr->targets, prt)
      free(prt);
@@ -8302,6 +8308,110 @@ edje_edit_program_source_set(Evas_Object *obj, const char *prog, const char *sou
 }
 
 EAPI const char *
+edje_edit_program_sample_name_get(Evas_Object *obj, const char *prog)
+{
+   GET_EPR_OR_RETURN(NULL);
+
+   if (!epr->sample_name) return NULL;
+   return eina_stringshare_add(epr->sample_name);
+}
+
+EAPI Eina_Bool
+edje_edit_program_sample_name_set(Evas_Object *obj, const char *prog, const char *name)
+{
+   GET_ED_OR_RETURN(EINA_FALSE);
+   GET_EPR_OR_RETURN(EINA_FALSE);
+
+   if (!name) return EINA_FALSE;
+
+   _edje_if_string_free(ed, epr->sample_name);
+   epr->sample_name = eina_stringshare_add(name);
+
+   return EINA_TRUE;
+}
+
+EAPI const char *
+edje_edit_program_tone_name_get(Evas_Object *obj, const char *prog)
+{
+   GET_EPR_OR_RETURN(NULL);
+
+   if (!epr->tone_name) return NULL;
+   return eina_stringshare_add(epr->tone_name);
+}
+
+EAPI Eina_Bool
+edje_edit_program_tone_name_set(Evas_Object *obj, const char *prog, const char *name)
+{
+   GET_ED_OR_RETURN(EINA_FALSE);
+   GET_EPR_OR_RETURN(EINA_FALSE);
+
+   if (!name) return EINA_FALSE;
+
+   _edje_if_string_free(ed, epr->tone_name);
+   epr->tone_name = eina_stringshare_add(name);
+
+   return EINA_TRUE;
+}
+
+EAPI double
+edje_edit_program_sample_speed_get(Evas_Object *obj, const char *prog)
+{
+   GET_EPR_OR_RETURN(-1);
+
+   return epr->speed;
+}
+
+EAPI Eina_Bool
+edje_edit_program_sample_speed_set(Evas_Object *obj, const char *prog, double speed)
+{
+   GET_EPR_OR_RETURN(EINA_FALSE);
+
+   if (speed < 0) return EINA_FALSE;
+
+   epr->speed = speed;
+
+   return EINA_TRUE;
+}
+
+EAPI double
+edje_edit_program_tone_duration_get(Evas_Object *obj, const char *prog)
+{
+   GET_EPR_OR_RETURN(-1);
+
+   return epr->duration;
+}
+
+EAPI Eina_Bool
+edje_edit_program_tone_duration_set(Evas_Object *obj, const char *prog, double duration)
+{
+   GET_EPR_OR_RETURN(EINA_FALSE);
+
+   if (duration < 0) return EINA_FALSE;
+
+   epr->duration = duration;
+
+   return EINA_TRUE;
+}
+
+EAPI unsigned char
+edje_edit_program_channel_get(Evas_Object *obj, const char *prog)
+{
+   GET_EPR_OR_RETURN(0);
+
+   return epr->channel;
+}
+
+EAPI Eina_Bool
+edje_edit_program_channel_set(Evas_Object *obj, const char *prog, Edje_Channel channel)
+{
+   GET_EPR_OR_RETURN(EINA_FALSE);
+
+   epr->channel = channel;
+
+   return EINA_TRUE;
+}
+
+EAPI const char *
 edje_edit_program_filter_part_get(Evas_Object *obj, const char *prog)
 {
    GET_EPR_OR_RETURN(NULL);