summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2014-03-22 02:18:54 -0400
committerMike Blumenkrantz <zmike@samsung.com>2014-03-22 02:20:09 -0400
commitf3d5cee0e4260c5b7287eef37fba687551b4d6ed (patch)
tree0d067ca10e5b1fbf8d0743dda128fc5ddbe8e1cf /src
parent7cfde40500b24e1a7ed0ac4c2525fdd0ebe81e56 (diff)
edje_cc can now use group.program_remove to remove inherited programs
@feature
Diffstat (limited to 'src')
-rw-r--r--src/bin/edje/edje_cc.h1
-rw-r--r--src/bin/edje/edje_cc_handlers.c91
-rw-r--r--src/bin/edje/edje_cc_out.c15
3 files changed, 107 insertions, 0 deletions
diff --git a/src/bin/edje/edje_cc.h b/src/bin/edje/edje_cc.h
index 6f43260..c611af0 100644
--- a/src/bin/edje/edje_cc.h
+++ b/src/bin/edje/edje_cc.h
@@ -157,6 +157,7 @@ void data_queue_part_reallocated_lookup(Edje_Part_Collection *pc, const char
157void data_queue_copied_part_lookup(Edje_Part_Collection *pc, int *src, int *dest); 157void data_queue_copied_part_lookup(Edje_Part_Collection *pc, int *src, int *dest);
158void *data_queue_program_lookup(Edje_Part_Collection *pc, const char *name, int *dest); 158void *data_queue_program_lookup(Edje_Part_Collection *pc, const char *name, int *dest);
159void program_lookup_rename(void *p, const char *name); 159void program_lookup_rename(void *p, const char *name);
160void copied_program_lookup_delete(Edje_Part_Collection *pc, const char *name);
160void data_queue_copied_program_lookup(Edje_Part_Collection *pc, int *src, int *dest); 161void data_queue_copied_program_lookup(Edje_Part_Collection *pc, int *src, int *dest);
161void data_queue_anonymous_lookup(Edje_Part_Collection *pc, Edje_Program *ep, int *dest); 162void data_queue_anonymous_lookup(Edje_Part_Collection *pc, Edje_Program *ep, int *dest);
162void data_queue_copied_anonymous_lookup(Edje_Part_Collection *pc, int *src, int *dest); 163void data_queue_copied_anonymous_lookup(Edje_Part_Collection *pc, int *src, int *dest);
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index eb7b0f9..3b93d83 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -195,6 +195,7 @@ static void ob_collections_group(void);
195static void st_collections_group_name(void); 195static void st_collections_group_name(void);
196static void st_collections_group_inherit(void); 196static void st_collections_group_inherit(void);
197static void st_collections_group_part_remove(void); 197static void st_collections_group_part_remove(void);
198static void st_collections_group_program_remove(void);
198static void st_collections_group_script_only(void); 199static void st_collections_group_script_only(void);
199static void st_collections_group_alias(void); 200static void st_collections_group_alias(void);
200static void st_collections_group_min(void); 201static void st_collections_group_min(void);
@@ -498,6 +499,7 @@ New_Statement_Handler statement_handlers[] =
498 {"collections.group.name", st_collections_group_name}, 499 {"collections.group.name", st_collections_group_name},
499 {"collections.group.inherit", st_collections_group_inherit}, 500 {"collections.group.inherit", st_collections_group_inherit},
500 {"collections.group.part_remove", st_collections_group_part_remove}, 501 {"collections.group.part_remove", st_collections_group_part_remove},
502 {"collections.group.program_remove", st_collections_group_program_remove},
501 {"collections.group.script_only", st_collections_group_script_only}, 503 {"collections.group.script_only", st_collections_group_script_only},
502 {"collections.group.lua_script_only", st_collections_group_script_only}, 504 {"collections.group.lua_script_only", st_collections_group_script_only},
503 {"collections.group.alias", st_collections_group_alias}, 505 {"collections.group.alias", st_collections_group_alias},
@@ -3555,6 +3557,95 @@ st_collections_group_parts_part_inherit(void)
3555 free(name); 3557 free(name);
3556} 3558}
3557 3559
3560static Eina_Bool
3561_program_remove(const char *name, Edje_Program **pgrms, unsigned int count)
3562{
3563 unsigned int i;
3564 Edje_Part_Collection *pc;
3565
3566 pc = eina_list_last_data_get(edje_collections);
3567
3568 for (i = 0; i < count; ++i)
3569 if (pgrms[i]->name && (!strcmp(name, pgrms[i]->name)))
3570 {
3571 Edje_Program_Target *prt;
3572 Edje_Program_After *pa;
3573 Edje_Program *pr = pgrms[i];
3574
3575 _edje_program_remove(pc, pgrms[i]);
3576
3577 free((void*)pr->name);
3578 free((void*)pr->signal);
3579 free((void*)pr->source);
3580 free((void*)pr->filter.part);
3581 free((void*)pr->filter.state);
3582 free((void*)pr->state);
3583 free((void*)pr->state2);
3584 free((void*)pr->sample_name);
3585 free((void*)pr->tone_name);
3586 EINA_LIST_FREE(pr->targets, prt);
3587 free(prt);
3588 EINA_LIST_FREE(pr->after, pa)
3589 free(pa);
3590 free(pr);
3591 return EINA_TRUE;
3592 }
3593 return EINA_FALSE;
3594}
3595
3596/**
3597 @page edcref
3598 @property
3599 program_remove
3600 @parameters
3601 [program name] [program name] [program name] ...
3602 @effect
3603 Removes the listed programs from an inherited group. Removing nonexistent
3604 programs is not allowed.
3605 This will break program sequences if a program in the middle of the sequence is removed.
3606 @endproperty
3607 @since 1.10
3608*/
3609static void
3610st_collections_group_program_remove(void)
3611{
3612 unsigned int n, argc;
3613 Edje_Part_Collection *pc;
3614
3615 check_min_arg_count(1);
3616
3617 if (!current_group_inherit)
3618 {
3619 ERR("Cannot remove programs from non-inherited group '%s'", current_de->entry);
3620 exit(-1);
3621 }
3622
3623 pc = eina_list_last_data_get(edje_collections);
3624
3625 for (n = 0, argc = get_arg_count(); n < argc; n++)
3626 {
3627 char *name;
3628 Eina_Bool success = EINA_FALSE;
3629
3630 name = parse_str(n);
3631
3632 success |= _program_remove(name, pc->programs.fnmatch, pc->programs.fnmatch_count);
3633 success |= _program_remove(name, pc->programs.strcmp, pc->programs.strcmp_count);
3634 success |= _program_remove(name, pc->programs.strncmp, pc->programs.strncmp_count);
3635 success |= _program_remove(name, pc->programs.strrncmp, pc->programs.strrncmp_count);
3636 success |= _program_remove(name, pc->programs.nocmp, pc->programs.nocmp_count);
3637
3638 copied_program_lookup_delete(pc, name);
3639 if (!success)
3640 {
3641 ERR("Attempted removal of nonexistent program '%s' in group '%s'.",
3642 name, current_de->entry);
3643 exit(-1);
3644 }
3645 free(name);
3646 }
3647}
3648
3558/** 3649/**
3559 @page edcref 3650 @page edcref
3560 @property 3651 @property
diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c
index 05d3e4f..4b303a5 100644
--- a/src/bin/edje/edje_cc_out.c
+++ b/src/bin/edje/edje_cc_out.c
@@ -2377,6 +2377,21 @@ program_lookup_rename(void *p, const char *name)
2377} 2377}
2378 2378
2379void 2379void
2380copied_program_lookup_delete(Edje_Part_Collection *pc, const char *name)
2381{
2382 Program_Lookup *pl;
2383 Eina_List *l, *ll;
2384
2385 EINA_LIST_FOREACH_SAFE(program_lookups, l, ll, pl)
2386 {
2387 if (pl->anonymous || (pl->pc != pc) || strcmp(pl->u.name, name)) continue;
2388 free(pl->u.name);
2389 program_lookups = eina_list_remove_list(program_lookups, l);
2390 free(pl);
2391 }
2392}
2393
2394void
2380data_queue_copied_program_lookup(Edje_Part_Collection *pc, int *src, int *dest) 2395data_queue_copied_program_lookup(Edje_Part_Collection *pc, int *src, int *dest)
2381{ 2396{
2382 Eina_List *l; 2397 Eina_List *l;