edje_cc: fix inheriting script from other group

Summary:
If a group inherits from the other, group script block is copied
only when there are program script blocks in parent group.
This patch makes edje_cc always copies group script block,
but allows to override group script block in child group.
The content of reverted D3799 is included. That reveals this inconsistency.

Reviewers: cedric

Subscribers: Jaehyun_Cho, woohyun, jpeg

Differential Revision: https://phab.enlightenment.org/D3802
This commit is contained in:
Jee-Yong Um 2016-03-18 13:30:55 +09:00 committed by Jean-Philippe Andre
parent b8f682b842
commit 4a63c917aa
1 changed files with 19 additions and 7 deletions

View File

@ -163,6 +163,7 @@ static Edje_Part_Description_Common *parent_desc = NULL;
static Edje_Program *current_program = NULL;
static Eina_List *current_program_lookups = NULL;
Eina_Bool current_group_inherit = EINA_FALSE;
Eina_Bool script_override = EINA_TRUE;
static Edje_Program *sequencing = NULL;
static Eina_List *sequencing_lookups = NULL;
@ -3874,8 +3875,8 @@ ob_collections_group(void)
current_part = NULL;
current_desc = NULL;
current_group_inherit = EINA_FALSE;
script_override = EINA_FALSE;
current_de = mem_alloc(SZ(Edje_Part_Collection_Directory_Entry));
current_de->id = eina_list_count(edje_collections);
@ -4438,6 +4439,11 @@ st_collections_group_inherit(void)
cd2 = eina_list_nth(codes, de->id);
cd = eina_list_data_get(eina_list_last(codes));
cd->is_lua = cd2->is_lua;
cd->shared = STRDUP(cd2->shared);
cd->original = STRDUP(cd2->original);
script_override = EINA_TRUE;
EINA_LIST_FOREACH(cd2->programs, l, cp2)
{
cp = mem_alloc(SZ(Code_Program));
@ -4446,9 +4452,6 @@ st_collections_group_inherit(void)
cp->l2 = cp2->l2;
cp->script = STRDUP(cp2->script);
cp->original = STRDUP(cp2->original);
cd->is_lua = cd2->is_lua;
cd->shared = STRDUP(cd2->shared);
cd->original = STRDUP(cd2->original);
cd->programs = eina_list_append(cd->programs, cp);
data_queue_copied_anonymous_lookup(pc, &(cp2->id), &(cp->id));
}
@ -4785,9 +4788,18 @@ ob_collections_group_script(void)
cd->l2 = get_verbatim_line2();
if (cd->shared)
{
ERR("parse error %s:%i. There is already an existing script section for the group",
file_in, line - 1);
exit(-1);
if (script_override)
{
free(cd->shared);
free(cd->original);
script_override = EINA_FALSE;
}
else
{
ERR("parse error %s:%i. There is already an existing script section for the group",
file_in, line - 1);
exit(-1);
}
}
cd->shared = s;
cd->original = strdup(s);