herdsman pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=c0331b41ebf249b3f30db03ab189b332300c244c

commit c0331b41ebf249b3f30db03ab189b332300c244c
Author: Daniel Hirt <daniel.h...@samsung.com>
Date:   Mon Nov 28 13:22:40 2016 +0200

    Ui text: implement scrolling with line wrap
---
 src/lib/elementary/efl_ui_text.c | 79 +++++++++++++++++++++++++++++++++-------
 1 file changed, 66 insertions(+), 13 deletions(-)

diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c
index 2cf59ab..2410e8c 100644
--- a/src/lib/elementary/efl_ui_text.c
+++ b/src/lib/elementary/efl_ui_text.c
@@ -1062,25 +1062,78 @@ _cursor_geometry_recalc(Evas_Object *obj)
 EOLIAN static void
 _efl_ui_text_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Text_Data *sd)
 {
-   Evas_Coord vw = 0, vh = 0;
-   Evas_Coord minw, minh;
-   Eo *sw = edje_object_part_swallow_get(sd->entry_edje, "elm.text");
+   Evas_Coord minw, minh, resw, resh;
+
+   evas_object_geometry_get(obj, NULL, NULL, &resw, &resh);
+
+
+   if (!sd->changed && (sd->last_w == resw))
+     {
+        if (sd->scroll)
+          {
+             Evas_Coord vw = 0, vh = 0, h = 0;
+
+             // Called for line wrapping + scrolling; use the viewport
+             // width and the formatted height as proper constraints.
+             elm_interface_scrollable_content_viewport_geometry_get
+                (obj, NULL, NULL, &vw, &vh);
+
+             efl_canvas_text_size_formatted_get(obj, NULL, &h);
+             if (vh > h) h = vh;
+
+             evas_object_resize(sd->entry_edje, vw, h);
+          }
+        return;
+     }
 
    evas_event_freeze(evas_object_evas_get(obj));
-   /* Only implement single-line */
-   if (sd->scr_edje)
+   sd->changed = EINA_FALSE;
+   sd->last_w = resw;
+   if (sd->scroll)
      {
+        Evas_Coord vw = 0, vh = 0, vmw = 0, vmh = 0, w = -1, h = -1;
+
+        // XXX: no need for the following line. It's been commented out.
+        // sd->scr_edje is the resize_object of this widget. It's already
+        // resized when gfx_size_set was called on this widget.
+        //evas_object_resize(sd->scr_edje, resw, resh);
+
+        edje_object_size_min_calc(sd->scr_edje, &vmw, &vmh);
         elm_interface_scrollable_content_viewport_geometry_get
-              (obj, NULL, NULL, &vw, &vh);
-        //evas_object_geometry_get(sd->scr_edje, NULL, NULL, &resw, &resh);
-        //evas_object_resize(sd->entry_edje, resw, resh);
-        evas_object_resize(sw, vw, vh);
-        efl_canvas_text_size_formatted_get(sw, &minw, &minh);
-        evas_object_size_hint_min_set(sw, minw, vh);
-        edje_object_size_min_restricted_calc(sd->entry_edje, &minw, &minh, vw, 
0);
+           (obj, NULL, NULL, &vw, &vh);
+        edje_object_size_min_restricted_calc
+           (sd->entry_edje, &minw, &minh, vw, 0);
+        elm_coords_finger_size_adjust(1, &minw, 1, &minh);
+
+        /* This is a hack to workaround the way min size hints
+         * are treated.  If the minimum width is smaller than the
+         * restricted width, it means the minimum doesn't
+         * matter. */
+        if (minw <= vw)
+          {
+             Evas_Coord ominw = -1;
+
+             efl_gfx_size_hint_combined_min_get(sd->entry_edje, &ominw, NULL);
+             minw = ominw;
+          }
+        sd->ent_mw = minw;
+        sd->ent_mh = minh;
+
+        if ((minw > 0) && (vw < minw)) vw = minw;
+        if (minh > vh) vh = minh;
 
-        evas_object_resize(sd->entry_edje, minw, minh);
+        if (sd->single_line) h = vmh + minh;
+        else h = vmh;
+
+        evas_object_resize(sd->entry_edje, vw, vh);
+        evas_object_size_hint_min_set(obj, w, h);
+
+        if (sd->single_line)
+           evas_object_size_hint_max_set(obj, -1, h);
+        else
+           evas_object_size_hint_max_set(obj, -1, -1);
      }
+
    _cursor_geometry_recalc(obj);
    evas_event_thaw(evas_object_evas_get(obj));
    evas_event_thaw_eval(evas_object_evas_get(obj));

-- 


Reply via email to