edje: Make state index optional
This shouldn't break stuff, just make things easier. Think of all that lost time " 0.0". Not anymore. Not even in Embryo scripts. Indexes should only be provided when you need them (which is quite rare). Note that if you use ``set_state("new state")'' in your Embryo scripts, the produced .edj files will be incompatible with older versions of Edje. This backwards incompatibility only applies to Embryo scripts; edje_cc will generate a ``0.0'' value if the index is omitted from state declarations and programs. Sachiel said this patch was OK; our benevolent release manager acked as well. Blame them if this breaks stuff. SVN revision: 73424
This commit is contained in:
parent
99621b948a
commit
7ee848bc33
|
@ -1,3 +1,7 @@
|
||||||
|
2012-06-06 Leandro Pereira
|
||||||
|
|
||||||
|
* Made state index optional (defaulting to 0.0).
|
||||||
|
|
||||||
2011-01-29 Carsten Haitzler (The Rasterman)
|
2011-01-29 Carsten Haitzler (The Rasterman)
|
||||||
|
|
||||||
1.0.0 release
|
1.0.0 release
|
||||||
|
|
|
@ -15,6 +15,7 @@ Additions:
|
||||||
Improvements:
|
Improvements:
|
||||||
* Allocate once and reuse Evas_Map.
|
* Allocate once and reuse Evas_Map.
|
||||||
* Make edje_cc faster by improving the parser, mapping file in memory and using threads.
|
* 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:
|
Fixes:
|
||||||
* Add missing files in the tarballs.
|
* Add missing files in the tarballs.
|
||||||
|
|
|
@ -4348,7 +4348,7 @@ st_collections_group_parts_part_description_inherit(void)
|
||||||
parent = parent_desc;
|
parent = parent_desc;
|
||||||
if (!parent)
|
if (!parent)
|
||||||
{
|
{
|
||||||
check_arg_count(2);
|
check_min_arg_count(1);
|
||||||
|
|
||||||
/* inherit may not be used in the default description */
|
/* inherit may not be used in the default description */
|
||||||
if (!ep->other.desc_count)
|
if (!ep->other.desc_count)
|
||||||
|
@ -4361,7 +4361,10 @@ st_collections_group_parts_part_description_inherit(void)
|
||||||
|
|
||||||
/* find the description that we inherit from */
|
/* find the description that we inherit from */
|
||||||
parent_name = parse_str(0);
|
parent_name = parse_str(0);
|
||||||
|
if (get_arg_count() == 2)
|
||||||
parent_val = parse_float_range(1, 0.0, 1.0);
|
parent_val = parse_float_range(1, 0.0, 1.0);
|
||||||
|
else
|
||||||
|
parent_val = 0.0;
|
||||||
|
|
||||||
if (!strcmp (parent_name, "default") && parent_val == 0.0)
|
if (!strcmp (parent_name, "default") && parent_val == 0.0)
|
||||||
parent = ep->default_desc;
|
parent = ep->default_desc;
|
||||||
|
@ -4594,7 +4597,7 @@ st_collections_group_parts_part_description_state(void)
|
||||||
Edje_Part_Description_Common *ed;
|
Edje_Part_Description_Common *ed;
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
check_arg_count(2);
|
check_min_arg_count(1);
|
||||||
|
|
||||||
ep = current_part;
|
ep = current_part;
|
||||||
|
|
||||||
|
@ -4611,6 +4614,9 @@ st_collections_group_parts_part_description_state(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
ed->state.name = s;
|
ed->state.name = s;
|
||||||
|
if (get_arg_count() == 1)
|
||||||
|
ed->state.value = 0.0;
|
||||||
|
else
|
||||||
ed->state.value = parse_float_range(1, 0.0, 1.0);
|
ed->state.value = parse_float_range(1, 0.0, 1.0);
|
||||||
|
|
||||||
if (ed != ep->default_desc)
|
if (ed != ep->default_desc)
|
||||||
|
@ -7597,6 +7603,9 @@ st_collections_group_programs_program_action(void)
|
||||||
if (ep->action == EDJE_ACTION_TYPE_STATE_SET)
|
if (ep->action == EDJE_ACTION_TYPE_STATE_SET)
|
||||||
{
|
{
|
||||||
ep->state = parse_str(1);
|
ep->state = parse_str(1);
|
||||||
|
if (get_arg_count() == 1)
|
||||||
|
ep->value = 0.0;
|
||||||
|
else
|
||||||
ep->value = parse_float_range(2, 0.0, 1.0);
|
ep->value = parse_float_range(2, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
else if (ep->action == EDJE_ACTION_TYPE_SIGNAL_EMIT)
|
else if (ep->action == EDJE_ACTION_TYPE_SIGNAL_EMIT)
|
||||||
|
|
|
@ -871,14 +871,19 @@ _edje_embryo_fn_set_state(Embryo_Program *ep, Embryo_Cell *params)
|
||||||
double value = 0.0;
|
double value = 0.0;
|
||||||
Edje_Real_Part *rp;
|
Edje_Real_Part *rp;
|
||||||
|
|
||||||
CHKPARAM(3);
|
if (!HASNPARAMS(2) || !HASNPARAMS(3)) return -1;
|
||||||
ed = embryo_program_data_get(ep);
|
ed = embryo_program_data_get(ep);
|
||||||
GETSTR(state, params[2]);
|
GETSTR(state, params[2]);
|
||||||
if ((!state)) return 0;
|
if ((!state)) return 0;
|
||||||
part_id = params[1];
|
part_id = params[1];
|
||||||
if (part_id < 0) return 0;
|
if (part_id < 0) return 0;
|
||||||
|
if (HASNPARAMS(3))
|
||||||
|
{
|
||||||
f = EMBRYO_CELL_TO_FLOAT(params[3]);
|
f = EMBRYO_CELL_TO_FLOAT(params[3]);
|
||||||
value = (double)f;
|
value = (double)f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
value = 0.0;
|
||||||
rp = ed->table_parts[part_id % ed->table_parts_size];
|
rp = ed->table_parts[part_id % ed->table_parts_size];
|
||||||
if (rp)
|
if (rp)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1893,6 +1893,7 @@ void _edje_cache_file_unref(Edje_File *edf);
|
||||||
void _edje_embryo_globals_init(Edje *ed);
|
void _edje_embryo_globals_init(Edje *ed);
|
||||||
|
|
||||||
#define CHKPARAM(n) if (params[0] != (sizeof(Embryo_Cell) * (n))) return -1;
|
#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) { \
|
#define GETSTR(str, par) { \
|
||||||
Embryo_Cell *___cptr; \
|
Embryo_Cell *___cptr; \
|
||||||
int ___l; \
|
int ___l; \
|
||||||
|
|
Loading…
Reference in New Issue