diff --git a/legacy/edje/ChangeLog b/legacy/edje/ChangeLog index 0fc7f732e7..07c9f110d1 100644 --- a/legacy/edje/ChangeLog +++ b/legacy/edje/ChangeLog @@ -1,3 +1,7 @@ +2012-06-06 Leandro Pereira + + * Made state index optional (defaulting to 0.0). + 2011-01-29 Carsten Haitzler (The Rasterman) 1.0.0 release diff --git a/legacy/edje/NEWS b/legacy/edje/NEWS index fb4e059c8a..2f32496375 100644 --- a/legacy/edje/NEWS +++ b/legacy/edje/NEWS @@ -15,6 +15,7 @@ Additions: Improvements: * Allocate once and reuse Evas_Map. * Make edje_cc faster by improving the parser, mapping file in memory and using threads. + * Made state index optional in EDC files and Embryo scripts. Fixes: * Add missing files in the tarballs. diff --git a/legacy/edje/src/bin/edje_cc_handlers.c b/legacy/edje/src/bin/edje_cc_handlers.c index 0e2df501bb..b5e9bccb97 100644 --- a/legacy/edje/src/bin/edje_cc_handlers.c +++ b/legacy/edje/src/bin/edje_cc_handlers.c @@ -4348,7 +4348,7 @@ st_collections_group_parts_part_description_inherit(void) parent = parent_desc; if (!parent) { - check_arg_count(2); + check_min_arg_count(1); /* inherit may not be used in the default description */ if (!ep->other.desc_count) @@ -4361,7 +4361,10 @@ st_collections_group_parts_part_description_inherit(void) /* find the description that we inherit from */ parent_name = parse_str(0); - parent_val = parse_float_range(1, 0.0, 1.0); + if (get_arg_count() == 2) + parent_val = parse_float_range(1, 0.0, 1.0); + else + parent_val = 0.0; if (!strcmp (parent_name, "default") && parent_val == 0.0) parent = ep->default_desc; @@ -4594,7 +4597,7 @@ st_collections_group_parts_part_description_state(void) Edje_Part_Description_Common *ed; char *s; - check_arg_count(2); + check_min_arg_count(1); ep = current_part; @@ -4611,7 +4614,10 @@ st_collections_group_parts_part_description_state(void) } ed->state.name = s; - ed->state.value = parse_float_range(1, 0.0, 1.0); + if (get_arg_count() == 1) + ed->state.value = 0.0; + else + ed->state.value = parse_float_range(1, 0.0, 1.0); if (ed != ep->default_desc) { @@ -7597,7 +7603,10 @@ st_collections_group_programs_program_action(void) if (ep->action == EDJE_ACTION_TYPE_STATE_SET) { ep->state = parse_str(1); - ep->value = parse_float_range(2, 0.0, 1.0); + if (get_arg_count() == 1) + ep->value = 0.0; + else + ep->value = parse_float_range(2, 0.0, 1.0); } else if (ep->action == EDJE_ACTION_TYPE_SIGNAL_EMIT) { diff --git a/legacy/edje/src/lib/edje_embryo.c b/legacy/edje/src/lib/edje_embryo.c index 1ad23777c0..c390d5ee69 100644 --- a/legacy/edje/src/lib/edje_embryo.c +++ b/legacy/edje/src/lib/edje_embryo.c @@ -871,14 +871,19 @@ _edje_embryo_fn_set_state(Embryo_Program *ep, Embryo_Cell *params) double value = 0.0; Edje_Real_Part *rp; - CHKPARAM(3); + if (!HASNPARAMS(2) || !HASNPARAMS(3)) return -1; ed = embryo_program_data_get(ep); GETSTR(state, params[2]); if ((!state)) return 0; part_id = params[1]; if (part_id < 0) return 0; - f = EMBRYO_CELL_TO_FLOAT(params[3]); - value = (double)f; + if (HASNPARAMS(3)) + { + f = EMBRYO_CELL_TO_FLOAT(params[3]); + value = (double)f; + } + else + value = 0.0; rp = ed->table_parts[part_id % ed->table_parts_size]; if (rp) { diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h index 78f017fdb9..3defba1a20 100644 --- a/legacy/edje/src/lib/edje_private.h +++ b/legacy/edje/src/lib/edje_private.h @@ -1893,6 +1893,7 @@ void _edje_cache_file_unref(Edje_File *edf); void _edje_embryo_globals_init(Edje *ed); #define CHKPARAM(n) if (params[0] != (sizeof(Embryo_Cell) * (n))) return -1; +#define HASNPARAMS(n) (params[0] == (sizeof(Embryo_Cell) * (n))) #define GETSTR(str, par) { \ Embryo_Cell *___cptr; \ int ___l; \