summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@samsung.com>2013-10-01 20:34:03 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-10-01 20:45:21 +0900
commit5487b7563567b724d2e81c1037538668377b3c12 (patch)
tree7eabec90dfa166d0176b7965dfcc185e77fc6958 /src
parentfdea402d32810b3fd4384a177714d4f0c2e74a6a (diff)
evas: fix some ellipsis case.
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/canvas/evas_object_text.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/src/lib/evas/canvas/evas_object_text.c b/src/lib/evas/canvas/evas_object_text.c
index 9dc2e6e4f7..29057d2468 100644
--- a/src/lib/evas/canvas/evas_object_text.c
+++ b/src/lib/evas/canvas/evas_object_text.c
@@ -46,6 +46,7 @@ struct _Evas_Object_Text
46 Evas_Object_Text_Item *ellipsis_end; 46 Evas_Object_Text_Item *ellipsis_end;
47 Evas_Coord w, h; 47 Evas_Coord w, h;
48 int advance; 48 int advance;
49 Eina_Bool ellipsis;
49 } last_computed; 50 } last_computed;
50 51
51 Evas_BiDi_Paragraph_Props *bidi_par_props; 52 Evas_BiDi_Paragraph_Props *bidi_par_props;
@@ -708,9 +709,11 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, Eina_Unicode
708 !memcmp(&o->cur, &o->prev, sizeof (o->cur)) && 709 !memcmp(&o->cur, &o->prev, sizeof (o->cur)) &&
709 o->cur.text == text && 710 o->cur.text == text &&
710 obj->cur->scale == obj->prev->scale && 711 obj->cur->scale == obj->prev->scale &&
711 o->last_computed.advance <= obj->cur->geometry.w) 712 ((o->last_computed.advance <= obj->cur->geometry.w && !o->last_computed.ellipsis) ||
713 o->last_computed.w == obj->cur->geometry.w))
712 return; 714 return;
713 715
716 o->last_computed.ellipsis = EINA_FALSE;
714 evas_object_content_change(eo_obj, obj); 717 evas_object_content_change(eo_obj, obj);
715 718
716 if (o->items) _evas_object_text_items_clean(obj, o); 719 if (o->items) _evas_object_text_items_clean(obj, o);
@@ -776,10 +779,11 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, Eina_Unicode
776 } 779 }
777 780
778 /* Handle ellipsis */ 781 /* Handle ellipsis */
779 if ((o->cur.ellipsis >= 0.0) && (advance > obj->cur->geometry.w) && (obj->cur->geometry.w > 0)) 782 if (pos && (o->cur.ellipsis >= 0.0) && (advance > obj->cur->geometry.w) && (obj->cur->geometry.w > 0))
780 { 783 {
781 Evas_Coord ellip_frame = obj->cur->geometry.w; 784 Evas_Coord ellip_frame = obj->cur->geometry.w;
782 Evas_Object_Text_Item *start_ellip_it = NULL, *end_ellip_it = NULL; 785 Evas_Object_Text_Item *start_ellip_it = NULL, *end_ellip_it = NULL;
786
783 /* Account of the ellipsis item width. As long as ellipsis != 0 787 /* Account of the ellipsis item width. As long as ellipsis != 0
784 * we have a left ellipsis. And the same with 1 and right. */ 788 * we have a left ellipsis. And the same with 1 and right. */
785 if (o->cur.ellipsis != 0) 789 if (o->cur.ellipsis != 0)
@@ -841,12 +845,14 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, Eina_Unicode
841 0); 845 0);
842 if (cut > 0) 846 if (cut > 0)
843 { 847 {
848
844 start_ellip_it->text_pos = itr->text_pos; 849 start_ellip_it->text_pos = itr->text_pos;
845 start_ellip_it->visual_pos = itr->visual_pos; 850 start_ellip_it->visual_pos = itr->visual_pos;
846 if (!_layout_text_item_trim(obj, o, itr, cut, EINA_FALSE)) 851 if (!_layout_text_item_trim(obj, o, itr, cut, EINA_FALSE))
847 { 852 {
848 _evas_object_text_item_del(o, itr); 853 _evas_object_text_item_del(o, itr);
849 } 854 }
855 o->last_computed.ellipsis = EINA_TRUE;
850 } 856 }
851 } 857 }
852 858
@@ -890,6 +896,7 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, Eina_Unicode
890 { 896 {
891 itr = (Evas_Object_Text_Item *) EINA_INLIST_GET(itr)->next; 897 itr = (Evas_Object_Text_Item *) EINA_INLIST_GET(itr)->next;
892 } 898 }
899 o->last_computed.ellipsis = EINA_TRUE;
893 } 900 }
894 901
895 /* Remove the rest of the items */ 902 /* Remove the rest of the items */
@@ -897,7 +904,7 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, Eina_Unicode
897 { 904 {
898 Eina_Inlist *itrn = EINA_INLIST_GET(itr)->next; 905 Eina_Inlist *itrn = EINA_INLIST_GET(itr)->next;
899 if ((itr != start_ellip_it) && (itr != end_ellip_it)) 906 if ((itr != start_ellip_it) && (itr != end_ellip_it))
900 _evas_object_text_item_del(o, itr); 907 _evas_object_text_item_del(o, itr);
901 itr = (Evas_Object_Text_Item *) itrn; 908 itr = (Evas_Object_Text_Item *) itrn;
902 } 909 }
903 } 910 }
@@ -905,7 +912,18 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, Eina_Unicode
905 if (o->cur.text != text) free(o->cur.text); 912 if (o->cur.text != text) free(o->cur.text);
906 o->cur.text = text; 913 o->cur.text = text;
907 o->prev = o->cur; 914 o->prev = o->cur;
908 o->last_computed.advance = advance; 915
916 {
917 Evas_Object_Text_Item *itr = o->items;
918 advance = 0;
919
920 while (itr)
921 {
922 advance += itr->adv;
923 itr = (Evas_Object_Text_Item *) EINA_INLIST_GET(itr)->next;
924 }
925 o->last_computed.advance = advance;
926 }
909 927
910 _evas_object_text_item_order(eo_obj, o); 928 _evas_object_text_item_order(eo_obj, o);
911 929
@@ -2464,8 +2482,12 @@ _evas_object_text_recalc(Evas_Object *eo_obj, Eina_Unicode *text)
2464 h = _evas_object_text_vert_advance_get(eo_obj, o); 2482 h = _evas_object_text_vert_advance_get(eo_obj, o);
2465 evas_text_style_pad_get(o->cur.style, &l, &r, &t, &b); 2483 evas_text_style_pad_get(o->cur.style, &l, &r, &t, &b);
2466 2484
2467 eo_do_super(eo_obj, MY_CLASS, 2485 if (o->cur.ellipsis >= 0.0)
2468 evas_obj_size_set(w + l + r, h + t + b)); 2486 eo_do_super(eo_obj, MY_CLASS,
2487 evas_obj_size_set(obj->cur->geometry.w, h + t + b));
2488 else
2489 eo_do_super(eo_obj, MY_CLASS,
2490 evas_obj_size_set(w + l + r, h + t + b));
2469//// obj->cur->cache.geometry.validity = 0; 2491//// obj->cur->cache.geometry.validity = 0;
2470 } 2492 }
2471 else 2493 else
@@ -2473,6 +2495,7 @@ _evas_object_text_recalc(Evas_Object *eo_obj, Eina_Unicode *text)
2473 int t = 0, b = 0; 2495 int t = 0, b = 0;
2474 2496
2475 evas_text_style_pad_get(o->cur.style, NULL, NULL, &t, &b); 2497 evas_text_style_pad_get(o->cur.style, NULL, NULL, &t, &b);
2498
2476 eo_do_super(eo_obj, MY_CLASS, 2499 eo_do_super(eo_obj, MY_CLASS,
2477 evas_obj_size_set(0, o->max_ascent + o->max_descent + t + b)); 2500 evas_obj_size_set(0, o->max_ascent + o->max_descent + t + b));
2478//// obj->cur->cache.geometry.validity = 0; 2501//// obj->cur->cache.geometry.validity = 0;