summaryrefslogtreecommitdiff
path: root/src/lib/edje/edje_calc.c
diff options
context:
space:
mode:
authorDaniel Hirt <hirt.danny@gmail.com>2017-10-15 17:57:38 +0300
committerCedric BAIL <cedric@osg.samsung.com>2017-11-10 10:30:09 -0800
commitef3d2120bfa58f9247a441602bd30f13cc7f225a (patch)
treed6acaabe13a3b267eb3468845e5de19bbceb0cec /src/lib/edje/edje_calc.c
parentc7b2372ffb35cc51415f943b7ff2895d245362bc (diff)
Edje: use textblock by default
As most of you know, TEXT part was, up to this point, an Evas.Text object. This patch merges TEXT and TEXTBLOCK both to use Efl.Canvas.Text. Code is added to emulate what TEXT did that TEXTBLOCK did not. I believe we can move forward with TEXT, and deperacate TEXTBLOCK from the EDC. You can also set markup to TEXT parts. Exactness seems to show some differences, but further examination shows that it's due to difference in how width is calculated in Efl.Canvas.Text. The results seem correct. Be sure to report of any breakage via Phabricator or contact me directly. I am running E with this and did not stumble upon any crashes or visual bugs. Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/lib/edje/edje_calc.c')
-rw-r--r--src/lib/edje/edje_calc.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index 1442cb8f14..be7d9e49b0 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -2401,7 +2401,7 @@ _edje_part_recalc_single_filter(Edje *ed,
2401 Eina_List *li1, *li2; 2401 Eina_List *li1, *li2;
2402 2402
2403 /* handle TEXT, IMAGE, PROXY, SNAPSHOT part types here */ 2403 /* handle TEXT, IMAGE, PROXY, SNAPSHOT part types here */
2404 if (ep->part->type == EDJE_PART_TYPE_TEXT) 2404 if (PART_IS_TEXT(ed, ep))
2405 { 2405 {
2406 Edje_Part_Description_Text *chosen_edt = (Edje_Part_Description_Text *) chosen_desc; 2406 Edje_Part_Description_Text *chosen_edt = (Edje_Part_Description_Text *) chosen_desc;
2407 Edje_Part_Description_Text *edt = (Edje_Part_Description_Text *) desc; 2407 Edje_Part_Description_Text *edt = (Edje_Part_Description_Text *) desc;
@@ -2521,6 +2521,10 @@ _edje_part_recalc_single_filter(Edje *ed,
2521 } 2521 }
2522 } 2522 }
2523 efl_gfx_filter_program_set(obj, code, filter->name); 2523 efl_gfx_filter_program_set(obj, code, filter->name);
2524 if (PART_IS_TEXT(ed, ep))
2525 {
2526 efl_text_gfx_filter_set(obj, filter->name);
2527 }
2524 if (prev_sources != filter_sources) 2528 if (prev_sources != filter_sources)
2525 { 2529 {
2526 /* remove sources that are not there anymore 2530 /* remove sources that are not there anymore
@@ -2828,11 +2832,9 @@ _edje_part_recalc_single(Edje *ed,
2828 } 2832 }
2829 2833
2830 /* if we have text that wants to make the min size the text size... */ 2834 /* if we have text that wants to make the min size the text size... */
2831 if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) 2835 if (PART_IS_TEXT(ed, ep))
2832 _edje_part_recalc_single_textblock(sc, ed, ep, (Edje_Part_Description_Text *)chosen_desc, params, &minw, &minh, &maxw, &maxh);
2833 else if (ep->part->type == EDJE_PART_TYPE_TEXT)
2834 { 2836 {
2835 _edje_part_recalc_single_text(sc, ed, ep, (Edje_Part_Description_Text*) desc, (Edje_Part_Description_Text*) chosen_desc, params, &minw, &minh, &maxw, &maxh); 2837 _edje_part_recalc_single_textblock(sc, ed, ep, (Edje_Part_Description_Text *)chosen_desc, params, &minw, &minh, &maxw, &maxh);
2836 _edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos); 2838 _edje_part_recalc_single_filter(ed, ep, desc, chosen_desc, pos);
2837 } 2839 }
2838 2840
@@ -4385,11 +4387,6 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
4385 break; 4387 break;
4386 4388
4387 case EDJE_PART_TYPE_TEXT: 4389 case EDJE_PART_TYPE_TEXT:
4388 _edje_calc_params_need_type_text(p3);
4389 p3->type.text->size = INTP(p1->type.text->size, p2->type.text->size, pos);
4390 EINA_FALLTHROUGH;
4391
4392 /* no break as we share code with the TEXTBLOCK type here. */
4393 case EDJE_PART_TYPE_TEXTBLOCK: 4390 case EDJE_PART_TYPE_TEXTBLOCK:
4394 _edje_calc_params_need_type_text(p3); 4391 _edje_calc_params_need_type_text(p3);
4395 p3->type.text->color2.r = INTP(p1->type.text->color2.r, p2->type.text->color2.r, pos2); 4392 p3->type.text->color2.r = INTP(p1->type.text->color2.r, p2->type.text->color2.r, pos2);
@@ -4601,6 +4598,8 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
4601 EINA_FALLTHROUGH; 4598 EINA_FALLTHROUGH;
4602 case EDJE_PART_TYPE_RECTANGLE: 4599 case EDJE_PART_TYPE_RECTANGLE:
4603 EINA_FALLTHROUGH; 4600 EINA_FALLTHROUGH;
4601 case EDJE_PART_TYPE_TEXT:
4602 EINA_FALLTHROUGH;
4604 case EDJE_PART_TYPE_TEXTBLOCK: 4603 case EDJE_PART_TYPE_TEXTBLOCK:
4605 EINA_FALLTHROUGH; 4604 EINA_FALLTHROUGH;
4606 case EDJE_PART_TYPE_BOX: 4605 case EDJE_PART_TYPE_BOX:
@@ -4610,11 +4609,18 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
4610 case EDJE_PART_TYPE_SNAPSHOT: 4609 case EDJE_PART_TYPE_SNAPSHOT:
4611 EINA_FALLTHROUGH; 4610 EINA_FALLTHROUGH;
4612 case EDJE_PART_TYPE_VECTOR: 4611 case EDJE_PART_TYPE_VECTOR:
4612 if (ep->part->type == EDJE_PART_TYPE_TEXT)
4613 {
4614 evas_object_color_set(ep->object, 255, 255, 255, 255);
4615 }
4616 else
4617 {
4613 evas_object_color_set(ep->object, 4618 evas_object_color_set(ep->object,
4614 (pf->color.r * pf->color.a) / 255, 4619 (pf->color.r * pf->color.a) / 255,
4615 (pf->color.g * pf->color.a) / 255, 4620 (pf->color.g * pf->color.a) / 255,
4616 (pf->color.b * pf->color.a) / 255, 4621 (pf->color.b * pf->color.a) / 255,
4617 pf->color.a); 4622 pf->color.a);
4623 }
4618 4624
4619#ifdef HAVE_EPHYSICS 4625#ifdef HAVE_EPHYSICS
4620/* body attributes should be updated for invisible objects */ 4626/* body attributes should be updated for invisible objects */
@@ -4702,10 +4708,6 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
4702 } 4708 }
4703 break; 4709 break;
4704 4710
4705 case EDJE_PART_TYPE_TEXT:
4706 /* This is correctly handle in _edje_text_recalc_apply at the moment. */
4707 break;
4708
4709 case EDJE_PART_TYPE_GRADIENT: 4711 case EDJE_PART_TYPE_GRADIENT:
4710 /* FIXME: definitivly remove this code when we switch to new format. */ 4712 /* FIXME: definitivly remove this code when we switch to new format. */
4711 abort(); 4713 abort();
@@ -4910,9 +4912,6 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
4910 /* Some object need special recalc. */ 4912 /* Some object need special recalc. */
4911 switch (ep->part->type) 4913 switch (ep->part->type)
4912 { 4914 {
4913 case EDJE_PART_TYPE_TEXT:
4914 _edje_text_recalc_apply(ed, ep, pf, (Edje_Part_Description_Text*) chosen_desc, EINA_FALSE);
4915 break;
4916 4915
4917 case EDJE_PART_TYPE_PROXY: 4916 case EDJE_PART_TYPE_PROXY:
4918 _edje_proxy_recalc_apply(ed, ep, pf, (Edje_Part_Description_Proxy *)chosen_desc, pos); 4917 _edje_proxy_recalc_apply(ed, ep, pf, (Edje_Part_Description_Proxy *)chosen_desc, pos);
@@ -4930,6 +4929,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
4930 _edje_table_recalc_apply(ed, ep, pf, (Edje_Part_Description_Table *)chosen_desc); 4929 _edje_table_recalc_apply(ed, ep, pf, (Edje_Part_Description_Table *)chosen_desc);
4931 break; 4930 break;
4932 4931
4932 case EDJE_PART_TYPE_TEXT:
4933 case EDJE_PART_TYPE_TEXTBLOCK: 4933 case EDJE_PART_TYPE_TEXTBLOCK:
4934 _edje_textblock_recalc_apply(ed, ep, pf, (Edje_Part_Description_Text *)chosen_desc); 4934 _edje_textblock_recalc_apply(ed, ep, pf, (Edje_Part_Description_Text *)chosen_desc);
4935 break; 4935 break;