From c668434565b080d406ecc10fe48bedb653de7174 Mon Sep 17 00:00:00 2001 From: Thiep Ha Date: Tue, 25 Jul 2017 17:06:53 +0900 Subject: change circle add api and direction --- src/bin/elementary/test_efl_ui_textpath.c | 8 +++--- src/lib/elementary/efl_ui_textpath.c | 41 +++++++++++++++---------------- src/lib/elementary/efl_ui_textpath.eo | 14 +++-------- 3 files changed, 28 insertions(+), 35 deletions(-) diff --git a/src/bin/elementary/test_efl_ui_textpath.c b/src/bin/elementary/test_efl_ui_textpath.c index 2471aba37f..c3c95116d3 100644 --- a/src/bin/elementary/test_efl_ui_textpath.c +++ b/src/bin/elementary/test_efl_ui_textpath.c @@ -31,11 +31,11 @@ elm_main(int argc, char *argv[]) //elm_object_text_set(txtpath, "abcd<eghi>j"); //efl_text_set(txtpath, "abcd<eghi>j more and more, so long to make it ellipsis? No, it is not enough, want to see more?xy"); - //efl_ui_textpath_circle_set(txtpath, 0, 0, 100, 0); + efl_ui_textpath_circle_set(txtpath, 0, 0, 100, 180, EFL_UI_TEXTPATH_DIRECTION_CCW); //efl_gfx_path_append_circle(txtpath, 200, 200, 100); - efl_gfx_path_append_arc(txtpath, 0, 0, 100, 100, 0, -90); - efl_gfx_path_append_line_to(txtpath, 100, 150); + //efl_gfx_path_append_arc(txtpath, 0, 0, 100, 100, 0, -90); + //efl_gfx_path_append_line_to(txtpath, 100, 150); //efl_gfx_path_append_move_to(txtpath, 200, 300); //efl_gfx_path_append_line_to(txtpath, 300, 350); @@ -44,7 +44,7 @@ elm_main(int argc, char *argv[]) //efl_gfx_path_append_line_to(txtpath, 200, 300); efl_ui_textpath_ellipsis_set(txtpath, EINA_TRUE); - efl_ui_textpath_autofit_set(txtpath, EINA_FALSE); + //efl_ui_textpath_autofit_set(txtpath, EINA_FALSE); efl_gfx_geometry_set(txtpath, 120, 120, 200, 200); efl_gfx_visible_set(txtpath, EINA_TRUE); diff --git a/src/lib/elementary/efl_ui_textpath.c b/src/lib/elementary/efl_ui_textpath.c index 52f4f4471f..90ca9e1249 100644 --- a/src/lib/elementary/efl_ui_textpath.c +++ b/src/lib/elementary/efl_ui_textpath.c @@ -19,7 +19,7 @@ #define PI 3.14159265 #define SLICE_MAX 200 -#define SLICE_DEFAULT_NO 69 +#define SLICE_DEFAULT_NO 99 typedef struct _Efl_Ui_Textpath_Point Efl_Ui_Textpath_Point; typedef struct _Efl_Ui_Textpath_Line Efl_Ui_Textpath_Line; @@ -62,7 +62,7 @@ struct _Efl_Ui_Textpath_Data { double radius; double start_angle; } circle; - Efl_Ui_Textpath_Orientation ori; + Efl_Ui_Textpath_Direction direction; int slice_no; Eina_Bool autofit; Eina_Bool ellipsis; @@ -844,8 +844,8 @@ _efl_ui_textpath_efl_object_constructor(Eo *obj, Efl_Ui_Textpath_Data *pd) ERR("in"); obj = efl_constructor(efl_super(obj, MY_CLASS)); pd->autofit = EINA_TRUE; - pd->slice_no = 99; - pd->ori = EFL_UI_TEXTPATH_ORIENTATION_LEFT_TO_RIGHT; + pd->slice_no = SLICE_DEFAULT_NO; + pd->direction = EFL_UI_TEXTPATH_DIRECTION_CW; return obj; } @@ -966,11 +966,12 @@ _efl_ui_textpath_efl_text_text_get(Eo *obj, Efl_Ui_Textpath_Data *pd) #endif EOLIAN static void -_efl_ui_textpath_circle_set(Eo *obj, Efl_Ui_Textpath_Data *pd, double x, double y, double radius, double start_angle) +_efl_ui_textpath_circle_set(Eo *obj, Efl_Ui_Textpath_Data *pd, double x, double y, double radius, double start_angle, Efl_Ui_Textpath_Direction direction) { if (pd->circle.x == x && pd->circle.y == y && pd->circle.radius == radius && - pd->circle.start_angle == start_angle) + pd->circle.start_angle == start_angle && + pd->direction == direction) { ERR("Same circle"); return; @@ -979,8 +980,19 @@ _efl_ui_textpath_circle_set(Eo *obj, Efl_Ui_Textpath_Data *pd, double x, double pd->circle.y = y; pd->circle.radius = radius; pd->circle.start_angle = start_angle; - - efl_gfx_path_append_arc(obj, x - radius, y - radius, radius * 2, radius * 2, start_angle, -360); + pd->direction = direction; + + if (direction == EFL_UI_TEXTPATH_DIRECTION_CW) + { + efl_gfx_path_append_arc(obj, x - radius, y - radius, radius * 2, + radius * 2, start_angle, -360); + } + else + { + efl_gfx_path_append_arc(obj, x - radius, y - radius, radius * 2, + radius * 2, start_angle, 360); + } + if (pd->content) { @@ -990,19 +1002,6 @@ _efl_ui_textpath_circle_set(Eo *obj, Efl_Ui_Textpath_Data *pd, double x, double _sizing_eval(obj, pd); } -EOLIAN static Efl_Ui_Textpath_Orientation -_efl_ui_textpath_orientation_get(Eo *obj, Efl_Ui_Textpath_Data *pd) -{ - return pd->ori; -} - -EOLIAN static void -_efl_ui_textpath_orientation_set(Eo *obj, Efl_Ui_Textpath_Data *pd, Efl_Ui_Textpath_Orientation orientation) -{ - if (pd->ori == orientation) return; - pd->ori = orientation; -} - EOLIAN static Eina_Bool _efl_ui_textpath_autofit_get(Eo *obj, Efl_Ui_Textpath_Data *pd) { diff --git a/src/lib/elementary/efl_ui_textpath.eo b/src/lib/elementary/efl_ui_textpath.eo index 2fadb52677..c405893b17 100644 --- a/src/lib/elementary/efl_ui_textpath.eo +++ b/src/lib/elementary/efl_ui_textpath.eo @@ -1,6 +1,6 @@ -enum Efl.Ui.Textpath.Orientation { - left_to_right, - right_to_left +enum Efl.Ui.Textpath.Direction { + cw, + ccw } class Efl.Ui.Textpath (Elm.Layout, Efl.Object, Efl.Text, Efl.Gfx.Path) @@ -15,13 +15,7 @@ class Efl.Ui.Textpath (Elm.Layout, Efl.Object, Efl.Text, Efl.Gfx.Path) @in y: double; @in radius: double; @in start_angle: double; - } - } - @property orientation { - [[The orientation where text is placed: - left-to-right or right-to-left]] - values { - orient: Efl.Ui.Textpath.Orientation; + @in direction: Efl.Ui.Textpath.Direction; } } @property autofit { -- cgit v1.2.1