summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--NEWS2
-rw-r--r--src/lib/evas/Evas.h58
-rw-r--r--src/lib/evas/canvas/evas_object_text.c298
4 files changed, 338 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index dc598693a2..c593a9053b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
12012-12-12 Cedric Bail
2
3 * Add ellipsis support in Evas_Object_Text.
4
52012-12-12 ChunEon park <hermet@hermet.pe.kr>
6
7 * Fix the evas gl line incorrect position problem.
8
12012-12-11 Cedric Bail 92012-12-11 Cedric Bail
2 10
3 * Fix leak eet_pbkdf2_sha1 with OpenSSL. 11 * Fix leak eet_pbkdf2_sha1 with OpenSSL.
@@ -152,7 +160,3 @@
152 160
153 * Fix EINA_INLIST_FOREACH_SAFE macro to work when inlist is not the 161 * Fix EINA_INLIST_FOREACH_SAFE macro to work when inlist is not the
154 first item in the struct. 162 first item in the struct.
155
1562012-12-12 ChunEon park <hermet@hermet.pe.kr>
157
158 * Fix the evas gl line incorrect position problem.
diff --git a/NEWS b/NEWS
index 4bb4437a65..d3122b07a0 100644
--- a/NEWS
+++ b/NEWS
@@ -39,6 +39,8 @@ Additions:
39 * ecore_evas_buffer: 39 * ecore_evas_buffer:
40 - Add window profile support. 40 - Add window profile support.
41 * ecore_getopt: add ECORE_GETOPT_ACTION_BREAK 41 * ecore_getopt: add ECORE_GETOPT_ACTION_BREAK
42 * evas:
43 - Add ellipsis support in Evas_Object_Text.
42 44
43Deprecations: 45Deprecations:
44 * ecore_x: 46 * ecore_x:
diff --git a/src/lib/evas/Evas.h b/src/lib/evas/Evas.h
index 8c30a1dde6..03b698a51e 100644
--- a/src/lib/evas/Evas.h
+++ b/src/lib/evas/Evas.h
@@ -9583,6 +9583,8 @@ enum
9583 EVAS_OBJ_TEXT_SUB_ID_OUTLINE_COLOR_SET, 9583 EVAS_OBJ_TEXT_SUB_ID_OUTLINE_COLOR_SET,
9584 EVAS_OBJ_TEXT_SUB_ID_OUTLINE_COLOR_GET, 9584 EVAS_OBJ_TEXT_SUB_ID_OUTLINE_COLOR_GET,
9585 EVAS_OBJ_TEXT_SUB_ID_STYLE_PAD_GET, 9585 EVAS_OBJ_TEXT_SUB_ID_STYLE_PAD_GET,
9586 EVAS_OBJ_TEXT_SUB_ID_ELLIPSIS_SET,
9587 EVAS_OBJ_TEXT_SUB_ID_ELLIPSIS_GET,
9586 EVAS_OBJ_TEXT_SUB_ID_LAST 9588 EVAS_OBJ_TEXT_SUB_ID_LAST
9587}; 9589};
9588 9590
@@ -9978,6 +9980,36 @@ enum
9978 */ 9980 */
9979#define evas_obj_text_style_pad_get(l, r, t, b) EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_STYLE_PAD_GET), EO_TYPECHECK(int *, l), EO_TYPECHECK(int *, r), EO_TYPECHECK(int *, t), EO_TYPECHECK(int *, b) 9981#define evas_obj_text_style_pad_get(l, r, t, b) EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_STYLE_PAD_GET), EO_TYPECHECK(int *, l), EO_TYPECHECK(int *, r), EO_TYPECHECK(int *, t), EO_TYPECHECK(int *, b)
9980 9982
9983
9984/**
9985 * @def evas_obj_text_ellipsis_set
9986 * @since 1.8
9987 *
9988 * Sets the ellipsis to apply on the given text object.
9989 * 0.0 -> means apply ellipsis on the right end of the text,
9990 * 1.0 -> means apply ellipsis on the start left of the text.
9991 *
9992 * @param[in] ellipsis in
9993 *
9994 * @see evas_object_text_ellipsis_get
9995 */
9996#define evas_obj_text_ellipsis_set(ellipsis) EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_ELLIPSIS_SET), EO_TYPECHECK(double, ellipsis)
9997
9998/**
9999 * @def evas_obj_text_ellipsis_get
10000 * @since 1.8
10001 *
10002 * Sets the ellipsis to apply on the given text object.
10003 * 0.0 -> means apply ellipsis on the right end of the text,
10004 * 1.0 -> means apply ellipsis on the start left of the text.
10005 * value below 0, means no ellipsis.
10006 *
10007 * @param[out] ellipsis out
10008 *
10009 * @see evas_object_text_ellipsis_set
10010 */
10011#define evas_obj_text_ellipsis_get(ellipsis) EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_ELLIPSIS_GET), EO_TYPECHECK(double *, ellipsis)
10012
9981/** 10013/**
9982 * Creates a new text object on the provided canvas. 10014 * Creates a new text object on the provided canvas.
9983 * 10015 *
@@ -10102,6 +10134,32 @@ EAPI void evas_object_text_bidi_delimiters_set(Evas_Object *obj,
10102 */ 10134 */
10103EAPI const char *evas_object_text_bidi_delimiters_get(const Evas_Object *obj); 10135EAPI const char *evas_object_text_bidi_delimiters_get(const Evas_Object *obj);
10104 10136
10137/**
10138 * @brief Sets the ellipsis that should be used for the text object.
10139 *
10140 * This is a value between 0.0 and 1.0 indicating the position of the text
10141 * to be shown. 0.0 means the start will be shown and the end trimmed, 1.0
10142 * means the beginning will be trimmed and the end will be shown, and any value
10143 * in between will cause ellipsis to be added in both end of the text and the
10144 * requested part to be shown.
10145 * -1.0 means ellipsis is turned off.
10146 *
10147 * @param obj The given text object.
10148 * @param ellipsis the ellipsis.
10149 * @since 1.8
10150 */
10151EAPI void evas_object_text_ellipsis_set(Evas_Object *obj, double ellipsis);
10152
10153/**
10154 * @brief Gets the ellipsis currently set on the text object.
10155 *
10156 * @param obj The given text object.
10157 * @return The ellipsis set on the text object.
10158 * @see evas_object_text_ellipsis_set.
10159 * @since 1.8
10160 */
10161EAPI double evas_object_text_ellipsis_get(const Evas_Object *obj);
10162
10105EAPI Evas_Coord evas_object_text_ascent_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); 10163EAPI Evas_Coord evas_object_text_ascent_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
10106EAPI Evas_Coord evas_object_text_descent_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); 10164EAPI Evas_Coord evas_object_text_descent_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
10107EAPI Evas_Coord evas_object_text_max_ascent_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); 10165EAPI Evas_Coord evas_object_text_max_ascent_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
diff --git a/src/lib/evas/canvas/evas_object_text.c b/src/lib/evas/canvas/evas_object_text.c
index b69798e17f..f31cd769ba 100644
--- a/src/lib/evas/canvas/evas_object_text.c
+++ b/src/lib/evas/canvas/evas_object_text.c
@@ -33,6 +33,7 @@ struct _Evas_Object_Text
33 } outline, shadow, glow, glow2; 33 } outline, shadow, glow, glow2;
34 34
35 unsigned char style; 35 unsigned char style;
36 double ellipsis;
36 } cur, prev; 37 } cur, prev;
37 38
38 float ascent, descent; 39 float ascent, descent;
@@ -132,18 +133,21 @@ _evas_object_text_item_clean(Evas_Object_Text_Item *it)
132} 133}
133 134
134static void 135static void
135_evas_object_text_items_clear(Evas_Object_Text *o) 136_evas_object_text_item_del(Evas_Object_Text *o, Evas_Object_Text_Item *it)
136{ 137{
137 Evas_Object_Text_Item *it; 138 o->items = (Evas_Object_Text_Item *) eina_inlist_remove(
139 EINA_INLIST_GET(o->items),
140 EINA_INLIST_GET(it));
141 _evas_object_text_item_clean(it);
142 free(it);
143}
138 144
145static void
146_evas_object_text_items_clear(Evas_Object_Text *o)
147{
139 while (o->items) 148 while (o->items)
140 { 149 {
141 it = o->items; 150 _evas_object_text_item_del(o, o->items);
142 o->items = (Evas_Object_Text_Item *) eina_inlist_remove(
143 EINA_INLIST_GET(o->items),
144 EINA_INLIST_GET(it));
145 _evas_object_text_item_clean(it);
146 free(it);
147 } 151 }
148} 152}
149 153
@@ -453,6 +457,16 @@ _text_font_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
453 if (size) *size = o->cur.size; 457 if (size) *size = o->cur.size;
454} 458}
455 459
460static void
461_evas_object_text_item_update_sizes(Evas_Object_Protected_Data *obj, Evas_Object_Text *o, Evas_Object_Text_Item *it)
462{
463 ENFN->font_string_size_get(ENDT,
464 o->font,
465 &it->text_props,
466 &it->w, &it->h);
467 it->adv = ENFN->font_h_advance_get(ENDT, o->font,
468 &it->text_props);
469}
456 470
457/** 471/**
458 * @internal 472 * @internal
@@ -463,11 +477,12 @@ _text_font_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
463 * @param str the string to use. 477 * @param str the string to use.
464 */ 478 */
465static Evas_Object_Text_Item * 479static Evas_Object_Text_Item *
466_evas_object_text_item_new(Evas_Object *eo_obj, Evas_Object_Text *o, 480_evas_object_text_item_new(Evas_Object_Protected_Data *obj,
467 Evas_Font_Instance *fi, const Eina_Unicode *str, Evas_Script_Type script, 481 Evas_Object_Text *o,
468 size_t pos, size_t visual_pos, size_t len) 482 Evas_Font_Instance *fi, const Eina_Unicode *str,
483 Evas_Script_Type script,
484 size_t pos, size_t visual_pos, size_t len)
469{ 485{
470 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
471 Evas_Object_Text_Item *it; 486 Evas_Object_Text_Item *it;
472 487
473 it = calloc(1, sizeof(Evas_Object_Text_Item)); 488 it = calloc(1, sizeof(Evas_Object_Text_Item));
@@ -482,13 +497,7 @@ _evas_object_text_item_new(Evas_Object *eo_obj, Evas_Object_Text *o,
482 ENFN->font_text_props_info_create(ENDT, 497 ENFN->font_text_props_info_create(ENDT,
483 fi, str + pos, &it->text_props, 498 fi, str + pos, &it->text_props,
484 o->bidi_par_props, it->text_pos, len, EVAS_TEXT_PROPS_MODE_SHAPE); 499 o->bidi_par_props, it->text_pos, len, EVAS_TEXT_PROPS_MODE_SHAPE);
485 500 _evas_object_text_item_update_sizes(obj, o, it);
486 ENFN->font_string_size_get(ENDT,
487 o->font,
488 &it->text_props,
489 &it->w, &it->h);
490 it->adv = ENFN->font_h_advance_get(ENDT, o->font,
491 &it->text_props);
492 } 501 }
493 o->items = (Evas_Object_Text_Item *) 502 o->items = (Evas_Object_Text_Item *)
494 eina_inlist_append(EINA_INLIST_GET(o->items), EINA_INLIST_GET(it)); 503 eina_inlist_append(EINA_INLIST_GET(o->items), EINA_INLIST_GET(it));
@@ -549,6 +558,52 @@ _evas_object_text_item_order(Evas_Object *eo_obj, Evas_Object_Text *o)
549} 558}
550 559
551/** 560/**
561 * Create ellipsis.
562 */
563static const Eina_Unicode _ellip_str[2] = { 0x2026, '\0' };
564
565/* FIXME: We currently leak ellipsis items. */
566static Evas_Object_Text_Item *
567_layout_ellipsis_item_new(Evas_Object_Protected_Data *obj, Evas_Object_Text *o, Evas_Object_Text_Item *ti)
568{
569 Evas_Object_Text_Item *ellip_ti;
570 size_t len = 1; /* The length of _ellip_str */
571
572 ellip_ti = _evas_object_text_item_new(obj, o, ti->text_props.font_instance,
573 _ellip_str, ti->text_props.script, 0, 0, len);
574
575 return ellip_ti;
576}
577
578/* EINA_TRUE if this item is ok and should be included, false if should be
579 * discarded. */
580static Eina_Bool
581_layout_text_item_trim(Evas_Object_Protected_Data *obj, Evas_Object_Text *o, Evas_Object_Text_Item *ti, int idx, Eina_Bool want_start)
582{
583 Evas_Text_Props new_text_props;
584 if (idx >= (int) ti->text_props.len)
585 return EINA_FALSE;
586
587 memset(&new_text_props, 0, sizeof (new_text_props));
588
589 evas_common_text_props_split(&ti->text_props, &new_text_props, idx);
590 if (want_start)
591 {
592 evas_common_text_props_content_unref(&new_text_props);
593 }
594 else
595 {
596 evas_common_text_props_content_unref(&ti->text_props);
597 memcpy(&ti->text_props, &new_text_props, sizeof(ti->text_props));
598 ti->text_pos += idx;
599 ti->visual_pos += idx;
600 }
601 _evas_object_text_item_update_sizes(obj, o, ti);
602
603 return EINA_TRUE;
604}
605
606/**
552 * @internal 607 * @internal
553 * Populates o->items with the items of the text according to text 608 * Populates o->items with the items of the text according to text
554 * 609 *
@@ -561,6 +616,7 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, const Eina_Un
561{ 616{
562 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 617 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
563 EvasBiDiStrIndex *v_to_l = NULL; 618 EvasBiDiStrIndex *v_to_l = NULL;
619 Evas_Coord advance = 0;
564 size_t pos, visual_pos; 620 size_t pos, visual_pos;
565 int len = eina_unicode_strlen(text); 621 int len = eina_unicode_strlen(text);
566#ifdef BIDI_SUPPORT 622#ifdef BIDI_SUPPORT
@@ -591,6 +647,7 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, const Eina_Un
591 647
592 while (script_len > 0) 648 while (script_len > 0)
593 { 649 {
650 const Evas_Object_Text_Item *it;
594 Evas_Font_Instance *cur_fi = NULL; 651 Evas_Font_Instance *cur_fi = NULL;
595 int run_len = script_len; 652 int run_len = script_len;
596 if (o->font) 653 if (o->font)
@@ -605,20 +662,190 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Object_Text *o, const Eina_Un
605#else 662#else
606 visual_pos = pos; 663 visual_pos = pos;
607#endif 664#endif
608 _evas_object_text_item_new(eo_obj, o, cur_fi, text, script, 665 it = _evas_object_text_item_new(obj, o, cur_fi, text, script,
609 pos, visual_pos, run_len); 666 pos, visual_pos, run_len);
610 667
668 advance += it->adv;
611 pos += run_len; 669 pos += run_len;
612 script_len -= run_len; 670 script_len -= run_len;
613 len -= run_len; 671 len -= run_len;
614 } 672 }
615 } 673 }
616 674
675 /* Handle ellipsis */
676 if ((o->cur.ellipsis >= 0.0) && (advance > obj->cur.geometry.w) && (obj->cur.geometry.w > 0))
677 {
678 Evas_Coord ellip_frame = obj->cur.geometry.w;
679 Evas_Object_Text_Item *start_ellip_it = NULL, *end_ellip_it = NULL;
680 /* Account of the ellipsis item width. As long as ellipsis != 0
681 * we have a left ellipsis. And the same with 1 and right. */
682 if (o->cur.ellipsis != 0)
683 {
684 start_ellip_it = _layout_ellipsis_item_new(obj, o, o->items);
685 ellip_frame -= start_ellip_it->adv;
686 }
687 if (o->cur.ellipsis != 1)
688 {
689 /* FIXME: Should take the last item's font and style and etc. *//* weird it's a text, should always have the same style/font */
690 end_ellip_it = _layout_ellipsis_item_new(obj, o, o->items);
691 ellip_frame -= end_ellip_it->adv;
692 }
693
694 /* The point where we should start from, going for the full
695 * ellip frame. */
696 Evas_Coord ellipsis_coord = o->cur.ellipsis * (advance - ellip_frame);
697 if (start_ellip_it)
698 {
699 Evas_Object_Text_Item *itr = o->items;
700 advance = 0;
701
702 while (itr && (advance + itr->adv < ellipsis_coord))
703 {
704 Eina_Inlist *itrn = EINA_INLIST_GET(itr)->next;
705 if ((itr != start_ellip_it) && (itr != end_ellip_it))
706 {
707 advance += itr->adv;
708 _evas_object_text_item_del(o, itr);
709 }
710 itr = (Evas_Object_Text_Item *) itrn;
711 }
712 if (itr && (itr != start_ellip_it))
713 {
714 int cut = 1 + ENFN->font_char_at_coords_get(ENDT,
715 o->font,
716 &itr->text_props,
717 ellipsis_coord - advance,
718 0,
719 NULL, NULL, NULL, NULL);
720 if (cut > 0)
721 {
722 start_ellip_it->text_pos = itr->text_pos;
723 start_ellip_it->visual_pos = itr->visual_pos;
724 if (!_layout_text_item_trim(obj, o, itr, cut, EINA_FALSE))
725 {
726 _evas_object_text_item_del(o, itr);
727 }
728 }
729 }
730
731 o->items = (Evas_Object_Text_Item *) eina_inlist_remove(EINA_INLIST_GET(o->items), EINA_INLIST_GET(start_ellip_it));
732 o->items = (Evas_Object_Text_Item *) eina_inlist_prepend(EINA_INLIST_GET(o->items), EINA_INLIST_GET(start_ellip_it));
733 }
734
735 if (end_ellip_it)
736 {
737 Evas_Object_Text_Item *itr = o->items;
738 advance = 0;
739
740 while (itr)
741 {
742 if (itr != end_ellip_it) /* was start_ellip_it */
743 {
744 if (advance + itr->adv >= ellip_frame)
745 {
746 break;
747 }
748 advance += itr->adv;
749 }
750 itr = (Evas_Object_Text_Item *) EINA_INLIST_GET(itr)->next;
751 }
752
753 if (itr == end_ellip_it)
754 {
755 /* FIXME: We shouldn't do anything. */
756 }
757
758 int cut = ENFN->font_char_at_coords_get(ENDT,
759 o->font,
760 &itr->text_props,
761 ellip_frame - advance,
762 0,
763 NULL, NULL, NULL, NULL);
764 if (cut >= 0)
765 {
766 end_ellip_it->text_pos = itr->text_pos + cut;
767 end_ellip_it->visual_pos = itr->visual_pos + cut;
768 if (_layout_text_item_trim(obj, o, itr, cut, EINA_TRUE))
769 {
770 itr = (Evas_Object_Text_Item *) EINA_INLIST_GET(itr)->next;
771 }
772 }
773
774 /* Remove the rest of the items */
775 while (itr)
776 {
777 Eina_Inlist *itrn = EINA_INLIST_GET(itr)->next;
778 if ((itr != start_ellip_it) && (itr != end_ellip_it))
779 _evas_object_text_item_del(o, itr);
780 itr = (Evas_Object_Text_Item *) itrn;
781 }
782 }
783 }
784
617 _evas_object_text_item_order(eo_obj, o); 785 _evas_object_text_item_order(eo_obj, o);
618 786
619 if (v_to_l) free(v_to_l); 787 if (v_to_l) free(v_to_l);
620} 788}
621 789
790EAPI void
791evas_object_text_ellipsis_set(Evas_Object *obj, double ellipsis)
792{
793 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
794 return;
795 MAGIC_CHECK_END();
796 eo_do(obj, evas_obj_text_ellipsis_set(ellipsis));
797}
798
799static void
800_text_resize(void *data EINA_UNUSED,
801 Evas *e EINA_UNUSED,
802 Evas_Object *obj EINA_UNUSED,
803 void *event_info EINA_UNUSED)
804{
805 _evas_object_text_recalc(obj);
806}
807
808static void
809_text_ellipsis_set(Eo *eo_obj, void *_pd, va_list *list)
810{
811 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
812 Evas_Object_Text *o = _pd;
813 double ellipsis = va_arg(*list, double);
814
815 if (o->cur.ellipsis == ellipsis) return ;
816
817 o->cur.ellipsis = ellipsis;
818 o->changed = 1;
819 evas_object_change(eo_obj, obj);
820 evas_object_clip_dirty(eo_obj, obj);
821
822 evas_object_event_callback_del_full(eo_obj, EVAS_CALLBACK_RESIZE,
823 _text_resize, o);
824 evas_object_event_callback_add(eo_obj, EVAS_CALLBACK_RESIZE,
825 _text_resize, o);
826}
827
828EAPI double
829evas_object_text_ellipsis_get(const Evas_Object *obj)
830{
831 double r = 0;
832
833 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
834 return 0;
835 MAGIC_CHECK_END();
836
837 eo_do((Eo*) obj, evas_obj_text_ellipsis_get(&r));
838 return r;
839}
840
841static void
842_text_ellipsis_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
843{
844 const Evas_Object_Text *o = _pd;
845 double *r = va_arg(*list, double *);
846
847 *r = o->cur.ellipsis;
848}
622 849
623EAPI void 850EAPI void
624evas_object_text_text_set(Evas_Object *eo_obj, const char *_text) 851evas_object_text_text_set(Evas_Object *eo_obj, const char *_text)
@@ -1072,10 +1299,13 @@ _text_style_set(Eo *eo_obj, void *_pd, va_list *list)
1072 evas_text_style_pad_get(o->cur.style, &pl, &pr, &pt, &pb); 1299 evas_text_style_pad_get(o->cur.style, &pl, &pr, &pt, &pb);
1073 o->cur.style = style; 1300 o->cur.style = style;
1074 evas_text_style_pad_get(o->cur.style, &l, &r, &t, &b); 1301 evas_text_style_pad_get(o->cur.style, &l, &r, &t, &b);
1075 if (o->items) 1302 if (o->cur.ellipsis >= 0)
1076 obj->cur.geometry.w += (l - pl) + (r - pr); 1303 {
1077 else 1304 if (o->items)
1078 obj->cur.geometry.w = 0; 1305 obj->cur.geometry.w += (l - pl) + (r - pr);
1306 else
1307 obj->cur.geometry.w = 0;
1308 }
1079 obj->cur.geometry.h += (t - pt) + (b - pb); 1309 obj->cur.geometry.h += (t - pt) + (b - pb);
1080 evas_object_change(eo_obj, obj); 1310 evas_object_change(eo_obj, obj);
1081 evas_object_clip_dirty(eo_obj, obj); 1311 evas_object_clip_dirty(eo_obj, obj);
@@ -1540,6 +1770,7 @@ evas_object_text_init(Evas_Object *eo_obj)
1540 1770
1541 Evas_Object_Text *o = eo_data_get(eo_obj, MY_CLASS); 1771 Evas_Object_Text *o = eo_data_get(eo_obj, MY_CLASS);
1542 /* alloc obj private data */ 1772 /* alloc obj private data */
1773 o->cur.ellipsis = -1.0;
1543 o->prev = o->cur; 1774 o->prev = o->cur;
1544#ifdef BIDI_SUPPORT 1775#ifdef BIDI_SUPPORT
1545 o->bidi_par_props = evas_bidi_paragraph_props_new(); 1776 o->bidi_par_props = evas_bidi_paragraph_props_new();
@@ -1823,7 +2054,6 @@ evas_object_text_render_pre(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj
1823{ 2054{
1824 Evas_Object_Text *o = eo_data_get(eo_obj, MY_CLASS); 2055 Evas_Object_Text *o = eo_data_get(eo_obj, MY_CLASS);
1825 int is_v, was_v; 2056 int is_v, was_v;
1826
1827 /* dont pre-render the obj twice! */ 2057 /* dont pre-render the obj twice! */
1828 if (obj->pre_render_done) return; 2058 if (obj->pre_render_done) return;
1829 obj->pre_render_done = 1; 2059 obj->pre_render_done = 1;
@@ -1839,6 +2069,14 @@ evas_object_text_render_pre(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj
1839 evas_object_clip_recalc(obj->cur.eo_clipper, obj->cur.clipper); 2069 evas_object_clip_recalc(obj->cur.eo_clipper, obj->cur.clipper);
1840 obj->cur.clipper->func->render_pre(obj->cur.eo_clipper, obj->cur.clipper); 2070 obj->cur.clipper->func->render_pre(obj->cur.eo_clipper, obj->cur.clipper);
1841 } 2071 }
2072 /* If object size changed and ellipsis is set */
2073 if ((o->cur.ellipsis >= 0.0 ||
2074 o->cur.ellipsis != o->prev.ellipsis) &&
2075 ((obj->cur.geometry.w != obj->prev.geometry.w) ||
2076 (obj->cur.geometry.h != obj->prev.geometry.h)))
2077 {
2078 _evas_object_text_recalc(eo_obj);
2079 }
1842 /* now figure what changed and add draw rects 2080 /* now figure what changed and add draw rects
1843 if it just became visible or invisible */ 2081 if it just became visible or invisible */
1844 is_v = evas_object_is_visible(eo_obj, obj); 2082 is_v = evas_object_is_visible(eo_obj, obj);
@@ -2063,7 +2301,7 @@ _evas_object_text_recalc(Evas_Object *eo_obj)
2063 w = _evas_object_text_horiz_advance_get(eo_obj, o); 2301 w = _evas_object_text_horiz_advance_get(eo_obj, o);
2064 h = _evas_object_text_vert_advance_get(eo_obj, o); 2302 h = _evas_object_text_vert_advance_get(eo_obj, o);
2065 evas_text_style_pad_get(o->cur.style, &l, &r, &t, &b); 2303 evas_text_style_pad_get(o->cur.style, &l, &r, &t, &b);
2066 obj->cur.geometry.w = w + l + r; 2304 obj->cur.geometry.w = w + l + r;
2067 obj->cur.geometry.h = h + t + b; 2305 obj->cur.geometry.h = h + t + b;
2068//// obj->cur.cache.geometry.validity = 0; 2306//// obj->cur.cache.geometry.validity = 0;
2069 } 2307 }
@@ -2072,7 +2310,7 @@ _evas_object_text_recalc(Evas_Object *eo_obj)
2072 int t = 0, b = 0; 2310 int t = 0, b = 0;
2073 2311
2074 evas_text_style_pad_get(o->cur.style, NULL, NULL, &t, &b); 2312 evas_text_style_pad_get(o->cur.style, NULL, NULL, &t, &b);
2075 obj->cur.geometry.w = 0; 2313 obj->cur.geometry.w = 0;
2076 obj->cur.geometry.h = o->max_ascent + o->max_descent + t + b; 2314 obj->cur.geometry.h = o->max_ascent + o->max_descent + t + b;
2077//// obj->cur.cache.geometry.validity = 0; 2315//// obj->cur.cache.geometry.validity = 0;
2078 } 2316 }
@@ -2114,6 +2352,8 @@ _class_constructor(Eo_Class *klass)
2114 EO_OP_FUNC(EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_OUTLINE_COLOR_SET), _text_outline_color_set), 2352 EO_OP_FUNC(EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_OUTLINE_COLOR_SET), _text_outline_color_set),
2115 EO_OP_FUNC(EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_OUTLINE_COLOR_GET), _text_outline_color_get), 2353 EO_OP_FUNC(EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_OUTLINE_COLOR_GET), _text_outline_color_get),
2116 EO_OP_FUNC(EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_STYLE_PAD_GET), _text_style_pad_get), 2354 EO_OP_FUNC(EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_STYLE_PAD_GET), _text_style_pad_get),
2355 EO_OP_FUNC(EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_ELLIPSIS_SET), _text_ellipsis_set),
2356 EO_OP_FUNC(EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_ELLIPSIS_GET), _text_ellipsis_get),
2117 EO_OP_FUNC_SENTINEL 2357 EO_OP_FUNC_SENTINEL
2118 }; 2358 };
2119 eo_class_funcs_set(klass, func_desc); 2359 eo_class_funcs_set(klass, func_desc);
@@ -2149,6 +2389,8 @@ static const Eo_Op_Description op_desc[] = {
2149 EO_OP_DESCRIPTION(EVAS_OBJ_TEXT_SUB_ID_OUTLINE_COLOR_SET, "Sets the outline color for the given text object."), 2389 EO_OP_DESCRIPTION(EVAS_OBJ_TEXT_SUB_ID_OUTLINE_COLOR_SET, "Sets the outline color for the given text object."),
2150 EO_OP_DESCRIPTION(EVAS_OBJ_TEXT_SUB_ID_OUTLINE_COLOR_GET, "Retrieves the outline color for the given text object."), 2390 EO_OP_DESCRIPTION(EVAS_OBJ_TEXT_SUB_ID_OUTLINE_COLOR_GET, "Retrieves the outline color for the given text object."),
2151 EO_OP_DESCRIPTION(EVAS_OBJ_TEXT_SUB_ID_STYLE_PAD_GET, "Gets the text style pad of a text object."), 2391 EO_OP_DESCRIPTION(EVAS_OBJ_TEXT_SUB_ID_STYLE_PAD_GET, "Gets the text style pad of a text object."),
2392 EO_OP_DESCRIPTION(EVAS_OBJ_TEXT_SUB_ID_ELLIPSIS_SET, "Gets the ellipsis of a text object."),
2393 EO_OP_DESCRIPTION(EVAS_OBJ_TEXT_SUB_ID_ELLIPSIS_GET, "Sets the ellipsis of a text object."),
2152 EO_OP_DESCRIPTION_SENTINEL 2394 EO_OP_DESCRIPTION_SENTINEL
2153}; 2395};
2154static const Eo_Class_Description class_desc = { 2396static const Eo_Class_Description class_desc = {