diff options
author | jiin.moon <jiin.moon@samsung.com> | 2015-06-22 17:56:08 +0200 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2015-06-22 17:56:15 +0200 |
commit | 6487a26354f0e11a9c7dd74d2923e7d2466dcc34 (patch) | |
tree | 37d6db73be1570d34cac367fb40b6acde7cfbae2 /src/bin/edje | |
parent | 8b621775619b9959fe952b095b3baaa7aaa99572 (diff) |
edje: add support to control the transition time of edje animation globally.
Summary:
Add the transition scale flag and the transtion scale value.
This flag can be change using "transition_scale_enable" in edje program.
If flag is true, the transition scale value affect the transition speed of edje
The transition scale value can be change by elm_config.
@feature
Test Plan: elementary_config
Reviewers: Hermet, cedric
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D2287
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/bin/edje')
-rw-r--r-- | src/bin/edje/edje_cc.h | 1 | ||||
-rw-r--r-- | src/bin/edje/edje_cc_handlers.c | 174 | ||||
-rw-r--r-- | src/bin/edje/edje_cc_parse.c | 12 |
3 files changed, 99 insertions, 88 deletions
diff --git a/src/bin/edje/edje_cc.h b/src/bin/edje/edje_cc.h index 6b1e16c24a..3e25e69bb2 100644 --- a/src/bin/edje/edje_cc.h +++ b/src/bin/edje/edje_cc.h | |||
@@ -247,6 +247,7 @@ Eina_Bool edje_cc_handlers_wildcard(void); | |||
247 | void edje_cc_handlers_hierarchy_alloc(void); | 247 | void edje_cc_handlers_hierarchy_alloc(void); |
248 | void edje_cc_handlers_hierarchy_free(void); | 248 | void edje_cc_handlers_hierarchy_free(void); |
249 | void edje_cc_handlers_pop_notify(const char *token); | 249 | void edje_cc_handlers_pop_notify(const char *token); |
250 | int get_param_index(char *str); | ||
250 | 251 | ||
251 | /* global vars */ | 252 | /* global vars */ |
252 | extern Eina_List *ext_dirs; | 253 | extern Eina_List *ext_dirs; |
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c index 7b3efd4402..6a294cb0a8 100644 --- a/src/bin/edje/edje_cc_handlers.c +++ b/src/bin/edje/edje_cc_handlers.c | |||
@@ -1570,6 +1570,7 @@ _edje_program_copy(Edje_Program *ep, Edje_Program *ep2) | |||
1570 | ep->tween.v2 = ep2->tween.v2; | 1570 | ep->tween.v2 = ep2->tween.v2; |
1571 | ep->tween.v3 = ep2->tween.v3; | 1571 | ep->tween.v3 = ep2->tween.v3; |
1572 | ep->tween.v4 = ep2->tween.v4; | 1572 | ep->tween.v4 = ep2->tween.v4; |
1573 | ep->tween.use_duration_factor = ep2->tween.use_duration_factor; | ||
1573 | ep->sample_name = STRDUP(ep2->sample_name); | 1574 | ep->sample_name = STRDUP(ep2->sample_name); |
1574 | ep->tone_name = STRDUP(ep2->tone_name); | 1575 | ep->tone_name = STRDUP(ep2->tone_name); |
1575 | ep->duration = ep2->duration; | 1576 | ep->duration = ep2->duration; |
@@ -12002,6 +12003,7 @@ ob_collections_group_programs_program(void) | |||
12002 | ep = mem_alloc(SZ(Edje_Program_Parser)); | 12003 | ep = mem_alloc(SZ(Edje_Program_Parser)); |
12003 | ep->id = -1; | 12004 | ep->id = -1; |
12004 | ep->tween.mode = EDJE_TWEEN_MODE_LINEAR; | 12005 | ep->tween.mode = EDJE_TWEEN_MODE_LINEAR; |
12006 | ep->tween.use_duration_factor = EINA_FALSE; | ||
12005 | ep->after = NULL; | 12007 | ep->after = NULL; |
12006 | epp = (Edje_Program_Parser *)ep; | 12008 | epp = (Edje_Program_Parser *)ep; |
12007 | epp->can_override = EINA_FALSE; | 12009 | epp->can_override = EINA_FALSE; |
@@ -12486,7 +12488,8 @@ st_collections_group_programs_program_action(void) | |||
12486 | static void | 12488 | static void |
12487 | st_collections_group_programs_program_transition(void) | 12489 | st_collections_group_programs_program_transition(void) |
12488 | { | 12490 | { |
12489 | char *tmp = NULL; | 12491 | int current = -1, index = -1; |
12492 | unsigned int required_args = 0; | ||
12490 | 12493 | ||
12491 | check_min_arg_count(2); | 12494 | check_min_arg_count(2); |
12492 | 12495 | ||
@@ -12522,106 +12525,101 @@ st_collections_group_programs_program_transition(void) | |||
12522 | "SPRING", EDJE_TWEEN_MODE_SPRING, | 12525 | "SPRING", EDJE_TWEEN_MODE_SPRING, |
12523 | NULL); | 12526 | NULL); |
12524 | current_program->tween.time = FROM_DOUBLE(parse_float_range(1, 0.0, 999999999.0)); | 12527 | current_program->tween.time = FROM_DOUBLE(parse_float_range(1, 0.0, 999999999.0)); |
12525 | if ((current_program->tween.mode >= EDJE_TWEEN_MODE_LINEAR) && | 12528 | |
12526 | (current_program->tween.mode <= EDJE_TWEEN_MODE_DECELERATE)) | 12529 | //Check the index of params not related to tweenmode's param |
12530 | //This index use for count of the tweenmode's param | ||
12531 | if ((index = get_param_index("USE_DURATION_FACTOR")) != -1) | ||
12527 | { | 12532 | { |
12528 | tmp = NULL; | 12533 | current_program->tween.use_duration_factor = parse_bool(index + 1); |
12529 | if ((get_arg_count() == 3) && (!strcmp((tmp = parse_str(2)), "CURRENT"))) | 12534 | required_args += 2; |
12530 | { | ||
12531 | free(tmp); | ||
12532 | current_program->tween.mode |= EDJE_TWEEN_MODE_OPT_FROM_CURRENT; | ||
12533 | } | ||
12534 | else if (get_arg_count() != 2) | ||
12535 | { | ||
12536 | free(tmp); | ||
12537 | ERR("parse error %s:%i. Need 2rd parameter to set time", | ||
12538 | file_in, line - 1); | ||
12539 | exit(-1); | ||
12540 | } | ||
12541 | } | 12535 | } |
12542 | // the following need v1 | 12536 | if ((current = get_param_index("CURRENT")) != -1) |
12543 | // EDJE_TWEEN_MODE_ACCELERATE_FACTOR | ||
12544 | // EDJE_TWEEN_MODE_DECELERATE_FACTOR | ||
12545 | // EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR | ||
12546 | // current_program->tween.v1 | ||
12547 | else if ((current_program->tween.mode >= EDJE_TWEEN_MODE_ACCELERATE_FACTOR) && | ||
12548 | (current_program->tween.mode <= EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR)) | ||
12549 | { | 12537 | { |
12550 | tmp = NULL; | 12538 | if (index == -1 || current < index) |
12551 | if ((get_arg_count() == 4) && (!strcmp((tmp = parse_str(3)), "CURRENT"))) | 12539 | index = current; |
12552 | { | 12540 | required_args++; |
12553 | free(tmp); | ||
12554 | current_program->tween.mode |= EDJE_TWEEN_MODE_OPT_FROM_CURRENT; | ||
12555 | } | ||
12556 | else if (get_arg_count() != 3) | ||
12557 | { | ||
12558 | free(tmp); | ||
12559 | ERR("parse error %s:%i. Need 3rd parameter to set factor", | ||
12560 | file_in, line - 1); | ||
12561 | exit(-1); | ||
12562 | } | ||
12563 | current_program->tween.v1 = FROM_DOUBLE(parse_float_range(2, 0.0, 999999999.0)); | ||
12564 | } | ||
12565 | // the followjng also need v2 | ||
12566 | // EDJE_TWEEN_MODE_DIVISOR_INTERP | ||
12567 | // EDJE_TWEEN_MODE_BOUNCE | ||
12568 | // EDJE_TWEEN_MODE_SPRING | ||
12569 | // current_program->tween.v2 | ||
12570 | else if ((current_program->tween.mode >= EDJE_TWEEN_MODE_DIVISOR_INTERP) && | ||
12571 | (current_program->tween.mode <= EDJE_TWEEN_MODE_SPRING)) | ||
12572 | { | ||
12573 | tmp = NULL; | ||
12574 | if ((get_arg_count() == 5) && (!strcmp((tmp = parse_str(4)), "CURRENT"))) | ||
12575 | { | ||
12576 | free(tmp); | ||
12577 | current_program->tween.mode |= EDJE_TWEEN_MODE_OPT_FROM_CURRENT; | ||
12578 | } | ||
12579 | else if (get_arg_count() != 4) | ||
12580 | { | ||
12581 | free(tmp); | ||
12582 | ERR("parse error %s:%i. " | ||
12583 | "Need 3rd and 4th parameters to set factor and counts", | ||
12584 | file_in, line - 1); | ||
12585 | exit(-1); | ||
12586 | } | ||
12587 | current_program->tween.v1 = FROM_DOUBLE(parse_float_range(2, 0.0, 999999999.0)); | ||
12588 | current_program->tween.v2 = FROM_DOUBLE(parse_float_range(3, 0.0, 999999999.0)); | ||
12589 | } | 12541 | } |
12590 | else if (current_program->tween.mode == EDJE_TWEEN_MODE_CUBIC_BEZIER) | 12542 | switch(current_program->tween.mode) |
12591 | { | 12543 | { |
12592 | tmp = NULL; | 12544 | case EDJE_TWEEN_MODE_LINEAR: |
12593 | if ((get_arg_count() == 7) && (!strcmp((tmp = parse_str(4)), "CURRENT"))) | 12545 | case EDJE_TWEEN_MODE_SINUSOIDAL: |
12546 | case EDJE_TWEEN_MODE_ACCELERATE: | ||
12547 | case EDJE_TWEEN_MODE_DECELERATE: | ||
12594 | { | 12548 | { |
12595 | free(tmp); | 12549 | required_args += 2; |
12596 | current_program->tween.mode |= EDJE_TWEEN_MODE_OPT_FROM_CURRENT; | 12550 | check_arg_count(required_args); |
12597 | } | 12551 | } |
12598 | else if (get_arg_count() != 6) | 12552 | break; |
12553 | |||
12554 | // the following need v1 | ||
12555 | case EDJE_TWEEN_MODE_ACCELERATE_FACTOR: | ||
12556 | case EDJE_TWEEN_MODE_DECELERATE_FACTOR: | ||
12557 | case EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR: | ||
12599 | { | 12558 | { |
12600 | free(tmp); | 12559 | required_args += 3; |
12601 | ERR("parse error %s:%i. " | 12560 | check_arg_count(required_args); |
12602 | "Need 3rd, 4th, 5th and 6th parameters to set x1, y1, x2 and y2", | 12561 | if (index == -1 || index > 2) |
12603 | file_in, line - 1); | 12562 | { |
12604 | exit(-1); | 12563 | current_program->tween.v1 = |
12564 | FROM_DOUBLE(parse_float_range(2, -999999999.0, 999999999.0)); | ||
12565 | break; | ||
12566 | } | ||
12567 | else | ||
12568 | { | ||
12569 | ERR("parse error %s:%i. Need 3rd parameter to set factor", | ||
12570 | file_in, line - 1); | ||
12571 | exit(-1); | ||
12572 | } | ||
12605 | } | 12573 | } |
12606 | current_program->tween.v1 = | 12574 | case EDJE_TWEEN_MODE_DIVISOR_INTERP: |
12607 | FROM_DOUBLE(parse_float_range(2, -999999999.0, 999999999.0)); | 12575 | case EDJE_TWEEN_MODE_BOUNCE: |
12608 | current_program->tween.v2 = | 12576 | case EDJE_TWEEN_MODE_SPRING: |
12609 | FROM_DOUBLE(parse_float_range(3, -999999999.0, 999999999.0)); | ||
12610 | if (get_arg_count() == 7) | ||
12611 | { | 12577 | { |
12612 | current_program->tween.v3 = | 12578 | required_args += 4; |
12613 | FROM_DOUBLE(parse_float_range(5, -999999999.0, 999999999.0)); | 12579 | check_arg_count(required_args); |
12614 | current_program->tween.v4 = | 12580 | if (index == -1 || index > 3) |
12615 | FROM_DOUBLE(parse_float_range(6, -999999999.0, 999999999.0)); | 12581 | { |
12582 | current_program->tween.v1 = | ||
12583 | FROM_DOUBLE(parse_float_range(2, -999999999.0, 999999999.0)); | ||
12584 | current_program->tween.v2 = | ||
12585 | FROM_DOUBLE(parse_float_range(3, -999999999.0, 999999999.0)); | ||
12586 | break; | ||
12587 | } | ||
12588 | else | ||
12589 | { | ||
12590 | ERR("parse error %s:%i. " | ||
12591 | "Need 3rd and 4th parameters to set factor and counts", | ||
12592 | file_in, line - 1); | ||
12593 | exit(-1); | ||
12594 | } | ||
12616 | } | 12595 | } |
12617 | else | 12596 | case EDJE_TWEEN_MODE_CUBIC_BEZIER: |
12618 | { | 12597 | { |
12619 | current_program->tween.v3 = | 12598 | required_args += 6; |
12620 | FROM_DOUBLE(parse_float_range(4, -999999999.0, 999999999.0)); | 12599 | check_arg_count(required_args); |
12621 | current_program->tween.v4 = | 12600 | if (index == -1 || index > 5) |
12622 | FROM_DOUBLE(parse_float_range(5, -999999999.0, 999999999.0)); | 12601 | { |
12602 | current_program->tween.v1 = | ||
12603 | FROM_DOUBLE(parse_float_range(2, -999999999.0, 999999999.0)); | ||
12604 | current_program->tween.v2 = | ||
12605 | FROM_DOUBLE(parse_float_range(3, -999999999.0, 999999999.0)); | ||
12606 | current_program->tween.v3 = | ||
12607 | FROM_DOUBLE(parse_float_range(4, -999999999.0, 999999999.0)); | ||
12608 | current_program->tween.v4 = | ||
12609 | FROM_DOUBLE(parse_float_range(5, -999999999.0, 999999999.0)); | ||
12610 | break; | ||
12611 | } | ||
12612 | else | ||
12613 | { | ||
12614 | ERR("parse error %s:%i. " | ||
12615 | "Need 3rd, 4th, 5th and 6th parameters to set x1, y1, x2 and y2", | ||
12616 | file_in, line - 1); | ||
12617 | exit(-1); | ||
12618 | } | ||
12623 | } | 12619 | } |
12624 | } | 12620 | } |
12621 | if (current > 0) | ||
12622 | current_program->tween.mode |= EDJE_TWEEN_MODE_OPT_FROM_CURRENT; | ||
12625 | } | 12623 | } |
12626 | 12624 | ||
12627 | static void | 12625 | static void |
diff --git a/src/bin/edje/edje_cc_parse.c b/src/bin/edje/edje_cc_parse.c index b87afb08ac..6327e8e3ba 100644 --- a/src/bin/edje/edje_cc_parse.c +++ b/src/bin/edje/edje_cc_parse.c | |||
@@ -1815,3 +1815,15 @@ strstrip(const char *in, char *out, size_t size) | |||
1815 | *out = '\0'; | 1815 | *out = '\0'; |
1816 | return 1; | 1816 | return 1; |
1817 | } | 1817 | } |
1818 | |||
1819 | int | ||
1820 | get_param_index(char *str) | ||
1821 | { | ||
1822 | int index ; | ||
1823 | for(index = 0; index < get_arg_count(); index++) | ||
1824 | { | ||
1825 | if(!strcmp(str,_parse_param_get(index))) | ||
1826 | return index; | ||
1827 | } | ||
1828 | return -1; | ||
1829 | } | ||