summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiep Ha <thiepha@gmail.com>2017-07-25 17:06:53 +0900
committerThiep Ha <thiepha@gmail.com>2017-07-25 17:13:39 +0900
commitc668434565b080d406ecc10fe48bedb653de7174 (patch)
treed2b1185de62608dbbeeb76bb41c49ad634fb0b89
parentb33705e7c88a9a61aba09e3aaa48e2a5acfcdfd7 (diff)
change circle add api and directiondevs/thiep/top
-rw-r--r--src/bin/elementary/test_efl_ui_textpath.c8
-rw-r--r--src/lib/elementary/efl_ui_textpath.c41
-rw-r--r--src/lib/elementary/efl_ui_textpath.eo14
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[])
31 //elm_object_text_set(txtpath, "abcd&lt;eghi&gt;j"); 31 //elm_object_text_set(txtpath, "abcd&lt;eghi&gt;j");
32 //efl_text_set(txtpath, "abcd&lt;eghi&gt;j more and more, so long to make it ellipsis? No, it is not enough, want to see more?xy"); 32 //efl_text_set(txtpath, "abcd&lt;eghi&gt;j more and more, so long to make it ellipsis? No, it is not enough, want to see more?xy");
33 33
34 //efl_ui_textpath_circle_set(txtpath, 0, 0, 100, 0); 34 efl_ui_textpath_circle_set(txtpath, 0, 0, 100, 180, EFL_UI_TEXTPATH_DIRECTION_CCW);
35 //efl_gfx_path_append_circle(txtpath, 200, 200, 100); 35 //efl_gfx_path_append_circle(txtpath, 200, 200, 100);
36 36
37 efl_gfx_path_append_arc(txtpath, 0, 0, 100, 100, 0, -90); 37 //efl_gfx_path_append_arc(txtpath, 0, 0, 100, 100, 0, -90);
38 efl_gfx_path_append_line_to(txtpath, 100, 150); 38 //efl_gfx_path_append_line_to(txtpath, 100, 150);
39 39
40 //efl_gfx_path_append_move_to(txtpath, 200, 300); 40 //efl_gfx_path_append_move_to(txtpath, 200, 300);
41 //efl_gfx_path_append_line_to(txtpath, 300, 350); 41 //efl_gfx_path_append_line_to(txtpath, 300, 350);
@@ -44,7 +44,7 @@ elm_main(int argc, char *argv[])
44 //efl_gfx_path_append_line_to(txtpath, 200, 300); 44 //efl_gfx_path_append_line_to(txtpath, 200, 300);
45 45
46 efl_ui_textpath_ellipsis_set(txtpath, EINA_TRUE); 46 efl_ui_textpath_ellipsis_set(txtpath, EINA_TRUE);
47 efl_ui_textpath_autofit_set(txtpath, EINA_FALSE); 47 //efl_ui_textpath_autofit_set(txtpath, EINA_FALSE);
48 efl_gfx_geometry_set(txtpath, 120, 120, 200, 200); 48 efl_gfx_geometry_set(txtpath, 120, 120, 200, 200);
49 efl_gfx_visible_set(txtpath, EINA_TRUE); 49 efl_gfx_visible_set(txtpath, EINA_TRUE);
50 50
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 @@
19 19
20#define PI 3.14159265 20#define PI 3.14159265
21#define SLICE_MAX 200 21#define SLICE_MAX 200
22#define SLICE_DEFAULT_NO 69 22#define SLICE_DEFAULT_NO 99
23 23
24typedef struct _Efl_Ui_Textpath_Point Efl_Ui_Textpath_Point; 24typedef struct _Efl_Ui_Textpath_Point Efl_Ui_Textpath_Point;
25typedef struct _Efl_Ui_Textpath_Line Efl_Ui_Textpath_Line; 25typedef struct _Efl_Ui_Textpath_Line Efl_Ui_Textpath_Line;
@@ -62,7 +62,7 @@ struct _Efl_Ui_Textpath_Data {
62 double radius; 62 double radius;
63 double start_angle; 63 double start_angle;
64 } circle; 64 } circle;
65 Efl_Ui_Textpath_Orientation ori; 65 Efl_Ui_Textpath_Direction direction;
66 int slice_no; 66 int slice_no;
67 Eina_Bool autofit; 67 Eina_Bool autofit;
68 Eina_Bool ellipsis; 68 Eina_Bool ellipsis;
@@ -844,8 +844,8 @@ _efl_ui_textpath_efl_object_constructor(Eo *obj, Efl_Ui_Textpath_Data *pd)
844 ERR("in"); 844 ERR("in");
845 obj = efl_constructor(efl_super(obj, MY_CLASS)); 845 obj = efl_constructor(efl_super(obj, MY_CLASS));
846 pd->autofit = EINA_TRUE; 846 pd->autofit = EINA_TRUE;
847 pd->slice_no = 99; 847 pd->slice_no = SLICE_DEFAULT_NO;
848 pd->ori = EFL_UI_TEXTPATH_ORIENTATION_LEFT_TO_RIGHT; 848 pd->direction = EFL_UI_TEXTPATH_DIRECTION_CW;
849 849
850 return obj; 850 return obj;
851} 851}
@@ -966,11 +966,12 @@ _efl_ui_textpath_efl_text_text_get(Eo *obj, Efl_Ui_Textpath_Data *pd)
966#endif 966#endif
967 967
968EOLIAN static void 968EOLIAN static void
969_efl_ui_textpath_circle_set(Eo *obj, Efl_Ui_Textpath_Data *pd, double x, double y, double radius, double start_angle) 969_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)
970{ 970{
971 if (pd->circle.x == x && pd->circle.y == y && 971 if (pd->circle.x == x && pd->circle.y == y &&
972 pd->circle.radius == radius && 972 pd->circle.radius == radius &&
973 pd->circle.start_angle == start_angle) 973 pd->circle.start_angle == start_angle &&
974 pd->direction == direction)
974 { 975 {
975 ERR("Same circle"); 976 ERR("Same circle");
976 return; 977 return;
@@ -979,8 +980,19 @@ _efl_ui_textpath_circle_set(Eo *obj, Efl_Ui_Textpath_Data *pd, double x, double
979 pd->circle.y = y; 980 pd->circle.y = y;
980 pd->circle.radius = radius; 981 pd->circle.radius = radius;
981 pd->circle.start_angle = start_angle; 982 pd->circle.start_angle = start_angle;
982 983 pd->direction = direction;
983 efl_gfx_path_append_arc(obj, x - radius, y - radius, radius * 2, radius * 2, start_angle, -360); 984
985 if (direction == EFL_UI_TEXTPATH_DIRECTION_CW)
986 {
987 efl_gfx_path_append_arc(obj, x - radius, y - radius, radius * 2,
988 radius * 2, start_angle, -360);
989 }
990 else
991 {
992 efl_gfx_path_append_arc(obj, x - radius, y - radius, radius * 2,
993 radius * 2, start_angle, 360);
994 }
995
984 996
985 if (pd->content) 997 if (pd->content)
986 { 998 {
@@ -990,19 +1002,6 @@ _efl_ui_textpath_circle_set(Eo *obj, Efl_Ui_Textpath_Data *pd, double x, double
990 _sizing_eval(obj, pd); 1002 _sizing_eval(obj, pd);
991} 1003}
992 1004
993EOLIAN static Efl_Ui_Textpath_Orientation
994_efl_ui_textpath_orientation_get(Eo *obj, Efl_Ui_Textpath_Data *pd)
995{
996 return pd->ori;
997}
998
999EOLIAN static void
1000_efl_ui_textpath_orientation_set(Eo *obj, Efl_Ui_Textpath_Data *pd, Efl_Ui_Textpath_Orientation orientation)
1001{
1002 if (pd->ori == orientation) return;
1003 pd->ori = orientation;
1004}
1005
1006EOLIAN static Eina_Bool 1005EOLIAN static Eina_Bool
1007_efl_ui_textpath_autofit_get(Eo *obj, Efl_Ui_Textpath_Data *pd) 1006_efl_ui_textpath_autofit_get(Eo *obj, Efl_Ui_Textpath_Data *pd)
1008{ 1007{
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 @@
1enum Efl.Ui.Textpath.Orientation { 1enum Efl.Ui.Textpath.Direction {
2 left_to_right, 2 cw,
3 right_to_left 3 ccw
4} 4}
5 5
6class Efl.Ui.Textpath (Elm.Layout, Efl.Object, Efl.Text, Efl.Gfx.Path) 6class 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)
15 @in y: double; 15 @in y: double;
16 @in radius: double; 16 @in radius: double;
17 @in start_angle: double; 17 @in start_angle: double;
18 } 18 @in direction: Efl.Ui.Textpath.Direction;
19 }
20 @property orientation {
21 [[The orientation where text is placed:
22 left-to-right or right-to-left]]
23 values {
24 orient: Efl.Ui.Textpath.Orientation;
25 } 19 }
26 } 20 }
27 @property autofit { 21 @property autofit {