summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@yahoo.com>2018-11-19 23:55:45 +0200
committerDaniel Zaoui <daniel.zaoui@yahoo.com>2018-11-19 23:55:45 +0200
commit50bf930ba29368c8c766bf9fd84622e4b3ae549f (patch)
treea9cddd7096ca93df384cba2477eae257d70477a5
parent7e2b79999aea1e3da6d6eb92f95e1e6c8de5e670 (diff)
Support parts for all kinds of functions
Now, efl_part is supported for all the functions. A function using a part will be described in the ML in this way: wdg[part].hint_allow: true
-rw-r--r--src/bin/c_gen.c43
-rw-r--r--src/bin/optimizer.c2
-rw-r--r--src/lib/common.h1
-rw-r--r--src/lib/ml_gen.c17
-rw-r--r--src/lib/parser.c166
-rw-r--r--src/lib/spy_preload.c143
6 files changed, 106 insertions, 266 deletions
diff --git a/src/bin/c_gen.c b/src/bin/c_gen.c
index 6635dbe..0cb8a38 100644
--- a/src/bin/c_gen.c
+++ b/src/bin/c_gen.c
@@ -594,7 +594,7 @@ _function_generate(const Eolian_Unit *unit, Ea_Callback *cur_cb, Ea_Function *ea
594 const char *c_fname, *name; 594 const char *c_fname, *name;
595 Eina_List *itr; 595 Eina_List *itr;
596 Ea_Value *v; 596 Ea_Value *v;
597 Eina_Bool need_delay = EINA_FALSE, has_part = EINA_FALSE; 597 Eina_Bool need_delay = EINA_FALSE;
598 Eina_Bool is_singleton = !!JSON_GET("Class_Properties", 598 Eina_Bool is_singleton = !!JSON_GET("Class_Properties",
599 eolian_class_name_get(ea_func->wdg->kl), "Singleton"); 599 eolian_class_name_get(ea_func->wdg->kl), "Singleton");
600 600
@@ -622,47 +622,28 @@ _function_generate(const Eolian_Unit *unit, Ea_Callback *cur_cb, Ea_Function *ea
622 c_fname = _full_c_name_get(ea_func->func, EOLIAN_UNRESOLVED, force_legacy); 622 c_fname = _full_c_name_get(ea_func->func, EOLIAN_UNRESOLVED, force_legacy);
623 eina_strbuf_append_printf(fbuf, "%s(" , c_fname); 623 eina_strbuf_append_printf(fbuf, "%s(" , c_fname);
624 624
625 if (!strcmp(c_fname, "efl_text_set") && eina_list_count(ea_func->values) == 2) 625 if (!strcmp(c_fname, "efl_text_set") && ea_func->part_name)
626 { 626 {
627 const char *part = "default"; 627 const char *part = ea_func->part_name;
628 v = eina_list_data_get(ea_func->values);
629 if (v && v->type == EA_VALUE_BASIC && eina_value_type_get(v->v_basic) == EINA_VALUE_TYPE_STRING)
630 {
631 part = eina_value_to_string(v->v_basic);
632 }
633 if (_eolian_isa(wdg->kl, "Efl.Text") && (!strcmp(part, "elm.text") || !strcmp(part, "default"))) 628 if (_eolian_isa(wdg->kl, "Efl.Text") && (!strcmp(part, "elm.text") || !strcmp(part, "default")))
634 { 629 ea_func->part_name = NULL;
635 eina_strbuf_append_printf(fbuf, "%s%s", 630 }
636 is_ctor?"":_access_prefix_get(wdg, cur_cb), name); 631 if (!is_singleton)
637 } 632 {
638 else 633 if (ea_func->part_name)
639 { 634 {
640 eina_strbuf_append_printf(fbuf, "efl_part(%s%s, \"%s\")", 635 eina_strbuf_append_printf(fbuf, "efl_part(%s%s, \"%s\")",
641 is_ctor?"":_access_prefix_get(wdg, cur_cb), name, part); 636 is_ctor?"":_access_prefix_get(wdg, cur_cb), name, ea_func->part_name);
642 } 637 }
643 638 else
644 has_part = EINA_TRUE;
645 }
646 else if (!strcmp(c_fname, "efl_content_set") && eina_list_count(ea_func->values) == 2)
647 {
648 const char *part = "default";
649 v = eina_list_data_get(ea_func->values);
650 if (v && v->type == EA_VALUE_BASIC && eina_value_type_get(v->v_basic) == EINA_VALUE_TYPE_STRING)
651 { 639 {
652 part = eina_value_to_string(v->v_basic); 640 eina_strbuf_append_printf(fbuf, "%s%s",
641 is_ctor?"":_access_prefix_get(wdg, cur_cb), name);
653 } 642 }
654 eina_strbuf_append_printf(fbuf, "efl_part(%s%s, \"%s\")",
655 is_ctor?"":_access_prefix_get(wdg, cur_cb), name, part);
656
657 has_part = EINA_TRUE;
658 } 643 }
659 else if (!is_singleton)
660 eina_strbuf_append_printf(fbuf, "%s%s",
661 is_ctor?"":_access_prefix_get(wdg, cur_cb), name);
662 644
663 EINA_LIST_FOREACH(ea_func->values, itr, v) 645 EINA_LIST_FOREACH(ea_func->values, itr, v)
664 { 646 {
665 if (has_part && ea_func->values == itr) continue;
666 if (v->type == EA_VALUE_OBJECT && !need_delay) 647 if (v->type == EA_VALUE_OBJECT && !need_delay)
667 { 648 {
668 Ea_Widget *obj_winfo = v->ptr; 649 Ea_Widget *obj_winfo = v->ptr;
diff --git a/src/bin/optimizer.c b/src/bin/optimizer.c
index fc70e9b..7f463b4 100644
--- a/src/bin/optimizer.c
+++ b/src/bin/optimizer.c
@@ -340,6 +340,8 @@ _name_analyze(Ea_Widget *wdg)
340 _values_analyze(act->func->values); 340 _values_analyze(act->func->values);
341 if (act->func->wdg != wdg) 341 if (act->func->wdg != wdg)
342 _info_ref(act->func->wdg); 342 _info_ref(act->func->wdg);
343 if (act->func->part_name)
344 _info_ref(act->func->wdg);
343 } 345 }
344 } 346 }
345 _values_analyze(wdg->contain_values); 347 _values_analyze(wdg->contain_values);
diff --git a/src/lib/common.h b/src/lib/common.h
index 04f5776..41f0bdf 100644
--- a/src/lib/common.h
+++ b/src/lib/common.h
@@ -133,6 +133,7 @@ struct Ea_Function
133 Ea_Widget *wdg; 133 Ea_Widget *wdg;
134 const Eolian_Function *func; 134 const Eolian_Function *func;
135 Eina_List *values; 135 Eina_List *values;
136 const char *part_name;
136 137
137 Eina_Bool is_deleted : 1; 138 Eina_Bool is_deleted : 1;
138 Eina_Bool is_default : 1; 139 Eina_Bool is_default : 1;
diff --git a/src/lib/ml_gen.c b/src/lib/ml_gen.c
index 9709304..eac5435 100644
--- a/src/lib/ml_gen.c
+++ b/src/lib/ml_gen.c
@@ -224,9 +224,20 @@ _function_generate(Ea_Widget *cur_wdg, Ea_Function *ea_func, Eina_Strbuf *buf, i
224 int nb_keys = 0, nb_values = 0; 224 int nb_keys = 0, nb_values = 0;
225 225
226 eina_strbuf_append_printf(buf, "%*s", indent, ""); 226 eina_strbuf_append_printf(buf, "%*s", indent, "");
227 if (cur_wdg != ea_func->wdg) 227 if (cur_wdg != ea_func->wdg || ea_func->part_name)
228 eina_strbuf_append_printf(buf, "%s%s%s.", 228 {
229 COLOR_VAL, ea_func->wdg->name, COLOR_END); 229 if (cur_wdg != ea_func->wdg || ea_func->part_name)
230 {
231 eina_strbuf_append_printf(buf, "%s%s%s",
232 COLOR_VAL, ea_func->wdg->name, COLOR_END);
233 }
234 if (ea_func->part_name)
235 {
236 eina_strbuf_append_printf(buf, "[%s%s%s]",
237 COLOR_VAL, ea_func->part_name, COLOR_END);
238 }
239 eina_strbuf_append(buf, ".");
240 }
230 241
231 short_fname = eolian_function_name_get(func); 242 short_fname = eolian_function_name_get(func);
232 funcs = _function_find_by_name(wdg->unit, wdg->real_kl, short_fname, EOLIAN_UNRESOLVED, EINA_FALSE); 243 funcs = _function_find_by_name(wdg->unit, wdg->real_kl, short_fname, EOLIAN_UNRESOLVED, EINA_FALSE);
diff --git a/src/lib/parser.c b/src/lib/parser.c
index 16a5f1d..0ea539e 100644
--- a/src/lib/parser.c
+++ b/src/lib/parser.c
@@ -38,6 +38,7 @@ typedef struct
38typedef struct 38typedef struct
39{ 39{
40 char *id; 40 char *id;
41 const char *part_name;
41 const char *func_name; 42 const char *func_name;
42 Lexer *lexer; 43 Lexer *lexer;
43 Ea_Action *action; 44 Ea_Action *action;
@@ -679,10 +680,8 @@ _param_parse(const Eolian_Unit *unit, Context *ctx, const Eolian_Function_Parame
679} 680}
680 681
681static Ea_Function * 682static Ea_Function *
682_prop_parse(Ea_Widget *wdg, const char *func_name, Context *ctx) 683_prop_parse(Ea_Widget *wdg, const char *part_name, const char *func_name, Context *ctx)
683{ 684{
684 static const Eolian_Function *_efl_content_set_func = NULL;
685 static const Eolian_Function_Parameter *_part_param = NULL;
686 Lexer *l = ctx->l; 685 Lexer *l = ctx->l;
687 Eina_List *plist = NULL, *itr, *vals = NULL; 686 Eina_List *plist = NULL, *itr, *vals = NULL;
688 Ea_Value *v; 687 Ea_Value *v;
@@ -746,96 +745,6 @@ _prop_parse(Ea_Widget *wdg, const char *func_name, Context *ctx)
746 } 745 }
747 } 746 }
748 eina_list_free(plist); 747 eina_list_free(plist);
749 if (!strcmp(eolian_function_name_get(func), "text"))
750 {
751 if (_is_next_token(l, "["))
752 {
753 if (_is_next_token(l, "%"))
754 v = _variable_parse(wdg->unit, ctx, NULL, "string");
755 else
756 {
757 v = NULL;
758 if (_is_next_token(l, "null"))
759 v = NEW_BASIC_VAL(EINA_VALUE_TYPE_STRING, NULL);
760 else
761 {
762 char *val = _next_string(l, "\"");
763 if (val) v = NEW_BASIC_VAL(EINA_VALUE_TYPE_STRING, val);
764 }
765 }
766 if (v)
767 {
768 v->is_key = EINA_TRUE;
769 if (!_part_param)
770 {
771 const Eolian_Unit *unit = NULL;
772 const Eolian_Class *part_kl = _class_find_by_name("Efl.Part", &unit);
773 const Eolian_Function *part_func = NULL;
774 if (part_kl) part_func = _eolian_class_function_get_by_name(part_kl,
775 "part_get", EOLIAN_METHOD);
776 if (part_func)
777 {
778 Eina_Iterator *iter = eolian_function_parameters_get(part_func);
779 eina_iterator_next(iter, (void **)&_part_param);
780 eina_iterator_free(iter);
781 }
782 }
783 v->eo_param = _part_param;
784 vals = eina_list_append(vals, v);
785 }
786 if (!_is_next_token(l, "]"))
787 {
788 ERR(l, "expected ] to end keys");
789 goto end;
790 }
791 }
792 }
793 if (_efl_content_set_func == func ||
794 !strcmp(eolian_function_full_c_name_get(func, EOLIAN_PROP_SET, EINA_FALSE), "efl_content_set"))
795 {
796 _efl_content_set_func = func;
797 if (_is_next_token(l, "["))
798 {
799 if (_is_next_token(l, "%"))
800 v = _variable_parse(wdg->unit, ctx, NULL, "string");
801 else
802 {
803 v = NULL;
804 if (_is_next_token(l, "null"))
805 v = NEW_BASIC_VAL(EINA_VALUE_TYPE_STRING, NULL);
806 else
807 {
808 char *val = _next_string(l, "\"");
809 if (val) v = NEW_BASIC_VAL(EINA_VALUE_TYPE_STRING, val);
810 }
811 }
812 if (v)
813 {
814 v->is_key = EINA_TRUE;
815 if (!_part_param)
816 {
817 const Eolian_Unit *unit = NULL;
818 const Eolian_Class *part_kl = _class_find_by_name("Efl.Part", &unit);
819 const Eolian_Function *part_func = NULL;
820 if (part_kl) part_func = _eolian_class_function_get_by_name(part_kl,
821 "part_get", EOLIAN_METHOD);
822 if (part_func)
823 {
824 Eina_Iterator *iter = eolian_function_parameters_get(part_func);
825 eina_iterator_next(iter, (void **)&_part_param);
826 eina_iterator_free(iter);
827 }
828 }
829 v->eo_param = _part_param;
830 vals = eina_list_append(vals, v);
831 }
832 if (!_is_next_token(l, "]"))
833 {
834 ERR(l, "expected ] to end keys");
835 goto end;
836 }
837 }
838 }
839 if (ftype == EOLIAN_METHOD) 748 if (ftype == EOLIAN_METHOD)
840 plist = _iterator_to_list(eolian_function_parameters_get(func)); 749 plist = _iterator_to_list(eolian_function_parameters_get(func));
841 else 750 else
@@ -875,6 +784,7 @@ _prop_parse(Ea_Widget *wdg, const char *func_name, Context *ctx)
875 ret = calloc(1, sizeof(*ret)); 784 ret = calloc(1, sizeof(*ret));
876 ret->wdg = wdg; 785 ret->wdg = wdg;
877 ret->func = func; 786 ret->func = func;
787 ret->part_name = part_name;
878 ret->values = vals; 788 ret->values = vals;
879 789
880end: 790end:
@@ -1255,7 +1165,21 @@ _class_parse(Context *ctx, Ea_Widget *wdg)
1255 _Repeater *int_rpt = NULL; 1165 _Repeater *int_rpt = NULL;
1256 while (!exit) 1166 while (!exit)
1257 { 1167 {
1258 char *w = _next_word(l, ".", EINA_TRUE); 1168 /* Parts */
1169 _ws_skip(l);
1170 if (!strncmp(l->current, "[", 1))
1171 {
1172 child_contain_values_lexer = malloc(sizeof(Lexer));
1173 memcpy(child_contain_values_lexer, ctx->l, sizeof(Lexer));
1174 JUMP_AT(l, "]", EINA_TRUE);
1175 if (!_is_next_token(l, ":"))
1176 {
1177 ERR(l, "expected :");
1178 return EINA_FALSE;
1179 }
1180 continue;
1181 }
1182 char *w = _next_word(l, ".[]", EINA_TRUE);
1259 unsigned int cur_line = 0; 1183 unsigned int cur_line = 0;
1260 if (w) 1184 if (w)
1261 { 1185 {
@@ -1604,13 +1528,33 @@ _class_parse(Context *ctx, Ea_Widget *wdg)
1604 { 1528 {
1605 const Eolian_Unit *unit = wdg->unit; 1529 const Eolian_Unit *unit = wdg->unit;
1606 Ea_Widget *other_wdg = NULL; 1530 Ea_Widget *other_wdg = NULL;
1531 const char *part_name = NULL;
1607 char *w2 = w; 1532 char *w2 = w;
1608 Eina_Bool is_ctor_param = EINA_FALSE, bypass = EINA_FALSE; 1533 Eina_Bool is_ctor_param = EINA_FALSE, bypass = EINA_FALSE;
1534 char *part = strchr(w, '[');
1609 char *dot = strchr(w, '.'); 1535 char *dot = strchr(w, '.');
1610 if (dot) 1536 char *part_end = part ? strchr(part + 1, ']') : NULL;
1537 if (part && dot && dot > part && dot < part_end)
1538 {
1539 /* Find the dot after the part */
1540 dot = strchr(part_end, '.');
1541 }
1542 if (part && (!dot || dot < part))
1543 {
1544 /* [] found after . -> it is a key -> we don't handle it here
1545 * We need to modify the lexer pointers so the key can be parsed
1546 * later in the process */
1547 int offset = strlen(w) - (part - w);
1548 l->current -= offset;
1549 l->offset -= offset;
1550 *part = '\0';
1551 part = NULL;
1552 }
1553 if (part || dot)
1611 { 1554 {
1612 char *id = calloc(1, dot - w + 1); 1555 char *end_id = (!part ? dot : (!dot ? part : (dot < part ? dot : part)));
1613 memcpy(id, w, dot - w); 1556 char *id = calloc(1, end_id - w + 1);
1557 memcpy(id, w, end_id - w);
1614 w2 = dot + 1; 1558 w2 = dot + 1;
1615 Ea_Widget *winfo = eina_hash_find(ctx->ids_hash, id); 1559 Ea_Widget *winfo = eina_hash_find(ctx->ids_hash, id);
1616 if (winfo) 1560 if (winfo)
@@ -1618,8 +1562,12 @@ _class_parse(Context *ctx, Ea_Widget *wdg)
1618 unit = winfo->unit; 1562 unit = winfo->unit;
1619 other_wdg = winfo; 1563 other_wdg = winfo;
1620 free(id); 1564 free(id);
1565 if (part)
1566 {
1567 part_name = eina_stringshare_add_length(part+1, part_end-part-1);
1568 }
1621 } 1569 }
1622 else 1570 else if (dot)
1623 { 1571 {
1624 if (_function_find_by_name(wdg->unit, wdg->kl, w, EOLIAN_UNRESOLVED, EINA_FALSE)) 1572 if (_function_find_by_name(wdg->unit, wdg->kl, w, EOLIAN_UNRESOLVED, EINA_FALSE))
1625 { 1573 {
@@ -1632,6 +1580,7 @@ _class_parse(Context *ctx, Ea_Widget *wdg)
1632 Ea_Action *act = calloc(1, sizeof(*act)); 1580 Ea_Action *act = calloc(1, sizeof(*act));
1633 p->id = id; 1581 p->id = id;
1634 p->func_name = w2; 1582 p->func_name = w2;
1583 p->part_name = part_name;
1635 p->lexer = malloc(sizeof(Lexer)); 1584 p->lexer = malloc(sizeof(Lexer));
1636 memcpy(p->lexer, ctx->l, sizeof(Lexer)); 1585 memcpy(p->lexer, ctx->l, sizeof(Lexer));
1637 p->repeaters_stack = eina_list_clone(ctx->repeaters_stack); 1586 p->repeaters_stack = eina_list_clone(ctx->repeaters_stack);
@@ -1681,7 +1630,7 @@ _class_parse(Context *ctx, Ea_Widget *wdg)
1681 } 1630 }
1682 if (!is_ctor_param && !bypass) 1631 if (!is_ctor_param && !bypass)
1683 { 1632 {
1684 Ea_Function *ea_func = _prop_parse(other_wdg ? other_wdg : wdg, w2, ctx); 1633 Ea_Function *ea_func = _prop_parse(other_wdg ? other_wdg : wdg, part_name, w2, ctx);
1685 if (!ea_func) 1634 if (!ea_func)
1686 { 1635 {
1687 ERR(l, "Error parsing function %s", w2); 1636 ERR(l, "Error parsing function %s", w2);
@@ -1711,23 +1660,6 @@ _class_parse(Context *ctx, Ea_Widget *wdg)
1711 } 1660 }
1712 } 1661 }
1713 } 1662 }
1714 else
1715 {
1716 /* Parts */
1717 _ws_skip(l);
1718 if (!strncmp(l->current, "[", 1))
1719 {
1720 child_contain_values_lexer = malloc(sizeof(Lexer));
1721 memcpy(child_contain_values_lexer, ctx->l, sizeof(Lexer));
1722 JUMP_AT(l, "]", EINA_TRUE);
1723 if (!_is_next_token(l, ":"))
1724 {
1725 ERR(l, "expected :");
1726 return EINA_FALSE;
1727 }
1728 continue;
1729 }
1730 }
1731 if (_is_next_token(l, "}")) 1663 if (_is_next_token(l, "}"))
1732 { 1664 {
1733 if (int_rpt) 1665 if (int_rpt)
@@ -1934,7 +1866,7 @@ ea_file_parse(const char *filename)
1934 } 1866 }
1935 ctx->l = p->lexer; 1867 ctx->l = p->lexer;
1936 ctx->repeaters_stack = p->repeaters_stack; 1868 ctx->repeaters_stack = p->repeaters_stack;
1937 Ea_Function *ea_func = _prop_parse(wdg, p->func_name, ctx); 1869 Ea_Function *ea_func = _prop_parse(wdg, p->part_name, p->func_name, ctx);
1938 if (!ea_func) goto end; 1870 if (!ea_func) goto end;
1939 p->action->type = EA_MODIFY; 1871 p->action->type = EA_MODIFY;
1940 p->action->func = ea_func; 1872 p->action->func = ea_func;
diff --git a/src/lib/spy_preload.c b/src/lib/spy_preload.c
index 7c0871d..25d4412 100644
--- a/src/lib/spy_preload.c
+++ b/src/lib/spy_preload.c
@@ -411,21 +411,9 @@ _param_extract(Ea_Widget *wdg, const Eolian_Function_Parameter *param, va_list *
411Eina_Bool 411Eina_Bool
412_params_register(Ea_Widget *wdg, const Eolian_Function *func, Eina_List **pvals, va_list *vl) 412_params_register(Ea_Widget *wdg, const Eolian_Function *func, Eina_List **pvals, va_list *vl)
413{ 413{
414 static const Eolian_Function *_efl_content_set_func = NULL;
415 Eina_Bool ret = EINA_FALSE; 414 Eina_Bool ret = EINA_FALSE;
416 Eolian_Function_Parameter *param; 415 Eolian_Function_Parameter *param;
417 416
418 if (_efl_content_set_func == func || !strcmp(eolian_function_full_c_name_get(func, EOLIAN_PROP_SET, EINA_FALSE), "efl_content_set"))
419 {
420 char *val = va_arg(*vl, char *);
421 _efl_content_set_func = func;
422 if (val)
423 {
424 Ea_Value *v = NEW_BASIC_VAL(EINA_VALUE_TYPE_STRING, _string_normalize(val));
425 v->is_key = EINA_TRUE;
426 *pvals = eina_list_append(*pvals, v);
427 }
428 }
429 Eina_Iterator *params_itr = eolian_function_type_get(func) == EOLIAN_METHOD ? NULL : 417 Eina_Iterator *params_itr = eolian_function_type_get(func) == EOLIAN_METHOD ? NULL :
430 eolian_property_keys_get(func, EOLIAN_PROP_SET); 418 eolian_property_keys_get(func, EOLIAN_PROP_SET);
431 EINA_ITERATOR_FOREACH(params_itr, param) 419 EINA_ITERATOR_FOREACH(params_itr, param)
@@ -609,6 +597,15 @@ static Ea_Function *
609_func_register(const Eo *eo_obj, Catcher_Info *c_info, Eina_Bool append, ...) 597_func_register(const Eo *eo_obj, Catcher_Info *c_info, Eina_Bool append, ...)
610{ 598{
611 Ea_Function *ea_func = NULL; 599 Ea_Function *ea_func = NULL;
600 Eina_Stringshare *part_name = NULL;
601 _Part_Info *part = _parts_hash ? eina_hash_find(_parts_hash, &eo_obj) : NULL;
602 if (part)
603 {
604 eina_hash_set(_parts_hash, &eo_obj, NULL);
605 eo_obj = part->container;
606 part_name = part->name;
607 free(part);
608 }
612 Ea_Widget *wdg = _ea_data_get(eo_obj); 609 Ea_Widget *wdg = _ea_data_get(eo_obj);
613 if (c_info->creator_field) return NULL; 610 if (c_info->creator_field) return NULL;
614 if (c_info->is_singleton) 611 if (c_info->is_singleton)
@@ -666,6 +663,8 @@ found:
666 ea_func->wdg = wdg; 663 ea_func->wdg = wdg;
667 ea_func->func = func; 664 ea_func->func = func;
668 ea_func->values = vals; 665 ea_func->values = vals;
666 if (ea_func && part_name && strcmp(part_name, "default"))
667 ea_func->part_name = part_name;
669 if (func == wdg->container_func) 668 if (func == wdg->container_func)
670 { 669 {
671 Eina_List *itr, *itr_obj = NULL; 670 Eina_List *itr, *itr_obj = NULL;
@@ -1174,22 +1173,31 @@ _flat_to_tree(Eina_List *actions, Ea_Widget *cur_wdg)
1174 content = v->ptr; 1173 content = v->ptr;
1175 } 1174 }
1176 } 1175 }
1177 if (content == eina_list_nth(focus_list, 0) && 1176 if (content == eina_list_nth(focus_list, 0))
1178 eina_list_data_find(focus_list, act->func->wdg))
1179 { 1177 {
1180 /* Merge CREATE and CONTENT_SET */ 1178 /* Try to merge CREATE and CONTENT_SET */
1181 Ea_Action *act2; 1179 Ea_Action *act2;
1182 EINA_LIST_REVERSE_FOREACH(act->func->wdg->actions, itr, act2) 1180 Eina_List *container_actions = cur_wdg ? cur_wdg->actions : NULL;
1181 if (eina_list_data_find(focus_list, act->func->wdg))
1182 {
1183 container_actions = act->func->wdg->actions;
1184 /* Remove the wdgs preceding the container */
1185 while (focus_list && eina_list_data_get(focus_list) != act->func->wdg)
1186 focus_list = eina_list_remove_list(focus_list, focus_list);
1187 }
1188 EINA_LIST_REVERSE_FOREACH(container_actions, itr, act2)
1183 { 1189 {
1184 if (act2->type == EA_MODIFY) break; 1190 if (act2->type == EA_MODIFY) break;
1185 if (act2->wdg == content) 1191 if (act2->wdg == content)
1186 { 1192 {
1187 vals = eina_list_remove_list(vals, itr_obj); 1193 vals = eina_list_remove_list(vals, itr_obj);
1194 if (act->func->part_name)
1195 {
1196 vals = eina_list_append(vals,
1197 NEW_BASIC_VAL(EINA_VALUE_TYPE_STRING, act->func->part_name));
1198 }
1188 act2->wdg->contain_values = vals; 1199 act2->wdg->contain_values = vals;
1189 act2->wdg->disable_containment = EINA_FALSE; 1200 act2->wdg->disable_containment = EINA_FALSE;
1190 /* Remove the wdgs preceding the container */
1191 while (focus_list && eina_list_data_get(focus_list) != act->func->wdg)
1192 focus_list = eina_list_remove_list(focus_list, focus_list);
1193 free(act->func); 1201 free(act->func);
1194 free(act); 1202 free(act);
1195 act = NULL; 1203 act = NULL;
@@ -2131,7 +2139,7 @@ elm_win_resize_object_add(Eo *obj, Evas_Object *subobj)
2131 static Catcher_Info *info = NULL; 2139 static Catcher_Info *info = NULL;
2132 if (!info) info = _catcher_info_new("Efl.Content", "content", EOLIAN_PROP_SET); 2140 if (!info) info = _catcher_info_new("Efl.Content", "content", EOLIAN_PROP_SET);
2133 if (_intercept_ref()) 2141 if (_intercept_ref())
2134 _func_register(obj, info, EINA_TRUE, NULL, subobj); 2142 _func_register(obj, info, EINA_TRUE, subobj);
2135 static void (*_foo)(Eo *, Evas_Object *) = NULL; 2143 static void (*_foo)(Eo *, Evas_Object *) = NULL;
2136 if (!_foo) _foo = dlsym(RTLD_NEXT, __func__); 2144 if (!_foo) _foo = dlsym(RTLD_NEXT, __func__);
2137 _foo(obj, subobj); 2145 _foo(obj, subobj);
@@ -2159,101 +2167,6 @@ EOAPI Efl_Object * efl_part(const Eo *obj, const char * name)
2159} 2167}
2160#endif 2168#endif
2161 2169
2162#ifndef EA_SPY_EFL_TEXT_SET
2163#define EA_SPY_EFL_TEXT_SET
2164EOAPI void efl_text_set(Eo *obj, const char * text)
2165{
2166 static Catcher_Info *info = NULL;
2167 if (!info) info = _catcher_info_new("Efl.Text", "text", EOLIAN_PROP_SET);
2168 if (_intercept_ref())
2169 {
2170 Ea_Widget *container_info;
2171 Eo *container = NULL;
2172 Eina_Stringshare *name = NULL;
2173 Ea_Function *ea_func = NULL;
2174 if (!_parts_hash) _parts_hash = eina_hash_pointer_new(NULL);
2175 _Part_Info *part = eina_hash_find(_parts_hash, &obj);
2176 if (part)
2177 {
2178 container = part->container;
2179 name = part->name;
2180 }
2181 if (!name && !container) container = obj;
2182 container_info = _ea_data_get(container);
2183 if (container_info) ea_func = _func_register(container, info, EINA_TRUE, text);
2184 if (ea_func && name && strcmp(name, "default"))
2185 {
2186 Ea_Value *v = NEW_BASIC_VAL(EINA_VALUE_TYPE_STRING, name);
2187 v->is_key = EINA_TRUE;
2188 ea_func->values = eina_list_prepend(ea_func->values, v);
2189 }
2190 eina_hash_set(_parts_hash, &obj, NULL);
2191 free(part);
2192 }
2193 static void (*_foo)(Eo *, const char *) = NULL;
2194 if (!_foo) _foo = dlsym(RTLD_NEXT, __func__);
2195 _foo(obj, text);
2196 _intercept_unref();
2197}
2198#endif
2199
2200#ifndef EA_SPY_EFL_CONTENT_SET
2201#define EA_SPY_EFL_CONTENT_SET
2202EOAPI Eina_Bool efl_content_set(Eo *obj, Efl_Gfx_Entity * content)
2203{
2204 static Catcher_Info *info = NULL;
2205 if (!info) info = _catcher_info_new("Efl.Content", "content", EOLIAN_PROP_SET);
2206 if (_intercept_ref())
2207 {
2208 _Part_Info *part = eina_hash_find(_parts_hash, &obj);
2209 if (!_parts_hash) _parts_hash = eina_hash_pointer_new(NULL);
2210 Eina_Stringshare *name = part ? part->name : NULL;
2211 Eo *container = part ? part->container : NULL;
2212 if (!name && !container) container = obj;
2213 Ea_Widget *container_info = _ea_data_get(container);
2214 Ea_Widget *content_info = _ea_data_get(content);
2215 if (container_info && content_info) _func_register(container, info, EINA_TRUE, name, content);
2216#if 0
2217 if (content_info && name && strcmp(name, "default"))
2218 content_info->contain_values = eina_list_append(content_info->contain_values,
2219 NEW_BASIC_VAL(EINA_VALUE_TYPE_STRING, name));
2220#endif
2221 }
2222 static Eina_Bool (*_foo)(Eo *, Efl_Gfx_Entity *) = NULL;
2223 if (!_foo) _foo = dlsym(RTLD_NEXT, __func__);
2224 Eina_Bool ret = _foo(obj, content);
2225 _intercept_unref();
2226 return ret;
2227}
2228#endif
2229
2230#ifndef EA_SPY_ELM_WDG_ITEM_PART_CONTENT_SET
2231#define EA_SPY_ELM_WDG_ITEM_PART_CONTENT_SET
2232EOAPI void elm_wdg_item_part_content_set(Eo *obj, const char * part, Efl_Canvas_Object * content)
2233{
2234 static Catcher_Info *info = NULL;
2235 if (!info) info = _catcher_info_new("Elm.Widget.Item", "part_content", EOLIAN_PROP_SET);
2236 _intercept_ref();
2237 if (_intercept_counter_get() == 1)
2238 {
2239 _func_register(obj, info, EINA_TRUE, part, content);
2240#if 0
2241 const char *part2 = part;
2242 if (!part || !strcmp(part, "default")) part2 = NULL;
2243 if (part2)
2244 content_info->contain_values = eina_list_append(NULL,
2245 NEW_BASIC_VAL(EINA_VALUE_TYPE_STRING, part2));
2246 else content_info->contain_values = NULL;
2247#endif
2248 }
2249 static void (*_foo)(Eo *, const char *, Efl_Canvas_Object *) = NULL;
2250 if (!_foo) _foo = dlsym(RTLD_NEXT, __func__);
2251 _foo(obj, part, content);
2252 _intercept_unref();
2253 return;
2254}
2255#endif
2256
2257EAPI void 2170EAPI void
2258elm_object_item_del(Eo *obj) 2171elm_object_item_del(Eo *obj)
2259{ 2172{