summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorAndrii Kroitor <an.kroitor@samsung.com>2014-12-12 04:33:26 +0100
committerCedric BAIL <cedric@osg.samsung.com>2014-12-12 04:33:30 +0100
commitd2d35a66b49ea80bde0b49f0ae755f1ca562fa05 (patch)
tree2838f3fd458f6cfa15a2ae8eca34eebf3d5e9313 /src/lib
parent9792943910fedb834c7ec61f92a17a0810248bc7 (diff)
edje: Edje_Edit - add API for program actions PLAY_SAMPLE and PLAY_TONE
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>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/edje/Edje_Edit.h95
-rw-r--r--src/lib/edje/edje_edit.c112
2 files changed, 206 insertions, 1 deletions
diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h
index 35e7e6b83d..544ea07e8f 100644
--- a/src/lib/edje/Edje_Edit.h
+++ b/src/lib/edje/Edje_Edit.h
@@ -5952,6 +5952,101 @@ EAPI double edje_edit_program_transition_time_get(Evas_Object *obj, const char *
5952 */ 5952 */
5953EAPI Eina_Bool edje_edit_program_transition_time_set(Evas_Object *obj, const char *prog, double seconds); 5953EAPI Eina_Bool edje_edit_program_transition_time_set(Evas_Object *obj, const char *prog, double seconds);
5954 5954
5955/** Get sample name of the program.
5956 *
5957 * @param obj Object being edited.
5958 * @param prog The name of the program.
5959 *
5960 * @return const char* sample_name on success, NULL otherwise.
5961 */
5962EAPI const char * edje_edit_program_sample_name_get(Evas_Object *obj, const char *prog);
5963
5964/** Set sample name of the program.
5965 *
5966 * @param obj Object being edited.
5967 * @param prog The name of the program.
5968 * @param name The name of the sample.
5969 *
5970 * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
5971 */
5972EAPI Eina_Bool edje_edit_program_sample_name_set(Evas_Object *obj, const char *prog, const char *name);
5973
5974/** Get tone name of the program.
5975 *
5976 * @param obj Object being edited.
5977 * @param prog The name of the program.
5978 *
5979 * @return const char* tone_name on success, NULL otherwise.
5980 */
5981EAPI const char * edje_edit_program_tone_name_get(Evas_Object *obj, const char *prog);
5982
5983/** Set tone name of the program.
5984 *
5985 * @param obj Object being edited.
5986 * @param prog The name of the program.
5987 * @param name The name of the tone.
5988 *
5989 * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
5990 */
5991EAPI Eina_Bool edje_edit_program_tone_name_set(Evas_Object *obj, const char *prog, const char *name);
5992
5993/** Get sample speed of the program.
5994 *
5995 * @param obj Object being edited.
5996 * @param prog The name of the program.
5997 *
5998 * @return double speed on success, -1 otherwise.
5999 */
6000EAPI double edje_edit_program_sample_speed_get(Evas_Object *obj, const char *prog);
6001
6002/** Set sample speed of the program.
6003 *
6004 * @param obj Object being edited.
6005 * @param prog The name of the program.
6006 * @param speed New speed value.
6007 *
6008 * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
6009 */
6010EAPI Eina_Bool edje_edit_program_sample_speed_set(Evas_Object *obj, const char *prog, double speed);
6011
6012/** Get tone duration of the program.
6013 *
6014 * @param obj Object being edited.
6015 * @param prog The name of the program.
6016 *
6017 * @return double duration on success, -1 otherwise.
6018 */
6019EAPI double edje_edit_program_tone_duration_get(Evas_Object *obj, const char *prog);
6020
6021/** Set tone duration of the program.
6022 *
6023 * @param obj Object being edited.
6024 * @param prog The name of the program.
6025 * @param duration New duration value.
6026 *
6027 * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
6028 */
6029EAPI Eina_Bool edje_edit_program_tone_duration_set(Evas_Object *obj, const char *prog, double duration);
6030
6031/** Get sample channel of the program.
6032 *
6033 * @param obj Object being edited.
6034 * @param prog The name of the program.
6035 *
6036 * @return channel on success, 0 otherwise.
6037 */
6038EAPI unsigned char edje_edit_program_channel_get(Evas_Object *obj, const char *prog);
6039
6040/** Set sample channel of the program.
6041 *
6042 * @param obj Object being edited.
6043 * @param prog The name of the program.
6044 * @param channel New channel value.
6045 *
6046 * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
6047 */
6048EAPI Eina_Bool edje_edit_program_channel_set(Evas_Object *obj, const char *prog, Edje_Channel channel);
6049
5955/** Get filter part name of the program. 6050/** Get filter part name of the program.
5956 * 6051 *
5957 * @param obj Object being edited. 6052 * @param obj Object being edited.
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 12d6e51dce..c4e82524fa 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -8040,7 +8040,11 @@ edje_edit_program_add(Evas_Object *obj, const char *name)
8040 epr->tween.time = ZERO; 8040 epr->tween.time = ZERO;
8041 epr->targets = NULL; 8041 epr->targets = NULL;
8042 epr->after = NULL; 8042 epr->after = NULL;
8043 8043 epr->sample_name = NULL;
8044 epr->speed = 1.0;
8045 epr->channel = EDJE_CHANNEL_EFFECT;
8046 epr->tone_name = NULL;
8047 epr->duration = 0.1;
8044 8048
8045 //Update table_programs 8049 //Update table_programs
8046 ed->collection->patterns.table_programs_size++; 8050 ed->collection->patterns.table_programs_size++;
@@ -8125,6 +8129,8 @@ edje_edit_program_del(Evas_Object *obj, const char *prog)
8125 _edje_if_string_free(ed, epr->filter.state); 8129 _edje_if_string_free(ed, epr->filter.state);
8126 _edje_if_string_free(ed, epr->state); 8130 _edje_if_string_free(ed, epr->state);
8127 _edje_if_string_free(ed, epr->state2); 8131 _edje_if_string_free(ed, epr->state2);
8132 _edje_if_string_free(ed, epr->sample_name);
8133 _edje_if_string_free(ed, epr->tone_name);
8128 8134
8129 EINA_LIST_FREE(epr->targets, prt) 8135 EINA_LIST_FREE(epr->targets, prt)
8130 free(prt); 8136 free(prt);
@@ -8302,6 +8308,110 @@ edje_edit_program_source_set(Evas_Object *obj, const char *prog, const char *sou
8302} 8308}
8303 8309
8304EAPI const char * 8310EAPI const char *
8311edje_edit_program_sample_name_get(Evas_Object *obj, const char *prog)
8312{
8313 GET_EPR_OR_RETURN(NULL);
8314
8315 if (!epr->sample_name) return NULL;
8316 return eina_stringshare_add(epr->sample_name);
8317}
8318
8319EAPI Eina_Bool
8320edje_edit_program_sample_name_set(Evas_Object *obj, const char *prog, const char *name)
8321{
8322 GET_ED_OR_RETURN(EINA_FALSE);
8323 GET_EPR_OR_RETURN(EINA_FALSE);
8324
8325 if (!name) return EINA_FALSE;
8326
8327 _edje_if_string_free(ed, epr->sample_name);
8328 epr->sample_name = eina_stringshare_add(name);
8329
8330 return EINA_TRUE;
8331}
8332
8333EAPI const char *
8334edje_edit_program_tone_name_get(Evas_Object *obj, const char *prog)
8335{
8336 GET_EPR_OR_RETURN(NULL);
8337
8338 if (!epr->tone_name) return NULL;
8339 return eina_stringshare_add(epr->tone_name);
8340}
8341
8342EAPI Eina_Bool
8343edje_edit_program_tone_name_set(Evas_Object *obj, const char *prog, const char *name)
8344{
8345 GET_ED_OR_RETURN(EINA_FALSE);
8346 GET_EPR_OR_RETURN(EINA_FALSE);
8347
8348 if (!name) return EINA_FALSE;
8349
8350 _edje_if_string_free(ed, epr->tone_name);
8351 epr->tone_name = eina_stringshare_add(name);
8352
8353 return EINA_TRUE;
8354}
8355
8356EAPI double
8357edje_edit_program_sample_speed_get(Evas_Object *obj, const char *prog)
8358{
8359 GET_EPR_OR_RETURN(-1);
8360
8361 return epr->speed;
8362}
8363
8364EAPI Eina_Bool
8365edje_edit_program_sample_speed_set(Evas_Object *obj, const char *prog, double speed)
8366{
8367 GET_EPR_OR_RETURN(EINA_FALSE);
8368
8369 if (speed < 0) return EINA_FALSE;
8370
8371 epr->speed = speed;
8372
8373 return EINA_TRUE;
8374}
8375
8376EAPI double
8377edje_edit_program_tone_duration_get(Evas_Object *obj, const char *prog)
8378{
8379 GET_EPR_OR_RETURN(-1);
8380
8381 return epr->duration;
8382}
8383
8384EAPI Eina_Bool
8385edje_edit_program_tone_duration_set(Evas_Object *obj, const char *prog, double duration)
8386{
8387 GET_EPR_OR_RETURN(EINA_FALSE);
8388
8389 if (duration < 0) return EINA_FALSE;
8390
8391 epr->duration = duration;
8392
8393 return EINA_TRUE;
8394}
8395
8396EAPI unsigned char
8397edje_edit_program_channel_get(Evas_Object *obj, const char *prog)
8398{
8399 GET_EPR_OR_RETURN(0);
8400
8401 return epr->channel;
8402}
8403
8404EAPI Eina_Bool
8405edje_edit_program_channel_set(Evas_Object *obj, const char *prog, Edje_Channel channel)
8406{
8407 GET_EPR_OR_RETURN(EINA_FALSE);
8408
8409 epr->channel = channel;
8410
8411 return EINA_TRUE;
8412}
8413
8414EAPI const char *
8305edje_edit_program_filter_part_get(Evas_Object *obj, const char *prog) 8415edje_edit_program_filter_part_get(Evas_Object *obj, const char *prog)
8306{ 8416{
8307 GET_EPR_OR_RETURN(NULL); 8417 GET_EPR_OR_RETURN(NULL);