summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/edje/edje_cc.h9
-rw-r--r--src/bin/edje/edje_cc_handlers.c248
2 files changed, 232 insertions, 25 deletions
diff --git a/src/bin/edje/edje_cc.h b/src/bin/edje/edje_cc.h
index 9b204646c4..547a7c071b 100644
--- a/src/bin/edje/edje_cc.h
+++ b/src/bin/edje/edje_cc.h
@@ -146,11 +146,20 @@ typedef struct Edje_Target_Group
146 char **targets; 146 char **targets;
147} Edje_Target_Group; 147} Edje_Target_Group;
148 148
149typedef struct Edje_Part_Description_Link
150{
151 Edje_Program *pr;
152 Edje_Part_Description_Common *ed;
153 Edje_Part_Parser *epp;
154} Edje_Part_Description_Link;
155
149struct _Edje_Part_Collection_Parser 156struct _Edje_Part_Collection_Parser
150{ 157{
151 Edje_Part_Collection common; 158 Edje_Part_Collection common;
152 char *default_source; 159 char *default_source;
153 Eina_List *target_groups; 160 Eina_List *target_groups;
161 Eina_List *links;
162 Eina_Hash *link_hash;
154 Eina_Bool default_mouse_events; 163 Eina_Bool default_mouse_events;
155 Eina_Bool inherit_only; 164 Eina_Bool inherit_only;
156}; 165};
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index 06865518c6..de1556dc8e 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -86,6 +86,7 @@
86 * <li>@ref sec_collections_group_parts_description "Description"</li> 86 * <li>@ref sec_collections_group_parts_description "Description"</li>
87 * <ul> 87 * <ul>
88 * <li>@ref sec_collections_group_parts_description_relatives "Relatives (rel1/rel2)"</li> 88 * <li>@ref sec_collections_group_parts_description_relatives "Relatives (rel1/rel2)"</li>
89 * <li>@ref sec_collections_group_parts_description_links "Links"</li>
89 * <li>@ref sec_collections_group_parts_description_image "Image"</li> 90 * <li>@ref sec_collections_group_parts_description_image "Image"</li>
90 * <ul> 91 * <ul>
91 * <li>@ref sec_collections_group_parts_description_image_fill "Fill"</li> 92 * <li>@ref sec_collections_group_parts_description_image_fill "Fill"</li>
@@ -167,6 +168,10 @@ static void edje_cc_handlers_hierarchy_push(Edje_Part *ep, Edje_Part *cp);
167static void edje_cc_handlers_hierarchy_rename(Edje_Part *old, Edje_Part *new); 168static void edje_cc_handlers_hierarchy_rename(Edje_Part *old, Edje_Part *new);
168static void edje_cc_handlers_hierarchy_pop(void); 169static void edje_cc_handlers_hierarchy_pop(void);
169 170
171static void _program_target_add(char *name);
172static void _program_after(const char *name);
173static void _program_free(Edje_Program *pr);
174
170static void st_externals_external(void); 175static void st_externals_external(void);
171 176
172static void st_images_image(void); 177static void st_images_image(void);
@@ -278,6 +283,8 @@ static void st_collections_group_parts_part_table_items_item_span(void);
278static void ob_collections_group_parts_part_description(void); 283static void ob_collections_group_parts_part_description(void);
279static void ob_collections_group_parts_part_desc(void); 284static void ob_collections_group_parts_part_desc(void);
280static void st_collections_group_parts_part_description_inherit(void); 285static void st_collections_group_parts_part_description_inherit(void);
286static void ob_collections_group_parts_part_description_link(void);
287static void st_collections_group_parts_part_description_link_base(void);
281static void st_collections_group_parts_part_description_source(void); 288static void st_collections_group_parts_part_description_source(void);
282static void st_collections_group_parts_part_description_state(void); 289static void st_collections_group_parts_part_description_state(void);
283static void st_collections_group_parts_part_description_visible(void); 290static void st_collections_group_parts_part_description_visible(void);
@@ -616,6 +623,10 @@ New_Statement_Handler statement_handlers[] =
616 {"collections.group.parts.part.table.items.item.span", st_collections_group_parts_part_table_items_item_span}, 623 {"collections.group.parts.part.table.items.item.span", st_collections_group_parts_part_table_items_item_span},
617 {"collections.group.parts.part.description.target_group", st_collections_group_target_group}, /* dup */ 624 {"collections.group.parts.part.description.target_group", st_collections_group_target_group}, /* dup */
618 {"collections.group.parts.part.description.inherit", st_collections_group_parts_part_description_inherit}, 625 {"collections.group.parts.part.description.inherit", st_collections_group_parts_part_description_inherit},
626 {"collections.group.parts.part.description.link.base", st_collections_group_parts_part_description_link_base},
627 {"collections.group.parts.part.description.link.transition", st_collections_group_programs_program_transition},
628 {"collections.group.parts.part.description.link.after", st_collections_group_programs_program_after},
629 {"collections.group.parts.part.description.link.in", st_collections_group_programs_program_in},
619 {"collections.group.parts.part.description.source", st_collections_group_parts_part_description_source}, 630 {"collections.group.parts.part.description.source", st_collections_group_parts_part_description_source},
620 {"collections.group.parts.part.description.state", st_collections_group_parts_part_description_state}, 631 {"collections.group.parts.part.description.state", st_collections_group_parts_part_description_state},
621 {"collections.group.parts.part.description.visible", st_collections_group_parts_part_description_visible}, 632 {"collections.group.parts.part.description.visible", st_collections_group_parts_part_description_visible},
@@ -989,6 +1000,7 @@ New_Object_Handler object_handlers[] =
989 {"collections.group.parts.part.table.items", NULL}, 1000 {"collections.group.parts.part.table.items", NULL},
990 {"collections.group.parts.part.table.items.item", ob_collections_group_parts_part_box_items_item}, /* dup */ 1001 {"collections.group.parts.part.table.items.item", ob_collections_group_parts_part_box_items_item}, /* dup */
991 {"collections.group.parts.part.description", ob_collections_group_parts_part_description}, 1002 {"collections.group.parts.part.description", ob_collections_group_parts_part_description},
1003 {"collections.group.parts.part.description.link", ob_collections_group_parts_part_description_link},
992 {"collections.group.parts.part.description.rel1", NULL}, 1004 {"collections.group.parts.part.description.rel1", NULL},
993 {"collections.group.parts.part.description.rel2", NULL}, 1005 {"collections.group.parts.part.description.rel2", NULL},
994 {"collections.group.parts.part.description.image", NULL}, /* dup */ 1006 {"collections.group.parts.part.description.image", NULL}, /* dup */
@@ -2772,6 +2784,68 @@ st_collections_group_vibration_sample_source(void)
2772 check_arg_count(1); 2784 check_arg_count(1);
2773} 2785}
2774 2786
2787static void
2788_link_combine(void)
2789{
2790 Edje_Part_Collection *pc;
2791 Edje_Part_Collection_Parser *pcp;
2792 Eina_Iterator *it;
2793 Eina_Hash_Tuple *tup;
2794
2795 pc = eina_list_last_data_get(edje_collections);
2796 pcp = eina_list_last_data_get(edje_collections);
2797
2798 if (!pcp->link_hash) return;
2799 it = eina_hash_iterator_tuple_new(pcp->link_hash);
2800 EINA_ITERATOR_FOREACH(it, tup)
2801 {
2802 while (tup->data)
2803 {
2804 Edje_Part_Description_Link *el, *ell;
2805 Eina_List *l, *ll, *combine = NULL;
2806
2807 el = eina_list_data_get(tup->data);
2808 tup->data = eina_list_remove_list(tup->data, tup->data);
2809 EINA_LIST_FOREACH_SAFE(tup->data, l, ll, ell)
2810 {
2811 if (ell->pr->tween.mode != el->pr->tween.mode) continue;
2812 if (fabs(ell->pr->tween.time - el->pr->tween.time) > DBL_EPSILON) continue;
2813 if (fabs(ell->pr->tween.v1 - el->pr->tween.v1) > DBL_EPSILON) continue;
2814 if (fabs(ell->pr->tween.v2 - el->pr->tween.v2) > DBL_EPSILON) continue;
2815 if (fabs(ell->pr->tween.v3 - el->pr->tween.v3) > DBL_EPSILON) continue;
2816 if (fabs(ell->pr->tween.v4 - el->pr->tween.v4) > DBL_EPSILON) continue;
2817 if (fabs(ell->ed->state.value - el->ed->state.value) > DBL_EPSILON) continue;
2818 if ((!!ell->ed->state.name) != (!!el->ed->state.name))
2819 {
2820 if (((!!ell->ed->state.name) && strcmp(el->ed->state.name, "default")) ||
2821 ((!!el->ed->state.name) && strcmp(ell->ed->state.name, "default")))
2822 continue;
2823 }
2824 else if (ell->ed->state.name && strcmp(ell->ed->state.name, el->ed->state.name))
2825 continue;
2826 eina_list_move_list(&combine, (Eina_List**)&tup->data, l);
2827 }
2828 current_program = el->pr;
2829 _program_target_add(strdup(el->epp->common.name));
2830 EINA_LIST_FREE(combine, ell)
2831 {
2832 char *name;
2833
2834 _program_target_add(strdup(ell->epp->common.name));
2835 EINA_LIST_FOREACH(ell->pr->after, l, name)
2836 _program_after(name);
2837 _program_free(ell->pr);
2838 free(ell);
2839 }
2840 _edje_program_insert(pc, current_program);
2841 }
2842 }
2843 eina_iterator_free(it);
2844 eina_hash_free(pcp->link_hash);
2845 pcp->links = eina_list_free(pcp->links);
2846 current_program = NULL;
2847}
2848
2775/** 2849/**
2776 @edcsubsection{collections_group,Group} 2850 @edcsubsection{collections_group,Group}
2777 */ 2851 */
@@ -2818,6 +2892,9 @@ ob_collections_group(void)
2818 current_part = NULL; 2892 current_part = NULL;
2819 current_desc = NULL; 2893 current_desc = NULL;
2820 2894
2895 if (current_de)
2896 _link_combine();
2897
2821 current_group_inherit = EINA_FALSE; 2898 current_group_inherit = EINA_FALSE;
2822 2899
2823 current_de = mem_alloc(SZ(Edje_Part_Collection_Directory_Entry)); 2900 current_de = mem_alloc(SZ(Edje_Part_Collection_Directory_Entry));
@@ -4156,6 +4233,28 @@ st_collections_group_parts_part_inherit(void)
4156 free(name); 4233 free(name);
4157} 4234}
4158 4235
4236static void
4237_program_free(Edje_Program *pr)
4238{
4239 Edje_Program_Target *prt;
4240 Edje_Program_After *pa;
4241
4242 free((void*)pr->name);
4243 free((void*)pr->signal);
4244 free((void*)pr->source);
4245 free((void*)pr->filter.part);
4246 free((void*)pr->filter.state);
4247 free((void*)pr->state);
4248 free((void*)pr->state2);
4249 free((void*)pr->sample_name);
4250 free((void*)pr->tone_name);
4251 EINA_LIST_FREE(pr->targets, prt);
4252 free(prt);
4253 EINA_LIST_FREE(pr->after, pa)
4254 free(pa);
4255 free(pr);
4256}
4257
4159static Eina_Bool 4258static Eina_Bool
4160_program_remove(const char *name, Edje_Program **pgrms, unsigned int count) 4259_program_remove(const char *name, Edje_Program **pgrms, unsigned int count)
4161{ 4260{
@@ -4167,26 +4266,11 @@ _program_remove(const char *name, Edje_Program **pgrms, unsigned int count)
4167 for (i = 0; i < count; ++i) 4266 for (i = 0; i < count; ++i)
4168 if (pgrms[i]->name && (!strcmp(name, pgrms[i]->name))) 4267 if (pgrms[i]->name && (!strcmp(name, pgrms[i]->name)))
4169 { 4268 {
4170 Edje_Program_Target *prt;
4171 Edje_Program_After *pa;
4172 Edje_Program *pr = pgrms[i]; 4269 Edje_Program *pr = pgrms[i];
4173 4270
4174 _edje_program_remove(pc, pgrms[i]); 4271 _edje_program_remove(pc, pr);
4175 4272
4176 free((void*)pr->name); 4273 _program_free(pr);
4177 free((void*)pr->signal);
4178 free((void*)pr->source);
4179 free((void*)pr->filter.part);
4180 free((void*)pr->filter.state);
4181 free((void*)pr->state);
4182 free((void*)pr->state2);
4183 free((void*)pr->sample_name);
4184 free((void*)pr->tone_name);
4185 EINA_LIST_FREE(pr->targets, prt);
4186 free(prt);
4187 EINA_LIST_FREE(pr->after, pa)
4188 free(pa);
4189 free(pr);
4190 return EINA_TRUE; 4274 return EINA_TRUE;
4191 } 4275 }
4192 return EINA_FALSE; 4276 return EINA_FALSE;
@@ -5906,6 +5990,113 @@ ob_collections_group_parts_part_desc(void)
5906 ob_collections_group_parts_part_description(); 5990 ob_collections_group_parts_part_description();
5907} 5991}
5908 5992
5993static void
5994ob_collections_group_parts_part_description_link(void)
5995{
5996 Edje_Part_Collection_Parser *pcp;
5997 Edje_Part_Parser *epp;
5998 Edje_Part_Description_Link *el;
5999
6000 pcp = eina_list_last_data_get(edje_collections);
6001 epp = (Edje_Part_Parser*)current_part;
6002
6003 ob_collections_group_programs_program();
6004 _edje_program_remove((Edje_Part_Collection*)pcp, current_program);
6005 el = mem_alloc(SZ(Edje_Part_Description_Link));
6006 el->pr = current_program;
6007 el->ed = current_desc;
6008 el->epp = epp;
6009 pcp->links = eina_list_append(pcp->links, el);
6010 current_program->action = EDJE_ACTION_TYPE_STATE_SET;
6011 current_program->state = strdup(current_desc->state.name ?: "default");
6012 current_program->value = current_desc->state.value;
6013}
6014
6015/**
6016 @edcsubsection{collections_group_parts_description_links,Links}
6017 */
6018
6019/**
6020 @page edcref
6021 @block
6022 link
6023 @context
6024 desc { "default";
6025 ..
6026 link {
6027 base: "edje,signal" "edje";
6028 transition: LINEAR 0.2;
6029 in: 0.5 0.1;
6030 after: "some_program";
6031 }
6032 ..
6033 }
6034 @description
6035 The link block can be used to create transitions to the enclosing part description state.
6036 The result of the above block is identical to creating a program with
6037 action: STATE_SET "default";
6038 signal: "edje,signal"; source: "edje";
6039 @since 1.10
6040 @endblock
6041
6042 @property
6043 base
6044 @parameters
6045 [signal] [source]
6046 @effect
6047 Defines the signal and source which will trigger the transition to this state.
6048 The source parameter is optional here and will be filled with the current group's
6049 default value if it is not provided.
6050 @since 1.10
6051 @endproperty
6052*/
6053static void
6054st_collections_group_parts_part_description_link_base(void)
6055{
6056 char *name;
6057 char buf[4096];
6058 Edje_Part_Collection_Parser *pcp;
6059 Edje_Part_Description_Link *el, *ell;
6060 Eina_List *l;
6061
6062 pcp = eina_list_last_data_get(edje_collections);
6063 el = eina_list_last_data_get(pcp->links);
6064
6065 if ((!el) || (el->pr != current_program) || (el->ed != current_desc) || (el->epp != (Edje_Part_Parser*)current_part))
6066 ob_collections_group_parts_part_description_link();
6067 el = eina_list_last_data_get(pcp->links);
6068
6069 check_min_arg_count(1);
6070 name = parse_str(0);
6071 if (current_program->signal && pcp->link_hash)
6072 {
6073 snprintf(buf, sizeof(buf), "%s\"\"\"%s", current_program->signal, current_program->source ?: "");
6074 eina_hash_list_remove(pcp->link_hash, buf, el);
6075 }
6076 if (!pcp->link_hash)
6077 pcp->link_hash = eina_hash_string_superfast_new((Eina_Free_Cb)eina_list_free);
6078 free((void*)current_program->signal);
6079 current_program->signal = name;
6080 if (get_arg_count() == 2)
6081 {
6082 name = parse_str(1);
6083 free((void*)current_program->source);
6084 current_program->source = name;
6085 }
6086 snprintf(buf, sizeof(buf), "%s\"\"\"%s", current_program->signal, current_program->source ?: "");
6087 EINA_LIST_FOREACH(eina_hash_find(pcp->link_hash, buf), l, ell)
6088 {
6089 if (ell->epp == el->epp)
6090 {
6091 ERR("parse error %s:%i. "
6092 "cannot have multiple links with the same signal on the same part",
6093 file_in, line - 1);
6094 exit(-1);
6095 }
6096 }
6097 eina_hash_list_append(pcp->link_hash, buf, el);
6098}
6099
5909/** 6100/**
5910 @page edcref 6101 @page edcref
5911 @property 6102 @property
@@ -10347,6 +10538,9 @@ st_collections_group_programs_program_transition(void)
10347 10538
10348 _program_sequence_check(); 10539 _program_sequence_check();
10349 10540
10541 current_program->tween.v1 = current_program->tween.v2 =
10542 current_program->tween.v3 = current_program->tween.v4 = 0.0;
10543
10350 current_program->tween.mode = parse_enum(0, 10544 current_program->tween.mode = parse_enum(0,
10351 // short names 10545 // short names
10352 "LIN", EDJE_TWEEN_MODE_LINEAR, 10546 "LIN", EDJE_TWEEN_MODE_LINEAR,
@@ -10951,13 +11145,17 @@ st_collections_group_physics_world_z(void)
10951void 11145void
10952edje_cc_handlers_pop_notify(const char *token) 11146edje_cc_handlers_pop_notify(const char *token)
10953{ 11147{
10954 if ((!sequencing) || strcmp(token, "sequence")) return; 11148 if (sequencing && (!strcmp(token, "sequence")))
10955 current_program = sequencing; 11149 {
10956 ((Edje_Program_Parser*)sequencing)->can_override = EINA_TRUE; 11150 current_program = sequencing;
10957 current_program_lookups = eina_list_free(current_program_lookups); 11151 ((Edje_Program_Parser*)sequencing)->can_override = EINA_TRUE;
10958 current_program_lookups = sequencing_lookups; 11152 current_program_lookups = eina_list_free(current_program_lookups);
10959 sequencing_lookups = NULL; 11153 current_program_lookups = sequencing_lookups;
10960 sequencing = NULL; 11154 sequencing_lookups = NULL;
11155 sequencing = NULL;
11156 }
11157 else if (current_program && (!strcmp(token, "link")))
11158 current_program = NULL;
10961} 11159}
10962 11160
10963static void 11161static void