From 8146728c780914614ec49177edd5ea18030065e3 Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Fri, 20 Dec 2019 14:25:38 +0900 Subject: [PATCH 01/27] eolian_mono: change Constants class to static class Summary: Since Constants class contains static readonly values only, the Constants class is actually a static class. Therefore, Constants class is changed from public partial class to public static partial class. ref T8398 Reviewers: YOhoho, lauromoura Reviewed By: YOhoho Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10929 --- src/bin/eolian_mono/eolian/mono/variable_definition.hh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bin/eolian_mono/eolian/mono/variable_definition.hh b/src/bin/eolian_mono/eolian/mono/variable_definition.hh index e63db2047d..fe9f6738e6 100644 --- a/src/bin/eolian_mono/eolian/mono/variable_definition.hh +++ b/src/bin/eolian_mono/eolian/mono/variable_definition.hh @@ -45,11 +45,11 @@ struct constant_definition_generator template bool generate(OutputIterator sink, attributes::constant_def constant, Context const& context) const { - // Open partial class + // Open static partial class if (!name_helpers::open_namespaces(sink, constant.namespaces, context)) return false; - if (!as_generator("public partial class Constants\n{\n").generate(sink, attributes::unused, context)) + if (!as_generator("public static partial class Constants\n{\n").generate(sink, attributes::unused, context)) return false; std::string literal; @@ -83,7 +83,7 @@ struct constant_definition_generator // FIXME missing documentation generator - // Close partial class + // Close static partial class if (!as_generator("}\n").generate(sink, attributes::unused, context)) return false; From 55389ccf25b1f37284cdcda39f9dc2b67d6ec878 Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Thu, 21 Nov 2019 16:51:23 +0100 Subject: [PATCH 02/27] python: remove not needed imports in various python scripts Should not be much harm but could help to have the minimum imports needed when used in deployment. Reported-By: https://lgtm.com/projects/g/Enlightenment/efl Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10885 --- examples_checks.py | 1 - generate_widget_header.py | 4 +--- src/scripts/eina/eina-bench-cmp | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/examples_checks.py b/examples_checks.py index f456e6be58..0129b40560 100755 --- a/examples_checks.py +++ b/examples_checks.py @@ -1,6 +1,5 @@ #!/usr/bin/python3 import os -import sys import subprocess import json import time diff --git a/generate_widget_header.py b/generate_widget_header.py index d4a323400f..c1de110855 100755 --- a/generate_widget_header.py +++ b/generate_widget_header.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 import sys import os -from ete3 import Tree, TreeStyle, AttrFace, CircleFace, faces, NodeStyle +from ete3 import Tree, TreeStyle, AttrFace, faces, NodeStyle import argparse parser = argparse.ArgumentParser(description='Create a image showing all widgets') @@ -11,8 +11,6 @@ G = parser.parse_args() sys.path.insert(0, os.path.join(G.sourcedir, 'src', 'scripts', 'pyolian')) import eolian -from eolian import Eolian_Type_Type -from eolian import Eolian_Type_Builtin_Type SCAN_FOLDER = os.path.join(G.sourcedir, 'src', 'lib') diff --git a/src/scripts/eina/eina-bench-cmp b/src/scripts/eina/eina-bench-cmp index 63926c27ae..9ff68e2a2c 100755 --- a/src/scripts/eina/eina-bench-cmp +++ b/src/scripts/eina/eina-bench-cmp @@ -1,6 +1,5 @@ #!/usr/bin/env python2 -import sys import os import os.path import csv From e09919ba3fd3038adf7f2d4506b477b773dd9913 Mon Sep 17 00:00:00 2001 From: Yeongjong Lee Date: Fri, 20 Dec 2019 17:37:55 +0900 Subject: [PATCH 03/27] efl_interface: add @since tag for Efl_Model_Children_Event Summary: @since tag is necessary for stabilized class. Reviewers: SanghyeonLee, segfaultxavi Reviewed By: SanghyeonLee Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10930 --- src/lib/efl/interfaces/efl_model.eo | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/efl/interfaces/efl_model.eo b/src/lib/efl/interfaces/efl_model.eo index cc5d6d88c8..ee04879f68 100644 --- a/src/lib/efl/interfaces/efl_model.eo +++ b/src/lib/efl/interfaces/efl_model.eo @@ -9,7 +9,10 @@ struct Efl.Model_Property_Event { struct Efl.Model_Children_Event { [[Every time a child is added the event @[Efl.Model.child,added] is dispatched - passing along this structure.]] + passing along this structure. + + @since 1.24 + ]] index: uint; [[index is a hint and is intended to provide a way for applications to control/know children relative positions through listings.]] child: Efl.Object; [[If an object has been built for this index and it is currently tracked by From e16b32c37643d3243b2350df053474d84717c2a2 Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Fri, 20 Dec 2019 09:44:41 +0100 Subject: [PATCH 04/27] csharp: add documentation of class Efl.Eo.Config in iwrapper Summary: Description and since efl version of the class Efl.Eo.Config is added. Reviewers: YOhoho, lauromoura, segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10933 --- src/bindings/mono/eo_mono/iwrapper.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/bindings/mono/eo_mono/iwrapper.cs b/src/bindings/mono/eo_mono/iwrapper.cs index b4f1af9fcd..29a346dcc4 100644 --- a/src/bindings/mono/eo_mono/iwrapper.cs +++ b/src/bindings/mono/eo_mono/iwrapper.cs @@ -920,15 +920,26 @@ internal struct WrappingHandle public IntPtr NativeHandle { get; private set; } } +/// +/// Manage the initialization and cleanup for the Efl object subsystem. +/// Since EFL 1.24. +/// public static class Config { - + /// + /// Initialize the EFL object subsystem. + /// Since EFL 1.24. + /// public static void Init() { Globals.efl_object_init(); Globals.SetNativeDisposeCallbacks(); } + /// + /// Shutdown the EFL object subsystem. + /// Since EFL 1.24. + /// public static void Shutdown() { Globals.efl_object_shutdown(); From 5cf7fa7670a3160ad01171116b392a3a6757463f Mon Sep 17 00:00:00 2001 From: ali Date: Fri, 20 Dec 2019 09:49:41 +0100 Subject: [PATCH 05/27] efl.text.style: rename methods/properties and add text_ prefix Summary: efl.text.style: rename methods and properties this change will avoid conflict in the future with other interfaces or class methods. ``` Efl.Text_Style.text_color { set; get; } Efl.Text_Style.text_backing_type { set; get; } Efl.Text_Style.text_background_color { set; get;} //this was backing_color Efl.Text_Style.text_underline_type { set; } Efl.Text_Style.text_underline_color { set; get; } Efl.Text_Style.text_underline2_color { set; get; } Efl.Text_Style.text_underline_dashed_color { set; get; } Efl.Text_Style.text_underline_height { set; } Efl.Text_Style.text_underline_dashed_width { set; } Efl.Text_Style.text_underline_dashed_gap { set; } Efl.Text_Style.text_strikethrough_type { set; } Efl.Text_Style.text_strikethrough_color { set; get; } Efl.Text_Style.text_effect_type { set; } Efl.Text_Style.text_shadow_direction { set; } Efl.Text_Style.text_outline_color { set; get; } Efl.Text_Style.text_shadow_color { set; get; } Efl.Text_Style.text_glow_color { set; get; } Efl.Text_Style.text_glow2_color { set; get; } ``` T8533 Reviewers: woohyun, segfaultxavi, bu5hm4n, zmike, cedric Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10897 --- src/bin/elementary/test_efl_ui_text.c | 2 +- src/bin/elementary/test_photocam.c | 2 +- .../elementary/efl_canvas_layout_text.c | 2 +- src/lib/edje/edje_part_text.c | 100 +++++++++--------- src/lib/edje/edje_private.h | 2 +- src/lib/edje/efl_canvas_layout_part_text.eo | 36 +++---- src/lib/efl/interfaces/efl_text_style.eo | 62 +++++------ src/lib/elementary/efl_ui_textbox.c | 4 +- src/lib/evas/canvas/efl_canvas_textblock.eo | 74 ++++++------- src/lib/evas/canvas/evas_object_textblock.c | 78 +++++++------- src/tests/edje/edje_test_text.c | 10 +- src/tests/evas/evas_test_textblock.c | 4 +- 12 files changed, 189 insertions(+), 187 deletions(-) diff --git a/src/bin/elementary/test_efl_ui_text.c b/src/bin/elementary/test_efl_ui_text.c index 066e73295a..1d098c1052 100644 --- a/src/bin/elementary/test_efl_ui_text.c +++ b/src/bin/elementary/test_efl_ui_text.c @@ -166,7 +166,7 @@ test_efl_ui_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve efl_text_font_family_set(en, "Sans"); efl_text_font_size_set(en, 12); efl_text_font_width_set(en, EFL_TEXT_FONT_WIDTH_ULTRACONDENSED); - efl_text_normal_color_set(en, 255, 255, 255, 255); + efl_text_color_set(en, 255, 255, 255, 255); efl_text_set(en, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\n" diff --git a/src/bin/elementary/test_photocam.c b/src/bin/elementary/test_photocam.c index 166f669a42..de7b827a84 100644 --- a/src/bin/elementary/test_photocam.c +++ b/src/bin/elementary/test_photocam.c @@ -819,7 +819,7 @@ test_image_zoomable_animated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE efl_gfx_hint_weight_set(efl_added, 1, 0), efl_text_font_family_set(efl_added, "Sans"), efl_text_font_size_set(efl_added, 10), - efl_text_normal_color_set(efl_added, 255, 255, 255, 255), + efl_text_color_set(efl_added, 255, 255, 255, 255), efl_pack(bx, efl_added) ); diff --git a/src/examples/elementary/efl_canvas_layout_text.c b/src/examples/elementary/efl_canvas_layout_text.c index bafd0dd2e5..268dd487d0 100644 --- a/src/examples/elementary/efl_canvas_layout_text.c +++ b/src/examples/elementary/efl_canvas_layout_text.c @@ -134,7 +134,7 @@ efl_main(void *data EINA_UNUSED, efl_text_markup_set(efl_part(layout, "text"), "This is an example text. This is a layout text part."); efl_text_wrap_set(efl_part(layout, "text"), wraps[wrap_itr].wrap); - efl_text_normal_color_set(efl_part(layout, "text"), 255, 255, 0, 255); + efl_text_color_set(efl_part(layout, "text"), 255, 255, 0, 255); efl_text_font_family_set(efl_part(layout, "text"), "Serif"); efl_text_font_size_set(efl_part(layout, "text"), 12); diff --git a/src/lib/edje/edje_part_text.c b/src/lib/edje/edje_part_text.c index 876c4ab7af..575779e868 100644 --- a/src/lib/edje/edje_part_text.c +++ b/src/lib/edje/edje_part_text.c @@ -41,9 +41,9 @@ _efl_canvas_layout_part_text_efl_text_markup_markup_set(Eo *obj, /* More Efl.Text.* API (@since 1.22) */ EOLIAN static void -_efl_canvas_layout_part_text_efl_text_style_backing_type_set(Eo *obj, +_efl_canvas_layout_part_text_efl_text_style_text_background_type_set(Eo *obj, void *_pd EINA_UNUSED, - Efl_Text_Style_Backing_Type type) + Efl_Text_Style_Background_Type type) { Edje_User_Defined *eud; @@ -53,19 +53,19 @@ _efl_canvas_layout_part_text_efl_text_style_backing_type_set(Eo *obj, eud = _edje_user_text_style_definition_fetch(pd->ed, pd->part); eud->u.text_style.types |= EDJE_PART_TEXT_PROP_NONE; - efl_text_backing_type_set(pd->rp->object, type); + efl_text_background_type_set(pd->rp->object, type); } -EOLIAN static Efl_Text_Style_Backing_Type -_efl_canvas_layout_part_text_efl_text_style_backing_type_get(const Eo *obj, +EOLIAN static Efl_Text_Style_Background_Type +_efl_canvas_layout_part_text_efl_text_style_text_background_type_get(const Eo *obj, void *_pd EINA_UNUSED) { PROXY_DATA_GET(obj, pd); if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) - return EFL_TEXT_STYLE_BACKING_TYPE_DISABLED; + return EFL_TEXT_STYLE_BACKGROUND_TYPE_DISABLED; - return efl_text_backing_type_get(pd->rp->object); + return efl_text_background_type_get(pd->rp->object); } #define TEXT_COLOR_IMPL(x, X) \ @@ -82,7 +82,7 @@ _efl_canvas_layout_part_text_efl_text_style_ ##x ##_color_set(Eo *obj, \ eud = _edje_user_text_style_definition_fetch(pd->ed, pd->part); \ \ eud->u.text_style.types |= EDJE_PART_TEXT_PROP_COLOR_ ##X; \ - efl_text_ ##x ##_color_set(pd->rp->object, r, g, b, a); \ + efl_ ##x ##_color_set(pd->rp->object, r, g, b, a); \ } \ \ EOLIAN static void \ @@ -93,22 +93,22 @@ _efl_canvas_layout_part_text_efl_text_style_ ##x ##_color_get(const Eo *obj, \ PROXY_DATA_GET(obj, pd); \ *r = *g = *b = *a = 0; \ if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return; \ - efl_text_ ##x ##_color_get(pd->rp->object, r, g, b, a); \ + efl_ ##x ##_color_get(pd->rp->object, r, g, b, a); \ } -TEXT_COLOR_IMPL(backing, BACKING) -TEXT_COLOR_IMPL(glow, GLOW) -TEXT_COLOR_IMPL(glow2, GLOW2) -TEXT_COLOR_IMPL(normal, NORMAL) -TEXT_COLOR_IMPL(outline, OUTLINE) -TEXT_COLOR_IMPL(shadow, SHADOW) -TEXT_COLOR_IMPL(strikethrough, STRIKETHROUGH) -TEXT_COLOR_IMPL(underline, UNDERLINE) -TEXT_COLOR_IMPL(underline2, UNDERLINE2) -TEXT_COLOR_IMPL(underline_dashed, UNDERLINE_DASHED) +TEXT_COLOR_IMPL(text_background, BACKING) +TEXT_COLOR_IMPL(text_glow, GLOW) +TEXT_COLOR_IMPL(text_glow2, GLOW2) +TEXT_COLOR_IMPL(text, NORMAL) +TEXT_COLOR_IMPL(text_outline, OUTLINE) +TEXT_COLOR_IMPL(text_shadow, SHADOW) +TEXT_COLOR_IMPL(text_strikethrough, STRIKETHROUGH) +TEXT_COLOR_IMPL(text_underline, UNDERLINE) +TEXT_COLOR_IMPL(text_underline2, UNDERLINE2) +TEXT_COLOR_IMPL(text_underline_dashed, UNDERLINE_DASHED) EOLIAN static void -_efl_canvas_layout_part_text_efl_text_style_effect_type_set(Eo *obj, +_efl_canvas_layout_part_text_efl_text_style_text_effect_type_set(Eo *obj, void *_pd EINA_UNUSED, Efl_Text_Style_Effect_Type type) { @@ -201,7 +201,7 @@ _efl_canvas_layout_part_text_efl_text_font_font_size_get(const Eo *obj, } EOLIAN static void -_efl_canvas_layout_part_text_efl_text_style_shadow_direction_set(Eo *obj, +_efl_canvas_layout_part_text_efl_text_style_text_shadow_direction_set(Eo *obj, void *_pd EINA_UNUSED, Efl_Text_Style_Shadow_Direction type) { @@ -217,7 +217,7 @@ _efl_canvas_layout_part_text_efl_text_style_shadow_direction_set(Eo *obj, } EOLIAN static void -_efl_canvas_layout_part_text_efl_text_style_strikethrough_type_set(Eo *obj, +_efl_canvas_layout_part_text_efl_text_style_text_strikethrough_type_set(Eo *obj, void *_pd EINA_UNUSED, Efl_Text_Style_Strikethrough_Type type) { @@ -233,7 +233,7 @@ _efl_canvas_layout_part_text_efl_text_style_strikethrough_type_set(Eo *obj, } EOLIAN static void -_efl_canvas_layout_part_text_efl_text_style_underline_type_set(Eo *obj, +_efl_canvas_layout_part_text_efl_text_style_text_underline_type_set(Eo *obj, void *_pd EINA_UNUSED, Efl_Text_Style_Underline_Type type) { @@ -250,7 +250,7 @@ _efl_canvas_layout_part_text_efl_text_style_underline_type_set(Eo *obj, } EOLIAN static void -_efl_canvas_layout_part_text_efl_text_style_underline_height_set(Eo *obj, +_efl_canvas_layout_part_text_efl_text_style_text_underline_height_set(Eo *obj, void *_pd EINA_UNUSED, double value) { @@ -266,7 +266,7 @@ _efl_canvas_layout_part_text_efl_text_style_underline_height_set(Eo *obj, } EOLIAN static void -_efl_canvas_layout_part_text_efl_text_style_underline_dashed_width_set(Eo *obj, +_efl_canvas_layout_part_text_efl_text_style_text_underline_dashed_width_set(Eo *obj, void *_pd EINA_UNUSED, int value) { @@ -282,7 +282,7 @@ _efl_canvas_layout_part_text_efl_text_style_underline_dashed_width_set(Eo *obj, } EOLIAN static void -_efl_canvas_layout_part_text_efl_text_style_underline_dashed_gap_set(Eo *obj, +_efl_canvas_layout_part_text_efl_text_style_text_underline_dashed_gap_set(Eo *obj, void *_pd EINA_UNUSED, int value) { @@ -353,28 +353,28 @@ _canvas_layout_user_text_collect(Edje *ed, Edje_User_Defined *eud) Edje_Part_Text_Prop *prop; prop = _prop_new(props, EDJE_PART_TEXT_PROP_BACKING_TYPE); - prop->val.backing = efl_text_backing_type_get(rp->object); + prop->val.backing = efl_text_background_type_get(rp->object); } #define STYLE_COLOR_COLLECT(x, X) \ if (eud->u.text_style.types & EDJE_PART_TEXT_PROP_COLOR_ ##X) \ { \ Edje_Part_Text_Prop *prop; \ prop = _prop_new(props, EDJE_PART_TEXT_PROP_COLOR_ ##X); \ - efl_text_ ##x ##_color_get(rp->object, \ + efl_ ##x ##_color_get(rp->object, \ &prop->val.color.r, &prop->val.color.g, \ &prop->val.color.b, &prop->val.color.a); \ } \ - STYLE_COLOR_COLLECT(backing, BACKING) - STYLE_COLOR_COLLECT(glow, GLOW) - STYLE_COLOR_COLLECT(glow2, GLOW2) - STYLE_COLOR_COLLECT(normal, NORMAL) - STYLE_COLOR_COLLECT(outline, OUTLINE) - STYLE_COLOR_COLLECT(shadow, SHADOW) - STYLE_COLOR_COLLECT(strikethrough, STRIKETHROUGH) - STYLE_COLOR_COLLECT(underline, UNDERLINE) - STYLE_COLOR_COLLECT(underline2, UNDERLINE2) - STYLE_COLOR_COLLECT(underline_dashed, UNDERLINE_DASHED) + STYLE_COLOR_COLLECT(text_background, BACKING) + STYLE_COLOR_COLLECT(text_glow, GLOW) + STYLE_COLOR_COLLECT(text_glow2, GLOW2) + STYLE_COLOR_COLLECT(text, NORMAL) + STYLE_COLOR_COLLECT(text_outline, OUTLINE) + STYLE_COLOR_COLLECT(text_shadow, SHADOW) + STYLE_COLOR_COLLECT(text_strikethrough, STRIKETHROUGH) + STYLE_COLOR_COLLECT(text_underline, UNDERLINE) + STYLE_COLOR_COLLECT(text_underline2, UNDERLINE2) + STYLE_COLOR_COLLECT(text_underline_dashed, UNDERLINE_DASHED) #undef STYLE_COLOR_COLLECT if (eud->u.text_style.types & EDJE_PART_TEXT_PROP_EFFECT_TYPE) @@ -468,7 +468,7 @@ _canvas_layout_user_text_apply(Edje_User_Defined *eud, Eo *obj, { case EDJE_PART_TEXT_PROP_BACKING_TYPE: - efl_text_backing_type_set( + efl_text_background_type_set( efl_part(obj, eud->part), prop->val.backing); @@ -476,7 +476,7 @@ _canvas_layout_user_text_apply(Edje_User_Defined *eud, Eo *obj, #define STYLE_COLOR_CASE(x, X) \ case EDJE_PART_TEXT_PROP_COLOR_##X : \ - efl_text_##x ##_color_set(efl_part(obj, \ + efl_##x ##_color_set(efl_part(obj, \ eud->part), \ prop->val.color.r, \ prop->val.color.g, \ @@ -484,16 +484,16 @@ _canvas_layout_user_text_apply(Edje_User_Defined *eud, Eo *obj, prop->val.color.a); \ break; - STYLE_COLOR_CASE(backing, BACKING) - STYLE_COLOR_CASE(glow, GLOW) - STYLE_COLOR_CASE(glow2, GLOW2) - STYLE_COLOR_CASE(normal, NORMAL) - STYLE_COLOR_CASE(outline, OUTLINE) - STYLE_COLOR_CASE(shadow, SHADOW) - STYLE_COLOR_CASE(strikethrough, STRIKETHROUGH) - STYLE_COLOR_CASE(underline, UNDERLINE) - STYLE_COLOR_CASE(underline2, UNDERLINE2) - STYLE_COLOR_CASE(underline_dashed, UNDERLINE_DASHED) + STYLE_COLOR_CASE(text_background, BACKING) + STYLE_COLOR_CASE(text_glow, GLOW) + STYLE_COLOR_CASE(text_glow2, GLOW2) + STYLE_COLOR_CASE(text, NORMAL) + STYLE_COLOR_CASE(text_outline, OUTLINE) + STYLE_COLOR_CASE(text_shadow, SHADOW) + STYLE_COLOR_CASE(text_strikethrough, STRIKETHROUGH) + STYLE_COLOR_CASE(text_underline, UNDERLINE) + STYLE_COLOR_CASE(text_underline2, UNDERLINE2) + STYLE_COLOR_CASE(text_underline_dashed, UNDERLINE_DASHED) #undef STYLE_COLOR_CASE case EDJE_PART_TEXT_PROP_EFFECT_TYPE: diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index c572d74991..9a293e2e33 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -2316,7 +2316,7 @@ typedef struct int ni; // number integer int nd; // number double Efl_Text_Format_Wrap wrap; - Efl_Text_Style_Backing_Type backing; + Efl_Text_Style_Background_Type backing; Efl_Text_Style_Underline_Type underline; struct { diff --git a/src/lib/edje/efl_canvas_layout_part_text.eo b/src/lib/edje/efl_canvas_layout_part_text.eo index cacf430a57..ed3cc4ec04 100644 --- a/src/lib/edje/efl_canvas_layout_part_text.eo +++ b/src/lib/edje/efl_canvas_layout_part_text.eo @@ -40,23 +40,23 @@ Efl.Text_Markup, Efl.Text_Format, Efl.Text_Font, Efl.Text_Style Efl.Text_Format.wrap { set; get; } Efl.Text_Font.font_family { set; get; } Efl.Text_Font.font_size { set; get; } - Efl.Text_Style.normal_color { set; get; } - Efl.Text_Style.backing_type { set; get; } - Efl.Text_Style.backing_color { set; get;} - Efl.Text_Style.underline_type { set; } - Efl.Text_Style.underline_color { set; get; } - Efl.Text_Style.underline2_color { set; get; } - Efl.Text_Style.underline_dashed_color { set; get; } - Efl.Text_Style.underline_height { set; } - Efl.Text_Style.underline_dashed_width { set; } - Efl.Text_Style.underline_dashed_gap { set; } - Efl.Text_Style.strikethrough_type { set; } - Efl.Text_Style.strikethrough_color { set; get; } - Efl.Text_Style.effect_type { set; } - Efl.Text_Style.shadow_direction { set; } - Efl.Text_Style.outline_color { set; get; } - Efl.Text_Style.shadow_color { set; get; } - Efl.Text_Style.glow_color { set; get; } - Efl.Text_Style.glow2_color { set; get; } + Efl.Text_Style.text_color { set; get; } + Efl.Text_Style.text_background_type { set; get; } + Efl.Text_Style.text_background_color { set; get;} + Efl.Text_Style.text_underline_type { set; } + Efl.Text_Style.text_underline_color { set; get; } + Efl.Text_Style.text_underline2_color { set; get; } + Efl.Text_Style.text_underline_dashed_color { set; get; } + Efl.Text_Style.text_underline_height { set; } + Efl.Text_Style.text_underline_dashed_width { set; } + Efl.Text_Style.text_underline_dashed_gap { set; } + Efl.Text_Style.text_strikethrough_type { set; } + Efl.Text_Style.text_strikethrough_color { set; get; } + Efl.Text_Style.text_effect_type { set; } + Efl.Text_Style.text_shadow_direction { set; } + Efl.Text_Style.text_outline_color { set; get; } + Efl.Text_Style.text_shadow_color { set; get; } + Efl.Text_Style.text_glow_color { set; get; } + Efl.Text_Style.text_glow2_color { set; get; } } } diff --git a/src/lib/efl/interfaces/efl_text_style.eo b/src/lib/efl/interfaces/efl_text_style.eo index 9b66595558..17c209e01d 100644 --- a/src/lib/efl/interfaces/efl_text_style.eo +++ b/src/lib/efl/interfaces/efl_text_style.eo @@ -1,8 +1,9 @@ -enum @beta Efl.Text_Style_Backing_Type +enum @beta Efl.Text_Style_Background_Type { - [[Whether to add a background colored rectangle (backing) to each line of text or not.]] - disabled = 0, [[Do not use backing.]] - enabled, [[Use backing.]] + [[Whether to add a background colored rectangle (background) to each line of text or not.]] + disabled = 0, [[Do not use background.]] + enabled, [[Use background.]] + } enum @beta Efl.Text_Style_Strikethrough_Type @@ -10,6 +11,7 @@ enum @beta Efl.Text_Style_Strikethrough_Type [[Whether to add a strike-through decoration to the displayed text or not.]] disabled = 0, [[Do not use strike-through.]] enabled, [[Use strike-through.]] + } enum @beta Efl.Text_Style_Effect_Type @@ -62,7 +64,7 @@ interface @beta Efl.Text_Style { ]] c_prefix: efl_text; methods { - @property normal_color { + @property text_color { [[Color of text, excluding decorations like, shadow, outline or glow.]] values { @@ -73,15 +75,15 @@ interface @beta Efl.Text_Style { } } - @property backing_type { + @property text_background_type { [[Enables rendering of a background rectangle behind each line of text.]] values { - type: Efl.Text_Style_Backing_Type; [[Backing type.]] + type: Efl.Text_Style_Background_Type; [[Background type.]] } } - @property backing_color { + @property text_background_color { [[Color of the background rectangle (backing) behind each line of text.]] values { @@ -92,7 +94,7 @@ interface @beta Efl.Text_Style { } } - @property underline_type { + @property text_underline_type { [[Underline style for the text.]] values { @@ -100,7 +102,7 @@ interface @beta Efl.Text_Style { } } - @property underline_color + @property text_underline_color { [[Color of normal underline style.]] values @@ -112,9 +114,9 @@ interface @beta Efl.Text_Style { } } - @property underline_height + @property text_underline_height { - [[Width (in pixels) of the single underline when @.underline_type is + [[Width (in pixels) of the single underline when @.text_underline_type is @Efl.Text_Style_Underline_Type.single.]] values { @@ -122,9 +124,9 @@ interface @beta Efl.Text_Style { } } - @property underline_dashed_color + @property text_underline_dashed_color { - [[Color of the dashed underline. Only valid when @.underline_type is + [[Color of the dashed underline. Only valid when @.text_underline_type is @Efl.Text_Style_Underline_Type.dashed.]] values { @@ -135,9 +137,9 @@ interface @beta Efl.Text_Style { } } - @property underline_dashed_width + @property text_underline_dashed_width { - [[Length (in pixels) of the dashes when @.underline_type is + [[Length (in pixels) of the dashes when @.text_underline_type is @Efl.Text_Style_Underline_Type.dashed.]] values { @@ -145,9 +147,9 @@ interface @beta Efl.Text_Style { } } - @property underline_dashed_gap + @property text_underline_dashed_gap { - [[Length (in pixels) of the gaps between the dashes when @.underline_type is + [[Length (in pixels) of the gaps between the dashes when @.text_underline_type is @Efl.Text_Style_Underline_Type.dashed.]] values { @@ -155,9 +157,9 @@ interface @beta Efl.Text_Style { } } - @property underline2_color + @property text_underline2_color { - [[Color of the secondary underline. Only valid when @.underline_type is + [[Color of the secondary underline. Only valid when @.text_underline_type is @Efl.Text_Style_Underline_Type.double.]] values { @@ -168,7 +170,7 @@ interface @beta Efl.Text_Style { } } - @property strikethrough_type { + @property text_strikethrough_type { [[Enables crossed-out text.]] values { @@ -176,7 +178,7 @@ interface @beta Efl.Text_Style { } } - @property strikethrough_color + @property text_strikethrough_color { [[Color of the line striking through the text.]] values @@ -188,14 +190,14 @@ interface @beta Efl.Text_Style { } } - @property effect_type { + @property text_effect_type { [[Controls a number of decorations around the text, like shadow, outline and glow, including combinations of them.]] values { type: Efl.Text_Style_Effect_Type; [[Effect type.]] } } - @property outline_color + @property text_outline_color { [[Color of the text outline.]] values @@ -207,7 +209,7 @@ interface @beta Efl.Text_Style { } } - @property shadow_direction + @property text_shadow_direction { [[Direction of shadow effect.]] values @@ -216,7 +218,7 @@ interface @beta Efl.Text_Style { } } - @property shadow_color + @property text_shadow_color { [[Color of the shadow.]] values @@ -228,7 +230,7 @@ interface @beta Efl.Text_Style { } } - @property glow_color + @property text_glow_color { [[Color of the glow decoration.]] values @@ -240,11 +242,11 @@ interface @beta Efl.Text_Style { } } - @property glow2_color + @property text_glow2_color { [[Color of the secondary glow decoration. This is the color of the inner glow (where it touches the text) which - gradually fades into @.glow_color as it reaches the edge. + gradually fades into @.text_glow_color as it reaches the edge. ]] values { @@ -255,7 +257,7 @@ interface @beta Efl.Text_Style { } } - @property gfx_filter + @property text_gfx_filter { [[Program that applies a special filter diff --git a/src/lib/elementary/efl_ui_textbox.c b/src/lib/elementary/efl_ui_textbox.c index 456f9f8889..26e09f0f72 100644 --- a/src/lib/elementary/efl_ui_textbox.c +++ b/src/lib/elementary/efl_ui_textbox.c @@ -1925,7 +1925,7 @@ _update_text_theme(Eo *obj, Efl_Ui_Textbox_Data *sd) colorcode = edje_object_data_get(wd->resize_obj, "style.color"); if (colorcode && _format_color_parse(colorcode, strlen(colorcode), &r, &g, &b, &a)) { - efl_text_normal_color_set(sd->text_obj, r, g, b, a); + efl_text_color_set(sd->text_obj, r, g, b, a); } // Guide Text @@ -1943,7 +1943,7 @@ _update_text_theme(Eo *obj, Efl_Ui_Textbox_Data *sd) colorcode = edje_object_data_get(wd->resize_obj, "guide.style.color"); if (colorcode && _format_color_parse(colorcode, strlen(colorcode), &r, &g, &b, &a)) { - efl_text_normal_color_set(sd->text_guide_obj, r, g, b, a); + efl_text_color_set(sd->text_guide_obj, r, g, b, a); } } diff --git a/src/lib/evas/canvas/efl_canvas_textblock.eo b/src/lib/evas/canvas/efl_canvas_textblock.eo index d183574817..978c502b2c 100644 --- a/src/lib/evas/canvas/efl_canvas_textblock.eo +++ b/src/lib/evas/canvas/efl_canvas_textblock.eo @@ -10,7 +10,7 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text, Note: No text will be rendered until a font, a font size and a font color are specified. This can be accomplished using @Efl.Text_Font.font_family, @Efl.Text_Font.font_size and - @Efl.Text_Style.normal_color. + @Efl.Text_Style.text_color. Alternatively, @.style_apply can be used providing the attributes $font, $font_size and $color. ]] methods { @@ -139,53 +139,53 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text, - $color: Color code for the text (See bottom for the complete list of supported codes). Default value is $[rgba(0,0,0,0)] meaning that no text will be rendered. Requires $font and $font_size. - See @Efl.Text_Style.normal_color. + See @Efl.Text_Style.text_color. - $underline_color: Color code for the text underline (See bottom for the complete list of supported codes). Default value is $[rgba(0,0,0,0)] meaning that no underline will be rendered. Requires $underline. - See @Efl.Text_Style.underline_color. + See @Efl.Text_Style.text_underline_color. - $underline2_color: Color code for the secondary text underline (See bottom for the complete list of supported codes). Only valid when $[underline=double]. Default value is $[rgba(0,0,0,0)] meaning that secondary underline will not be rendered. - See @Efl.Text_Style.underline2_color. + See @Efl.Text_Style.text_underline2_color. - $underline_dash_color: Color code for the dashed underline (See bottom for the complete list of supported codes). Only valid when $[underline=dashed]. Default value is $[rgba(0,0,0,0)] meaning that dashed underline will not be rendered. - See @Efl.Text_Style.underline_dashed_color. + See @Efl.Text_Style.text_underline_dashed_color. - $outline_color: Color code for the text outline (See bottom for the complete list of supported codes). Only valid when the $style attribute includes an outline. Default value is $[rgba(0,0,0,0)] meaning that no outline will be rendered. - See @Efl.Text_Style.outline_color. + See @Efl.Text_Style.text_outline_color. - $shadow_color: Color code for the text shadow (See bottom for the complete list of supported codes). Only valid when the $style attribute includes a shadow. Default value is $[rgba(0,0,0,0)] meaning that no shadow will be rendered. - See @Efl.Text_Style.shadow_color. + See @Efl.Text_Style.text_shadow_color. - $glow_color: Color code for the glow component of the text (See bottom for the complete list of supported codes). Only valid when the $style attribute includes a glow. Default value is $[rgba(0,0,0,0)] meaning that no glow will be rendered. - See @Efl.Text_Style.glow_color. + See @Efl.Text_Style.text_glow_color. - $glow2_color: Color code for the secondary (inner) glow component of the text (See bottom for the complete list of supported codes). Only valid when the $style attribute includes a glow. Default value is $[rgba(0,0,0,0)] meaning that only the primary $glow_color will be used. - See @Efl.Text_Style.glow2_color. + See @Efl.Text_Style.text_glow2_color. - $backing_color: Color code for the background of the text (See bottom for the complete list of supported codes). Use a fully transparent color to disable the background. Default value is $[rgba(0,0,0,0)] meaning that no backing will be rendered. Requires $backing. - See @Efl.Text_Style.backing_color. + See @Efl.Text_Style.text_background_color. - $strikethrough_color: Color code for the line striking through the text (See bottom for the complete list of supported codes). Only valid when $[strikethrough=on] Default value is $[rgba(0,0,0,0)] meaning that no strike-through line will be rendered. - See @Efl.Text_Style.strikethrough_color. + See @Efl.Text_Style.text_strikethrough_color. - $align: Horizontal alignment of the text. The value can either be a decimal number ($[0.0] means "left" and $[1.0] means "right"), a percentage ($[0%] means "left" and $[100%] means "right") or one of: @@ -230,17 +230,17 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text, $dashed (A dashed line under the text). Default value is $off. Requires either $underline_color, $underline2_color or $underline_dash_color. - See @Efl.Text_Style.underline_type. + See @Efl.Text_Style.text_underline_type. - $strikethrough: Enables crossed-out text. Possible values are $on and $off. Default value is $off. Requires $strikethrough_color. - See @Efl.Text_Style.strikethrough_type. + See @Efl.Text_Style.text_strikethrough_type. - $backing: Enables background color for the text. Possible values are $on and $off. Default value is $off. Requires $backing_color. - See @Efl.Text_Style.backing_type. + See @Efl.Text_Style.text_background_type. - $style: Controls a number of decorations around the text, like shadow, outline and glow, including combinations of them. Possible values are $plain (No decoration, alias for $off and $none), @@ -252,7 +252,7 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text, Default value is $plain. Requires either $shadow_color, $glow_color or $outline_color. Examples: $[style=outline], $[style=shadow,bottom_right], $[style=outline_shadow,bottom]. - See @Efl.Text_Style.effect_type and @Efl.Text_Style.shadow_direction. + See @Efl.Text_Style.text_effect_type and @Efl.Text_Style.text_shadow_direction. - $tabstops: Size (in pixels) of the tab character. The value must be a number greater than one. Default value is $[32]. @@ -311,15 +311,15 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text, - $underline_dash_width: Length (in pixels) of the dashes when $underline is $dashed. Default value is $[6]. - See @Efl.Text_Style.underline_dashed_width. + See @Efl.Text_Style.text_underline_dashed_width. - $underline_dash_gap: Length (in pixels) of the gaps between the dashes when $underline is $dashed. Default value is $[2]. - See @Efl.Text_Style.underline_dashed_gap. + See @Efl.Text_Style.text_underline_dashed_gap. - $underline_height: Width (in pixels) of the single underline when $underline is $single. Default value is $[1]. - See @Efl.Text_Style.underline_height. + See @Efl.Text_Style.text_underline_height. - $gfx_filter: Experimental filter name. See @Efl.Gfx.Filter for more information. @@ -457,25 +457,25 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text, Efl.Text_Font.font_slant { get; set; } Efl.Text_Font.font_width { get; set; } Efl.Text_Font.font_bitmap_scalable { get; set; } - Efl.Text_Style.normal_color { get; set; } - Efl.Text_Style.backing_type { get; set; } - Efl.Text_Style.backing_color { get; set; } - Efl.Text_Style.underline_type { get; set; } - Efl.Text_Style.underline_color { get; set; } - Efl.Text_Style.underline_height { get; set; } - Efl.Text_Style.underline_dashed_color { get; set; } - Efl.Text_Style.underline_dashed_width { get; set; } - Efl.Text_Style.underline_dashed_gap { get; set; } - Efl.Text_Style.underline2_color { get; set; } - Efl.Text_Style.strikethrough_type { get; set; } - Efl.Text_Style.strikethrough_color { get; set; } - Efl.Text_Style.effect_type { get; set; } - Efl.Text_Style.outline_color { get; set; } - Efl.Text_Style.shadow_direction { get; set; } - Efl.Text_Style.shadow_color { get; set; } - Efl.Text_Style.glow_color { get; set; } - Efl.Text_Style.glow2_color { get; set; } - Efl.Text_Style.gfx_filter { get; set; } + Efl.Text_Style.text_color { get; set; } + Efl.Text_Style.text_background_type { get; set; } + Efl.Text_Style.text_background_color { get; set; } + Efl.Text_Style.text_underline_type { get; set; } + Efl.Text_Style.text_underline_color { get; set; } + Efl.Text_Style.text_underline_height { get; set; } + Efl.Text_Style.text_underline_dashed_color { get; set; } + Efl.Text_Style.text_underline_dashed_width { get; set; } + Efl.Text_Style.text_underline_dashed_gap { get; set; } + Efl.Text_Style.text_underline2_color { get; set; } + Efl.Text_Style.text_strikethrough_type { get; set; } + Efl.Text_Style.text_strikethrough_color { get; set; } + Efl.Text_Style.text_effect_type { get; set; } + Efl.Text_Style.text_outline_color { get; set; } + Efl.Text_Style.text_shadow_direction { get; set; } + Efl.Text_Style.text_shadow_color { get; set; } + Efl.Text_Style.text_glow_color { get; set; } + Efl.Text_Style.text_glow2_color { get; set; } + Efl.Text_Style.text_gfx_filter { get; set; } Efl.Text_Format.ellipsis { get; set; } Efl.Text_Format.wrap { get; set; } Efl.Text_Format.multiline { get; set; } diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index 0c31bd8189..c15da53564 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -16345,40 +16345,40 @@ _efl_canvas_textblock_efl_text_font_font_bitmap_scalable_get(const Eo *obj EINA_ if (changed) _canvas_text_format_changed(obj, o); static void -_efl_canvas_textblock_efl_text_style_normal_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) { ASYNC_BLOCK; _FMT_COLOR_SET(normal); } static void -_efl_canvas_textblock_efl_text_style_normal_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) { _FMT_COLOR_RET(normal); } static void -_efl_canvas_textblock_efl_text_style_backing_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, Efl_Text_Style_Backing_Type type EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_background_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, Efl_Text_Style_Background_Type type EINA_UNUSED) { ASYNC_BLOCK; _FMT_SET(backing, type); } -static Efl_Text_Style_Backing_Type -_efl_canvas_textblock_efl_text_style_backing_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED) +static Efl_Text_Style_Background_Type +_efl_canvas_textblock_efl_text_style_text_background_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED) { return _FMT(backing); } static void -_efl_canvas_textblock_efl_text_style_backing_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_background_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) { ASYNC_BLOCK; _FMT_COLOR_SET(backing); } static void -_efl_canvas_textblock_efl_text_style_backing_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_background_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) { _FMT_COLOR_RET(backing); } @@ -16396,7 +16396,7 @@ static struct }; static void -_efl_canvas_textblock_efl_text_style_underline_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, Efl_Text_Style_Underline_Type type EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_underline_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, Efl_Text_Style_Underline_Type type EINA_UNUSED) { ASYNC_BLOCK; _FMT_SET(underline, _style_underline_map[type].underline_single); @@ -16406,111 +16406,111 @@ _efl_canvas_textblock_efl_text_style_underline_type_set(Eo *obj EINA_UNUSED, Efl } static Efl_Text_Style_Underline_Type -_efl_canvas_textblock_efl_text_style_underline_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_underline_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED) { return _FMT(underline); } static void -_efl_canvas_textblock_efl_text_style_underline_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_underline_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) { ASYNC_BLOCK; _FMT_COLOR_SET(underline); } static void -_efl_canvas_textblock_efl_text_style_underline_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_underline_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) { _FMT_COLOR_RET(underline); } static void -_efl_canvas_textblock_efl_text_style_underline_height_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, double height EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_underline_height_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, double height EINA_UNUSED) { ASYNC_BLOCK; _FMT_SET(underline_height, height); } static double -_efl_canvas_textblock_efl_text_style_underline_height_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_underline_height_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED) { return _FMT(underline_height); } static void -_efl_canvas_textblock_efl_text_style_underline_dashed_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_underline_dashed_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) { ASYNC_BLOCK; _FMT_COLOR_SET(underline_dash); } static void -_efl_canvas_textblock_efl_text_style_underline_dashed_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_underline_dashed_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) { _FMT_COLOR_RET(underline_dash); } static void -_efl_canvas_textblock_efl_text_style_underline_dashed_width_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, int width EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_underline_dashed_width_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, int width EINA_UNUSED) { ASYNC_BLOCK; _FMT_SET(underline_dash_width, width); } static int -_efl_canvas_textblock_efl_text_style_underline_dashed_width_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_underline_dashed_width_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED) { return _FMT(underline_dash_width); } static void -_efl_canvas_textblock_efl_text_style_underline_dashed_gap_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, int gap EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_underline_dashed_gap_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, int gap EINA_UNUSED) { ASYNC_BLOCK; _FMT_SET(underline_dash_gap, gap); } static int -_efl_canvas_textblock_efl_text_style_underline_dashed_gap_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_underline_dashed_gap_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED) { return _FMT(underline_dash_width); } static void -_efl_canvas_textblock_efl_text_style_underline2_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_underline2_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) { ASYNC_BLOCK; _FMT_COLOR_SET(underline2); } static void -_efl_canvas_textblock_efl_text_style_underline2_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_underline2_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) { _FMT_COLOR_RET(underline2); } static void -_efl_canvas_textblock_efl_text_style_strikethrough_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, Efl_Text_Style_Strikethrough_Type type EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_strikethrough_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, Efl_Text_Style_Strikethrough_Type type EINA_UNUSED) { ASYNC_BLOCK; _FMT_SET(strikethrough, type); } static Efl_Text_Style_Strikethrough_Type -_efl_canvas_textblock_efl_text_style_strikethrough_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_strikethrough_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED) { return _FMT(strikethrough); } static void -_efl_canvas_textblock_efl_text_style_strikethrough_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_strikethrough_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) { ASYNC_BLOCK; _FMT_COLOR_SET(strikethrough); } static void -_efl_canvas_textblock_efl_text_style_strikethrough_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_strikethrough_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) { _FMT_COLOR_RET(strikethrough); } @@ -16578,7 +16578,7 @@ _get_dir_from_map(Efl_Text_Style_Shadow_Direction dir) } static void -_efl_canvas_textblock_efl_text_style_effect_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, Efl_Text_Style_Effect_Type type EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_effect_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, Efl_Text_Style_Effect_Type type EINA_UNUSED) { ASYNC_BLOCK; _FMT_INFO_SET_START(effect, type); @@ -16590,26 +16590,26 @@ _efl_canvas_textblock_efl_text_style_effect_type_set(Eo *obj EINA_UNUSED, Efl_Ca } static Efl_Text_Style_Effect_Type -_efl_canvas_textblock_efl_text_style_effect_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_effect_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED) { return _FMT_INFO(effect); } static void -_efl_canvas_textblock_efl_text_style_outline_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_outline_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) { ASYNC_BLOCK; _FMT_COLOR_SET(outline); } static void -_efl_canvas_textblock_efl_text_style_outline_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_outline_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) { _FMT_COLOR_RET(outline); } static void -_efl_canvas_textblock_efl_text_style_shadow_direction_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, Efl_Text_Style_Shadow_Direction type EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_shadow_direction_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, Efl_Text_Style_Shadow_Direction type EINA_UNUSED) { ASYNC_BLOCK; _FMT_INFO_SET_START(shadow_direction, type); @@ -16619,52 +16619,52 @@ _efl_canvas_textblock_efl_text_style_shadow_direction_set(Eo *obj EINA_UNUSED, E } static Efl_Text_Style_Shadow_Direction -_efl_canvas_textblock_efl_text_style_shadow_direction_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_shadow_direction_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED) { return _FMT_INFO(shadow_direction); } static void -_efl_canvas_textblock_efl_text_style_shadow_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_shadow_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) { ASYNC_BLOCK; _FMT_COLOR_SET(shadow); } static void -_efl_canvas_textblock_efl_text_style_shadow_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_shadow_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) { _FMT_COLOR_RET(shadow); } static void -_efl_canvas_textblock_efl_text_style_glow_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_glow_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) { ASYNC_BLOCK; _FMT_COLOR_SET(glow); } static void -_efl_canvas_textblock_efl_text_style_glow_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_glow_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) { _FMT_COLOR_RET(glow); } static void -_efl_canvas_textblock_efl_text_style_glow2_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_glow2_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) { ASYNC_BLOCK; _FMT_COLOR_SET(glow2); } static void -_efl_canvas_textblock_efl_text_style_glow2_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_glow2_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) { _FMT_COLOR_RET(glow2); } static void -_efl_canvas_textblock_efl_text_style_gfx_filter_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, +_efl_canvas_textblock_efl_text_style_text_gfx_filter_set(Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED, const char *gfx_filter_name) { ASYNC_BLOCK; @@ -16688,7 +16688,7 @@ _efl_canvas_textblock_efl_text_style_gfx_filter_set(Eo *obj EINA_UNUSED, Efl_Can } static const char * -_efl_canvas_textblock_efl_text_style_gfx_filter_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED) +_efl_canvas_textblock_efl_text_style_text_gfx_filter_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Textblock_Data *o EINA_UNUSED) { return _FMT(gfx_filter)?_FMT(gfx_filter->name):NULL; } diff --git a/src/tests/edje/edje_test_text.c b/src/tests/edje/edje_test_text.c index fc5e67a442..a66132c1d8 100644 --- a/src/tests/edje/edje_test_text.c +++ b/src/tests/edje/edje_test_text.c @@ -180,7 +180,7 @@ START_TEST(edje_test_text_color) efl_file_key_set(layout, "test"); ck_assert(!efl_file_load(layout)); - efl_text_normal_color_set(efl_part(layout, "text"), 255, 255, 255, 255); + efl_text_color_set(efl_part(layout, "text"), 255, 255, 255, 255); } END_TEST @@ -195,9 +195,9 @@ _basic_check(Eo *layout, Eina_Bool set) // Just normal_color is enough if (set) { - efl_text_normal_color_set(efl_part(layout, "text"), + efl_text_color_set(efl_part(layout, "text"), 255, 255, 255, 255); - efl_text_backing_color_set(efl_part(layout, "text"), + efl_text_background_color_set(efl_part(layout, "text"), 255, 255, 255, 255); efl_text_glow_color_set(efl_part(layout, "text"), 255, 255, 255, 255); @@ -217,13 +217,13 @@ _basic_check(Eo *layout, Eina_Bool set) 255, 255, 255, 255); } - efl_text_normal_color_get(efl_part(layout, "text"), &r, &g, &b, &a); + efl_text_color_get(efl_part(layout, "text"), &r, &g, &b, &a); ck_assert_int_eq(r, 255); ck_assert_int_eq(g, 255); ck_assert_int_eq(b, 255); ck_assert_int_eq(a, 255); - efl_text_backing_color_get(efl_part(layout, "text"), &r, &g, &b, &a); + efl_text_background_color_get(efl_part(layout, "text"), &r, &g, &b, &a); ck_assert_int_eq(r, 255); ck_assert_int_eq(g, 255); ck_assert_int_eq(b, 255); diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c index 94849a57e1..e2442c7163 100644 --- a/src/tests/evas/evas_test_textblock.c +++ b/src/tests/evas/evas_test_textblock.c @@ -4649,7 +4649,7 @@ EFL_START_TEST(efl_canvas_textblock_style) ck_assert_int_eq(efl_text_wrap_get(txt), EFL_TEXT_FORMAT_WRAP_NONE); efl_canvas_textblock_style_apply(txt, "backing=on"); - ck_assert_int_eq(efl_text_backing_type_get(txt), EFL_TEXT_STYLE_BACKING_TYPE_ENABLED); + ck_assert_int_eq(efl_text_background_type_get(txt), EFL_TEXT_STYLE_BACKGROUND_TYPE_ENABLED); efl_canvas_textblock_style_apply(txt, "style=far_soft_shadow"); ck_assert_int_eq(efl_text_effect_type_get(txt), EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SOFT_SHADOW); @@ -4667,7 +4667,7 @@ EFL_START_TEST(efl_canvas_textblock_style) ck_assert_int_eq(efl_text_shadow_direction_get(txt), EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM); efl_canvas_textblock_style_apply(txt, "color=#EF596C"); - efl_text_normal_color_get(txt, &r, &g, &b, &a); + efl_text_color_get(txt, &r, &g, &b, &a); ck_assert_int_eq(r, 0xEF); ck_assert_int_eq(g, 0x59); ck_assert_int_eq(b, 0x6C); From 8dbc75fdce3a88bbb7cd29ab9ee2383b4d76417d Mon Sep 17 00:00:00 2001 From: Ali Alzyod Date: Fri, 20 Dec 2019 12:35:13 +0100 Subject: [PATCH 06/27] efl_text_attribute_factory: rename to efl_text_formatter Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8455 Differential Revision: https://phab.enlightenment.org/D10925 --- src/bin/elementary/test_efl_ui_text.c | 2 +- src/lib/elementary/efl_ui_textbox.c | 20 +++++++------- src/lib/evas/Efl_Canvas.h | 2 +- src/lib/evas/Evas_Eo.h | 2 +- src/lib/evas/Evas_Internal.h | 12 ++++----- ...tribute_factory.c => efl_text_formatter.c} | 26 +++++++++---------- ...ibute_factory.eo => efl_text_formatter.eo} | 4 +-- src/lib/evas/canvas/meson.build | 4 +-- src/tests/evas/evas_test_textblock.c | 8 +++--- 9 files changed, 40 insertions(+), 40 deletions(-) rename src/lib/evas/canvas/{efl_text_attribute_factory.c => efl_text_formatter.c} (77%) rename src/lib/evas/canvas/{efl_text_attribute_factory.eo => efl_text_formatter.eo} (92%) diff --git a/src/bin/elementary/test_efl_ui_text.c b/src/bin/elementary/test_efl_ui_text.c index 1d098c1052..dc1748bd07 100644 --- a/src/bin/elementary/test_efl_ui_text.c +++ b/src/bin/elementary/test_efl_ui_text.c @@ -16,7 +16,7 @@ _apply_style(Eo *obj, size_t start_pos, size_t end_pos, const char *style) efl_text_cursor_position_set(start, start_pos); efl_text_cursor_position_set(end, end_pos); - efl_text_attribute_factory_attribute_insert(start, end, style); + efl_text_formatter_attribute_insert(start, end, style); efl_del(start); efl_del(end); diff --git a/src/lib/elementary/efl_ui_textbox.c b/src/lib/elementary/efl_ui_textbox.c index 26e09f0f72..31531d9ef6 100644 --- a/src/lib/elementary/efl_ui_textbox.c +++ b/src/lib/elementary/efl_ui_textbox.c @@ -2808,7 +2808,7 @@ _textblock_node_format_to_atspi_text_attr(Efl_Text_Attribute_Handle *annotation) Efl_Access_Text_Attribute *ret; const char *txt; - txt = efl_text_attribute_factory_attribute_get(annotation); + txt = efl_text_formatter_attribute_get(annotation); if (!txt) return NULL; ret = calloc(1, sizeof(Efl_Access_Text_Attribute)); @@ -2843,7 +2843,7 @@ _efl_ui_textbox_efl_access_text_attribute_get(const Eo *obj, Efl_Ui_Textbox_Data efl_text_cursor_position_set(cur1, *start_offset); efl_text_cursor_position_set(cur2, *end_offset); - annotations = efl_text_attribute_factory_range_attributes_get(cur1, cur2); + annotations = efl_text_formatter_range_attributes_get(cur1, cur2); efl_del(cur1); efl_del(cur2); @@ -2889,7 +2889,7 @@ _efl_ui_textbox_efl_access_text_text_attributes_get(const Eo *obj, Efl_Ui_Textbo efl_text_cursor_position_set(cur1, *start_offset); efl_text_cursor_position_set(cur2, *end_offset); - annotations = efl_text_attribute_factory_range_attributes_get(cur1, cur2); + annotations = efl_text_formatter_range_attributes_get(cur1, cur2); efl_del(cur1); efl_del(cur2); @@ -2924,7 +2924,7 @@ _efl_ui_textbox_efl_access_text_default_attributes_get(const Eo *obj, Efl_Ui_Tex efl_text_cursor_move(start, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST); efl_text_cursor_move(end, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); - annotations = efl_text_attribute_factory_range_attributes_get(start, end); + annotations = efl_text_formatter_range_attributes_get(start, end); EINA_ITERATOR_FOREACH(annotations, an) { @@ -3288,14 +3288,14 @@ _anchor_get(Eo *obj, Efl_Ui_Textbox_Data *sd, Efl_Text_Attribute_Handle *an) Eina_List *i; const char *str; - str = efl_text_attribute_factory_attribute_get(an); + str = efl_text_formatter_attribute_get(an); EINA_LIST_FOREACH(sd->anchors, i, anc) { if (anc->annotation == an) break; } - if (!anc && (efl_text_attribute_factory_attribute_is_item(an) || !strncmp(str, "a ", 2))) + if (!anc && (efl_text_formatter_attribute_is_item(an) || !strncmp(str, "a ", 2))) { const char *p; @@ -3304,7 +3304,7 @@ _anchor_get(Eo *obj, Efl_Ui_Textbox_Data *sd, Efl_Text_Attribute_Handle *an) { anc->obj = obj; anc->annotation = an; - anc->item = efl_text_attribute_factory_attribute_is_item(an); + anc->item = efl_text_formatter_attribute_is_item(an); p = strstr(str, "href="); if (p) { @@ -3344,7 +3344,7 @@ _anchors_update(Eo *obj, Efl_Ui_Textbox_Data *sd) efl_text_cursor_move(start, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST); efl_text_cursor_move(end, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); - it = efl_text_attribute_factory_range_attributes_get(start, end); + it = efl_text_formatter_range_attributes_get(start, end); efl_del(start); efl_del(end); @@ -3386,7 +3386,7 @@ _anchors_update(Eo *obj, Efl_Ui_Textbox_Data *sd) } rect = eina_list_data_get(anc->rects); - efl_text_attribute_factory_item_geometry_get(anc->annotation, &cx, &cy, &cw, &ch); + efl_text_formatter_item_geometry_get(anc->annotation, &cx, &cy, &cw, &ch); efl_gfx_entity_size_set(rect->obj, EINA_SIZE2D(cw, ch)); efl_gfx_entity_position_set(rect->obj, EINA_POSITION2D(off.x + cx, off.y + cy)); @@ -3400,7 +3400,7 @@ _anchors_update(Eo *obj, Efl_Ui_Textbox_Data *sd) size_t count; start = efl_ui_textbox_cursor_create(obj); end = efl_ui_textbox_cursor_create(obj); - efl_text_attribute_factory_attribute_cursors_get(anc->annotation, start, end); + efl_text_formatter_attribute_cursors_get(anc->annotation, start, end); range = efl_text_cursor_range_geometry_get(start, end); count = eina_list_count(eina_iterator_container_get(range)); diff --git a/src/lib/evas/Efl_Canvas.h b/src/lib/evas/Efl_Canvas.h index 53bc52cfb1..1963aa2a55 100644 --- a/src/lib/evas/Efl_Canvas.h +++ b/src/lib/evas/Efl_Canvas.h @@ -84,7 +84,7 @@ extern "C" { */ #include #include -#include +#include #include #include #include diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h index 4d42740252..1137426a30 100644 --- a/src/lib/evas/Evas_Eo.h +++ b/src/lib/evas/Evas_Eo.h @@ -148,7 +148,7 @@ struct _Efl_Canvas_Object_Animation_Event * @{ */ #include "canvas/efl_text_cursor.eo.h" -#include "canvas/efl_text_attribute_factory.eo.h" +#include "canvas/efl_text_formatter.eo.h" #include "canvas/efl_canvas_textblock.eo.h" #include "canvas/efl_canvas_textblock_factory.eo.h" /** diff --git a/src/lib/evas/Evas_Internal.h b/src/lib/evas/Evas_Internal.h index 0fa833c362..4282488644 100644 --- a/src/lib/evas/Evas_Internal.h +++ b/src/lib/evas/Evas_Internal.h @@ -322,12 +322,12 @@ EAPI Eina_Bool evas_textblock_cursor_at_cluster_as_single_glyph(Evas_Textblock_C /*Attribute Factory Internal function*/ -EAPI const char * efl_text_attribute_factory_attribute_get(Efl_Text_Attribute_Handle *annotation); -EAPI Eina_Iterator * efl_text_attribute_factory_range_attributes_get(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end); -EAPI void efl_text_attribute_factory_attribute_cursors_get(const Efl_Text_Attribute_Handle *handle, Efl_Text_Cursor *start, Efl_Text_Cursor *end); -EAPI void efl_text_attribute_factory_remove(Efl_Text_Attribute_Handle *annotation); -EAPI Eina_Bool efl_text_attribute_factory_attribute_is_item(Efl_Text_Attribute_Handle *annotation); -EAPI Eina_Bool efl_text_attribute_factory_item_geometry_get(const Efl_Text_Attribute_Handle *annotation, int *x, int *y, int *w, int *h); +EAPI const char * efl_text_formatter_attribute_get(Efl_Text_Attribute_Handle *annotation); +EAPI Eina_Iterator * efl_text_formatter_range_attributes_get(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end); +EAPI void efl_text_formatter_attribute_cursors_get(const Efl_Text_Attribute_Handle *handle, Efl_Text_Cursor *start, Efl_Text_Cursor *end); +EAPI void efl_text_formatter_remove(Efl_Text_Attribute_Handle *annotation); +EAPI Eina_Bool efl_text_formatter_attribute_is_item(Efl_Text_Attribute_Handle *annotation); +EAPI Eina_Bool efl_text_formatter_item_geometry_get(const Efl_Text_Attribute_Handle *annotation, int *x, int *y, int *w, int *h); #ifdef __cplusplus } diff --git a/src/lib/evas/canvas/efl_text_attribute_factory.c b/src/lib/evas/canvas/efl_text_formatter.c similarity index 77% rename from src/lib/evas/canvas/efl_text_attribute_factory.c rename to src/lib/evas/canvas/efl_text_formatter.c index 72e8b2a395..8325245cd2 100644 --- a/src/lib/evas/canvas/efl_text_attribute_factory.c +++ b/src/lib/evas/canvas/efl_text_formatter.c @@ -4,15 +4,15 @@ #include "efl_canvas_textblock_internal.h" #include "efl_text_cursor.eo.h" -#define MY_CLASS EFL_TEXT_ATTRIBUTE_FACTORY_CLASS +#define MY_CLASS EFL_TEXT_FORMATTER_CLASS typedef struct { -} Efl_Text_Attribute_Factory_Data; +} Efl_Text_Formatter_Data; EOLIAN static void -_efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format) +_efl_text_formatter_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format) { EINA_SAFETY_ON_TRUE_RETURN(!efl_text_cursor_handle_get(start) || !efl_text_cursor_handle_get(end) || @@ -27,19 +27,19 @@ _efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const } EOLIAN static unsigned int -_efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end) +_efl_text_formatter_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end) { unsigned int ret = 0; Eina_Iterator *annotations; Efl_Text_Attribute_Handle *an; - annotations = efl_text_attribute_factory_range_attributes_get(start, end); + annotations = efl_text_formatter_range_attributes_get(start, end); if (!annotations) return ret; EINA_ITERATOR_FOREACH(annotations, an) { ret++; - efl_text_attribute_factory_remove(an); + efl_text_formatter_remove(an); } eina_iterator_free(annotations); @@ -47,7 +47,7 @@ _efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const } const char * -efl_text_attribute_factory_attribute_get(Efl_Text_Attribute_Handle *annotation) +efl_text_formatter_attribute_get(Efl_Text_Attribute_Handle *annotation) { EINA_SAFETY_ON_TRUE_RETURN_VAL(!annotation || !(annotation->obj), NULL); @@ -55,7 +55,7 @@ efl_text_attribute_factory_attribute_get(Efl_Text_Attribute_Handle *annotation) } Eina_Iterator * -efl_text_attribute_factory_range_attributes_get(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end) +efl_text_formatter_range_attributes_get(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end) { Eina_List *lst = NULL; Efl_Text_Attribute_Handle *it; @@ -86,7 +86,7 @@ efl_text_attribute_factory_range_attributes_get(const Efl_Text_Cursor *start, co } void -efl_text_attribute_factory_attribute_cursors_get(const Efl_Text_Attribute_Handle *handle, Efl_Text_Cursor *start, Efl_Text_Cursor *end) +efl_text_formatter_attribute_cursors_get(const Efl_Text_Attribute_Handle *handle, Efl_Text_Cursor *start, Efl_Text_Cursor *end) { EINA_SAFETY_ON_TRUE_RETURN (!handle || !(handle->obj)); @@ -97,7 +97,7 @@ efl_text_attribute_factory_attribute_cursors_get(const Efl_Text_Attribute_Handle } void -efl_text_attribute_factory_remove(Efl_Text_Attribute_Handle *annotation) +efl_text_formatter_remove(Efl_Text_Attribute_Handle *annotation) { EINA_SAFETY_ON_TRUE_RETURN (!annotation || !(annotation->obj)); @@ -106,7 +106,7 @@ efl_text_attribute_factory_remove(Efl_Text_Attribute_Handle *annotation) } Eina_Bool -efl_text_attribute_factory_attribute_is_item(Efl_Text_Attribute_Handle *annotation) +efl_text_formatter_attribute_is_item(Efl_Text_Attribute_Handle *annotation) { EINA_SAFETY_ON_TRUE_RETURN_VAL(!annotation || !(annotation->obj), EINA_FALSE); @@ -114,7 +114,7 @@ efl_text_attribute_factory_attribute_is_item(Efl_Text_Attribute_Handle *annotati } Eina_Bool -efl_text_attribute_factory_item_geometry_get(const Efl_Text_Attribute_Handle *annotation, int *x, int *y, int *w, int *h) +efl_text_formatter_item_geometry_get(const Efl_Text_Attribute_Handle *annotation, int *x, int *y, int *w, int *h) { EINA_SAFETY_ON_TRUE_RETURN_VAL(!annotation || !(annotation->obj), EINA_FALSE); @@ -130,4 +130,4 @@ efl_text_attribute_factory_item_geometry_get(const Efl_Text_Attribute_Handle *an return evas_textblock_cursor_format_item_geometry_get(&cur, x, y, w, h); } -#include "efl_text_attribute_factory.eo.c" +#include "efl_text_formatter.eo.c" diff --git a/src/lib/evas/canvas/efl_text_attribute_factory.eo b/src/lib/evas/canvas/efl_text_formatter.eo similarity index 92% rename from src/lib/evas/canvas/efl_text_attribute_factory.eo rename to src/lib/evas/canvas/efl_text_formatter.eo index 5d10451fc2..ccc84816b5 100644 --- a/src/lib/evas/canvas/efl_text_attribute_factory.eo +++ b/src/lib/evas/canvas/efl_text_formatter.eo @@ -1,7 +1,7 @@ import efl_text_types; -abstract @beta Efl.Text.Attribute.Factory extends Efl.Object { - [[Attribute factory API to manage text attributes. +abstract @beta Efl.Text.Formatter extends Efl.Object { + [[Text Formatter API to manage text formatting(attributes). Use it to insert and remove style attributes (font, size, color, ...) using @Efl.Text.Cursor on EFL Widgets. Attributes can be assigned to character ranges, selected using two @Efl.Text.Cursor instances. diff --git a/src/lib/evas/canvas/meson.build b/src/lib/evas/canvas/meson.build index 92ed277f87..196b3962bb 100644 --- a/src/lib/evas/canvas/meson.build +++ b/src/lib/evas/canvas/meson.build @@ -56,7 +56,7 @@ pub_eo_files = [ 'efl_canvas_event_grabber.eo', 'efl_text_cursor.eo', 'efl_canvas_textblock.eo', - 'efl_text_attribute_factory.eo', + 'efl_text_formatter.eo', 'efl_canvas_object_animation.eo', ] @@ -210,7 +210,7 @@ evas_src += files([ 'evas_canvas3d_eet.c', 'efl_canvas_object_animation.c', 'efl_text_cursor.c', - 'efl_text_attribute_factory.c' + 'efl_text_formatter.c' ]) evas_include_directories += include_directories('.') diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c index e2442c7163..56310f9f70 100644 --- a/src/tests/evas/evas_test_textblock.c +++ b/src/tests/evas/evas_test_textblock.c @@ -4362,17 +4362,17 @@ EFL_START_TEST(evas_textblock_annotation) efl_text_cursor_position_set(start, 0); efl_text_cursor_position_set(end, 3); - efl_text_attribute_factory_attribute_insert(start, end, "font_size=80"); + efl_text_formatter_attribute_insert(start, end, "font_size=80"); efl_text_cursor_position_set(start, 1); efl_text_cursor_position_set(end, 2); - efl_text_attribute_factory_attribute_insert(start, end, "font=arial"); + efl_text_formatter_attribute_insert(start, end, "font=arial"); efl_text_cursor_position_set(start, 2); efl_text_cursor_position_set(end, 3); - efl_text_attribute_factory_attribute_insert(start, end, "color=#fff"); + efl_text_formatter_attribute_insert(start, end, "color=#fff"); efl_text_cursor_position_set(start, 0); efl_text_cursor_position_set(end, 3); - unsigned int count = efl_text_attribute_factory_attribute_clear(start, end); + unsigned int count = efl_text_formatter_attribute_clear(start, end); fail_if(count != 3); } EFL_END_TEST; From 74a8c646bcb9a344e446c1c5c19a336a5e3dbb68 Mon Sep 17 00:00:00 2001 From: ali Date: Fri, 20 Dec 2019 12:45:31 +0100 Subject: [PATCH 07/27] efl.canvas.textblock: update eo file documentation Summary: T8460 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10936 --- src/lib/evas/canvas/efl_canvas_textblock.eo | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib/evas/canvas/efl_canvas_textblock.eo b/src/lib/evas/canvas/efl_canvas_textblock.eo index 978c502b2c..442c418fcd 100644 --- a/src/lib/evas/canvas/efl_canvas_textblock.eo +++ b/src/lib/evas/canvas/efl_canvas_textblock.eo @@ -54,7 +54,8 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text, @property style_insets { [[Gets the left, right, top and bottom insets of the text. - The inset is any applied padding on the text. + The inset is any applied padding on the text (which is calculated + internally by styling applied to Textblock). ]] get {} values { @@ -78,11 +79,13 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text, } @property newline_as_paragraph_separator { [[When $true, the newline character will behave as a paragraph separator. + Paragraph separator equal U+2029, and new line equal U+000A. + This will effect a lot of text behaviour like @Efl.Text.Cursor.move method. ]] set {} get {} values { - mode: bool; [[$true for legacy mode, $false otherwise.]] + mode: bool; [[$true to treat new line as paragraph separator, $false otherwise.]] } } style_apply { @@ -433,6 +436,10 @@ class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text, Once layout is complete, the result is returned as @Eina.Rect, with the $w and $h fields set. + + This can be used to layout Textblock before it is required + to layout internally in back thread, which can enhance application + performance. ]] return: future; [[Future for layout result.]] } From 778bef8e606cd1b20b9213a0516c02072391aa7a Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Fri, 20 Dec 2019 13:48:17 +0100 Subject: [PATCH 08/27] efl_ui_widget: add description of widget parts Summary: Description of the widget parts, shadow and background, is added for documentation. Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10940 --- src/lib/elementary/efl_ui_widget.eo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/elementary/efl_ui_widget.eo b/src/lib/elementary/efl_ui_widget.eo index 14375c2137..2e08eb25fe 100644 --- a/src/lib/elementary/efl_ui_widget.eo +++ b/src/lib/elementary/efl_ui_widget.eo @@ -381,8 +381,8 @@ abstract Efl.Ui.Widget extends Efl.Canvas.Group implements Efl.Access.Object, } } parts { - shadow : Efl.Ui.Widget_Part_Shadow; - background : Efl.Ui.Widget_Part_Bg; + shadow : Efl.Ui.Widget_Part_Shadow; [[Drop-shadow or glow effect around the widget.]] + background : Efl.Ui.Widget_Part_Bg; [[Background of the widget.]] } implements { class.constructor; From b9818f566cca37888782c01a4f4388ce3260af2d Mon Sep 17 00:00:00 2001 From: ali Date: Fri, 20 Dec 2019 14:04:18 +0100 Subject: [PATCH 09/27] efl.ui.textbox: rename _disabled properties into _enabled Reviewers: segfaultxavi, woohyun, bu5hm4n Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8522 Differential Revision: https://phab.enlightenment.org/D10923 --- src/lib/elementary/efl_ui_clock.c | 2 +- src/lib/elementary/efl_ui_textbox.c | 32 ++++++++++++++-------------- src/lib/elementary/efl_ui_textbox.eo | 12 +++++------ 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/lib/elementary/efl_ui_clock.c b/src/lib/elementary/efl_ui_clock.c index 1e6ae63f2d..89a0d4a02b 100644 --- a/src/lib/elementary/efl_ui_clock.c +++ b/src/lib/elementary/efl_ui_clock.c @@ -201,7 +201,7 @@ field_create(Eo *obj, Efl_Ui_Clock_Type field_type) efl_text_multiline_set(efl_added, EINA_FALSE), efl_text_interactive_editable_set(efl_added, EINA_FALSE), efl_input_text_input_panel_autoshow_set(efl_added, EINA_FALSE), - efl_ui_textbox_context_menu_disabled_set(efl_added, EINA_TRUE)); + efl_ui_textbox_context_menu_enabled_set(efl_added, EINA_FALSE)); } evas_object_data_set(field_obj, "_field_type", (void *)field_type); diff --git a/src/lib/elementary/efl_ui_textbox.c b/src/lib/elementary/efl_ui_textbox.c index 31531d9ef6..ed9c4b365f 100644 --- a/src/lib/elementary/efl_ui_textbox.c +++ b/src/lib/elementary/efl_ui_textbox.c @@ -102,7 +102,7 @@ struct _Efl_Ui_Textbox_Data Eina_Future *primary; Eina_Future *clipboard; } sel_future; - Eina_Bool sel_handler_disabled : 1; + Eina_Bool sel_handler_enabled : 1; Eina_Bool start_handler_down : 1; Eina_Bool start_handler_shown : 1; Eina_Bool end_handler_down : 1; @@ -110,7 +110,7 @@ struct _Efl_Ui_Textbox_Data Eina_Bool deferred_decoration_selection : 1; Eina_Bool deferred_decoration_cursor : 1; Eina_Bool deferred_decoration_anchor : 1; - Eina_Bool context_menu : 1; + Eina_Bool context_menu_enabled : 1; Eina_Bool long_pressed : 1; Eina_Bool auto_save : 1; Eina_Bool has_text : 1; @@ -465,7 +465,7 @@ _update_selection_handler(Eo *obj) return; } - if (!sd->sel_handler_disabled) + if (sd->sel_handler_enabled) { Eina_Rect rect; Eina_Position2D off; @@ -1176,7 +1176,7 @@ _menu_call(Evas_Object *obj) { sd->api->obj_longpress(obj); } - else if (sd->context_menu) + else if (sd->context_menu_enabled) { const char *context_menu_orientation; Eina_Bool ownersel; @@ -1974,13 +1974,13 @@ _efl_ui_textbox_efl_object_constructor(Eo *obj, Efl_Ui_Textbox_Data *sd) sd->entry_edje = wd->resize_obj; sd->cnp_mode = EFL_UI_SELECTION_FORMAT_TEXT; sd->line_wrap = ELM_WRAP_WORD; - sd->context_menu = EINA_TRUE; + sd->context_menu_enabled = EINA_TRUE; sd->auto_save = EINA_TRUE; efl_text_interactive_editable_set(obj, EINA_TRUE); efl_text_interactive_selection_allowed_set(obj, EINA_TRUE); sd->drop_format = EFL_UI_SELECTION_FORMAT_MARKUP | EFL_UI_SELECTION_FORMAT_IMAGE; sd->last.scroll = EINA_SIZE2D(0, 0); - sd->sel_handler_disabled = EINA_TRUE; + sd->sel_handler_enabled = EINA_FALSE; return obj; } @@ -2197,16 +2197,16 @@ _efl_ui_textbox_selection_get(const Eo *obj, Efl_Ui_Textbox_Data *sd EINA_UNUSED } EOLIAN static void -_efl_ui_textbox_selection_handler_disabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool disabled) +_efl_ui_textbox_selection_handler_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool enabled) { - if (sd->sel_handler_disabled == disabled) return; - sd->sel_handler_disabled = disabled; + if (sd->sel_handler_enabled == enabled) return; + sd->sel_handler_enabled = enabled; } EOLIAN static Eina_Bool -_efl_ui_textbox_selection_handler_disabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd) +_efl_ui_textbox_selection_handler_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd) { - return sd->sel_handler_disabled; + return sd->sel_handler_enabled; } static void @@ -2349,16 +2349,16 @@ _efl_ui_textbox_selection_paste(Eo *obj, Efl_Ui_Textbox_Data *sd EINA_UNUSED) } EOLIAN static void -_efl_ui_textbox_context_menu_disabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool disabled) +_efl_ui_textbox_context_menu_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd, Eina_Bool enabled) { - if (sd->context_menu == !disabled) return; - sd->context_menu = !disabled; + if (sd->context_menu_enabled == enabled) return; + sd->context_menu_enabled = enabled; } EOLIAN static Eina_Bool -_efl_ui_textbox_context_menu_disabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd) +_efl_ui_textbox_context_menu_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textbox_Data *sd) { - return !sd->context_menu; + return sd->context_menu_enabled; } EOLIAN static Eina_Error diff --git a/src/lib/elementary/efl_ui_textbox.eo b/src/lib/elementary/efl_ui_textbox.eo index 11007ffef8..9104d436b2 100644 --- a/src/lib/elementary/efl_ui_textbox.eo +++ b/src/lib/elementary/efl_ui_textbox.eo @@ -19,14 +19,14 @@ class @beta Efl.Ui.Textbox extends Efl.Ui.Layout_Base implements Efl.Input.Click scroll: bool; [[$true to enable scrolling. Default is $false.]] } } - @property context_menu_disabled { - [[This disables the entry's contextual (longpress) menu.]] + @property context_menu_enabled { + [[This enables or disables the entry's contextual (longpress) menu.]] set { } get { } values { - disabled: bool; [[If $true, the menu is disabled.]] + enabled: bool; [[If $true, the menu is enabled.]] } } @property cnp_mode { @@ -45,14 +45,14 @@ class @beta Efl.Ui.Textbox extends Efl.Ui.Layout_Base implements Efl.Input.Click format: Efl.Ui.Selection_Format; [[Format for copy & paste.]] } } - @property selection_handler_disabled { - [[This disables the entry's selection handlers.]] + @property selection_handler_enabled { + [[This enables or disables the entry's selection handlers.]] set { } get { } values { - disabled: bool; [[If $true, the selection handlers are disabled.]] + enabled: bool; [[If $true, the selection handlers are enabled.]] } } From 193ae1c14ceb0b61d172a89d2dec8fe3d28d7733 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Fri, 20 Dec 2019 16:13:58 +0100 Subject: [PATCH 10/27] efl_ui_layout: add API to check out the theme_version this new API returns the theme version specified in the loaded theme. Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10944 --- src/lib/elementary/efl_ui_layout.c | 6 ++++++ src/lib/elementary/efl_ui_layout_base.eo | 16 ++++++++++++++++ src/tests/elementary/efl_ui_test_layout.c | 11 +++++++++++ 3 files changed, 33 insertions(+) diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index a05a8ebb6a..9ab1ab3a4a 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -645,6 +645,12 @@ _efl_ui_layout_base_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Layout_Data *sd) return EFL_UI_THEME_APPLY_ERROR_NONE; } +EOLIAN static int +_efl_ui_layout_base_theme_version_get(const Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *pd) +{ + return pd->version; +} + EOLIAN static Eina_Bool _efl_ui_layout_base_efl_ui_focus_object_on_focus_update(Eo *obj, Efl_Ui_Layout_Data *_pd EINA_UNUSED) { diff --git a/src/lib/elementary/efl_ui_layout_base.eo b/src/lib/elementary/efl_ui_layout_base.eo index aa616c777a..8cd206c310 100644 --- a/src/lib/elementary/efl_ui_layout_base.eo +++ b/src/lib/elementary/efl_ui_layout_base.eo @@ -87,6 +87,22 @@ abstract Efl.Ui.Layout_Base extends Efl.Ui.Widget implements Efl.Container, orientation : int; [[The new rotation angle, in degrees.]] } } + @property theme_version { + [[The version a theme does offer + + A theme might offer older theme versions, with this property you can detect which version is running. The theme version is bound to the efl-version, the oldest version you will get here is 123. The newest of released EFL. + + This property is only valid after @Efl.Ui.Widget.theme_apply has been called. + + In case there is no version specified, 0 is returned. + ]] + get { + + } + values { + version : int; [[Theme version of this objec, for a EFL version called 1.23, this property will return 123.]] + } + } } implements { class.constructor; diff --git a/src/tests/elementary/efl_ui_test_layout.c b/src/tests/elementary/efl_ui_test_layout.c index 387bf9aa68..86f4b1efe8 100644 --- a/src/tests/elementary/efl_ui_test_layout.c +++ b/src/tests/elementary/efl_ui_test_layout.c @@ -208,6 +208,16 @@ EFL_START_TEST(efl_ui_layout_test_api_ordering) } EFL_END_TEST +EFL_START_TEST(efl_ui_layout_test_versioning) +{ + Evas_Object *win; + + win = win_add(NULL, "layout", EFL_UI_WIN_TYPE_BASIC); + Eo *layout = efl_add(EFL_UI_BUTTON_CLASS, win); + ck_assert_int_eq(efl_ui_layout_theme_version_get(layout), 123); +} +EFL_END_TEST + void efl_ui_test_layout(TCase *tc) { tcase_add_test(tc, efl_ui_layout_test_property_bind); @@ -218,4 +228,5 @@ void efl_ui_test_layout(TCase *tc) tcase_add_test(tc, efl_ui_layout_test_api_ordering); tcase_add_test(tc, efl_ui_layout_test_callback); tcase_add_test(tc, efl_ui_layout_test_property_bind_provider); + tcase_add_test(tc, efl_ui_layout_test_versioning); } From c49880076c353202e1d7a19ac2841a01f5756d41 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Tue, 17 Dec 2019 10:07:14 +0100 Subject: [PATCH 11/27] efl_ui_item: use signals from the theme and not object the problem here is that when we are using the signals from the object, then the edje object itself will receive press/unpress events before any content that is swallowed into the edje object. This means, that no clickable content, added to a item could be clicked without selecting / unselecting the item. Which was a problem. With this commit the theme is sending signals which are then passed to the efl.input.clickable mixin, this way, the part is stacked below the added content, which means, clickable content will not select / unselect the item anymore. Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10892 --- data/elementary/themes/edc/efl/grid.edc | 21 +++++----- data/elementary/themes/edc/efl/group_item.edc | 2 +- data/elementary/themes/edc/efl/list.edc | 42 ++++++++++--------- src/lib/elementary/efl_ui_item.c | 5 ++- .../elementary/spec/efl_test_clickable.c | 6 +-- 5 files changed, 39 insertions(+), 37 deletions(-) diff --git a/data/elementary/themes/edc/efl/grid.edc b/data/elementary/themes/edc/efl/grid.edc index 51c1bd941d..d312ee71db 100644 --- a/data/elementary/themes/edc/efl/grid.edc +++ b/data/elementary/themes/edc/efl/grid.edc @@ -41,7 +41,7 @@ group { "efl/view_grid"; data.item: "version" "123"; } -group { "efl/grid_item"; data.item: "version" "123"; +group { "efl/grid_item"; data.item: "version" "124"; data.item: "selectraise" "on"; data.item: "focusraise" "on"; images.image: "bevel_dark_out.png" COMP; @@ -52,15 +52,6 @@ group { "efl/grid_item"; data.item: "version" "123"; parts { // BASE PARTS // - rect { "event"; - desc { "default"; - color: 0 0 0 0; - } - desc { "disabled"; - inherit: "default"; - hid; - } - } rect { "base"; mouse; desc { "default"; } @@ -208,6 +199,15 @@ group { "efl/grid_item"; data.item: "version" "123"; color: 255 255 255 64; } } + rect { "event"; + desc { "default"; + color: 0 0 0 0; + } + desc { "disabled"; + inherit: "default"; + hid; + } + } swallow { "efl.icon"; clip_to: "icon_area"; desc { "default"; @@ -258,6 +258,7 @@ group { "efl/grid_item"; data.item: "version" "123"; // TOP PARTS // } programs { + EFL_UI_CLICKABLE_PART_BIND("event") program { signal: "efl,state,selected"; source: "efl"; action: STATE_SET "selected"; diff --git a/data/elementary/themes/edc/efl/group_item.edc b/data/elementary/themes/edc/efl/group_item.edc index a76ae36c8c..16d4c78b94 100644 --- a/data/elementary/themes/edc/efl/group_item.edc +++ b/data/elementary/themes/edc/efl/group_item.edc @@ -8,7 +8,7 @@ Group: efl/group_item (@since 1.23) */ -group { "efl/group_item"; data.item: "version" "123"; nomouse; program_source: "efl"; +group { "efl/group_item"; data.item: "version" "124"; nomouse; program_source: "efl"; images.image: "shadow_square_tiny.png" COMP; images.image: "bevel_out.png" COMP; images.image: "horizontal_separated_bar_small_glow.png" COMP; diff --git a/data/elementary/themes/edc/efl/list.edc b/data/elementary/themes/edc/efl/list.edc index 71da7877f2..debbd77944 100644 --- a/data/elementary/themes/edc/efl/list.edc +++ b/data/elementary/themes/edc/efl/list.edc @@ -56,7 +56,7 @@ group { "efl/list_view"; data.item: "version" "123"; } -group { "efl/list_item"; data.item: "version" "123"; +group { "efl/list_item"; data.item: "version" "124"; data.item: "selectraise" "on"; data.item: "focusraise" "on"; images.image: "bevel_curved_horiz_out.png" COMP; @@ -65,15 +65,6 @@ group { "efl/list_item"; data.item: "version" "123"; images.image: "bevel_horiz_out.png" COMP; images.image: "shine.png" COMP; parts { - rect { "event"; - desc { "default"; - color: 0 0 0 0; - } - desc { "disabled"; - inherit: "default"; - hid; - } - } rect { "base"; nomouse; desc { "default"; color: 64 64 64 255; @@ -218,6 +209,15 @@ group { "efl/list_item"; data.item: "version" "123"; hid; } } + rect { "event"; + desc { "default"; + color: 0 0 0 0; + } + desc { "disabled"; + inherit: "default"; + hid; + } + } //##// swallow { "efl.icon"; desc { "default"; @@ -268,6 +268,7 @@ group { "efl/list_item"; data.item: "version" "123"; } } programs { + EFL_UI_CLICKABLE_PART_BIND("event") program { signal: "efl,state,odd"; source: "efl"; action: STATE_SET "odd"; @@ -343,7 +344,7 @@ group { "efl/list_item"; data.item: "version" "123"; } } -group { "efl/list_item:placeholder"; data.item: "version" "123"; +group { "efl/list_item:placeholder"; data.item: "version" "124"; data.item: "selectraise" "on"; data.item: "focusraise" "on"; images.image: "bevel_curved_horiz_out.png" COMP; @@ -352,15 +353,6 @@ group { "efl/list_item:placeholder"; data.item: "version" "123"; images.image: "bevel_horiz_out.png" COMP; images.image: "shine.png" COMP; parts { - rect { "event"; - desc { "default"; - color: 0 0 0 0; - } - desc { "disabled"; - inherit: "default"; - hid; - } - } rect { "base"; nomouse; desc { "default"; color: 64 64 64 255; @@ -425,6 +417,15 @@ group { "efl/list_item:placeholder"; data.item: "version" "123"; vis; } } + rect { "event"; + desc { "default"; + color: 0 0 0 0; + } + desc { "disabled"; + inherit: "default"; + hid; + } + } //##// swallow { "efl.content"; mouse; scale; @@ -463,6 +464,7 @@ group { "efl/list_item:placeholder"; data.item: "version" "123"; } } programs { + EFL_UI_CLICKABLE_PART_BIND("event") program { signal: "efl,state,odd"; source: "efl"; action: STATE_SET "odd"; diff --git a/src/lib/elementary/efl_ui_item.c b/src/lib/elementary/efl_ui_item.c index 349416ee8a..5d86dc934d 100644 --- a/src/lib/elementary/efl_ui_item.c +++ b/src/lib/elementary/efl_ui_item.c @@ -129,7 +129,10 @@ _efl_ui_item_efl_object_finalize(Eo *obj, Efl_Ui_Item_Data *pd EINA_UNUSED) /* Support Item Focus Feature */ elm_widget_can_focus_set(obj, EINA_TRUE); - efl_ui_action_connector_bind_clickable_to_object(wd->resize_obj, obj); + if (efl_ui_layout_theme_version_get(obj) == 123) + efl_ui_action_connector_bind_clickable_to_object(wd->resize_obj, obj); + else + efl_ui_action_connector_bind_clickable_to_theme(wd->resize_obj, obj); return eo; } diff --git a/src/tests/elementary/spec/efl_test_clickable.c b/src/tests/elementary/spec/efl_test_clickable.c index e6991f851d..d297d299c1 100644 --- a/src/tests/elementary/spec/efl_test_clickable.c +++ b/src/tests/elementary/spec/efl_test_clickable.c @@ -12,7 +12,7 @@ #include "elm_widget.h" /* spec-meta-start {"test-interface":"Efl.Ui.Clickable", - "test-widgets": ["Efl.Ui.Button", "Efl.Ui.Image", "Efl.Ui.Panes", "Efl.Ui.Frame", "Efl.Ui.Item.Realized", "Efl.Ui.Radio", "Efl.Ui.Check"] + "test-widgets": ["Efl.Ui.Button", "Efl.Ui.Image", "Efl.Ui.Panes", "Efl.Ui.Frame", "Efl.Ui.Grid_Default_Item", "Efl.Ui.List_Default_Item", "Efl.Ui.Radio", "Efl.Ui.Check"] } spec-meta-end */ @@ -64,10 +64,6 @@ prepare_window(void) } else if (efl_isa(widget, EFL_UI_ITEM_CLASS)) { - elm_widget_theme_klass_set(widget, "grid_item"); - elm_widget_theme_element_set(widget, NULL); - elm_widget_theme_style_set(widget, NULL); - efl_ui_widget_theme_apply(widget); pos->x = 30; pos->y = 30; } From 47407478e8d247fd36aca607ec1bcc1f720bfa96 Mon Sep 17 00:00:00 2001 From: Bruno da Silva Belo Date: Tue, 17 Dec 2019 19:29:58 +0000 Subject: [PATCH 12/27] c#: Implement IList to Eina.Array. ref T8488 Reviewed-by: Felipe Magno de Almeida Differential Revision: https://phab.enlightenment.org/D10785 --- .../mono/efl_mono/efl_csharp_application.cs | 2 +- src/bindings/mono/eina_mono/eina_array.cs | 296 +++++++++++++----- src/lib/efl_mono/efl_custom_exports_mono.c | 11 + src/tests/efl_mono/Array.cs | 189 +++++++++++ src/tests/efl_mono/Eina.cs | 43 +-- src/tests/efl_mono/Events.cs | 2 +- src/tests/efl_mono/dummy_test_object.c | 16 +- src/tests/efl_mono/meson.build | 1 + 8 files changed, 450 insertions(+), 110 deletions(-) create mode 100644 src/tests/efl_mono/Array.cs diff --git a/src/bindings/mono/efl_mono/efl_csharp_application.cs b/src/bindings/mono/efl_mono/efl_csharp_application.cs index 94d56d3df9..8493abd6ab 100644 --- a/src/bindings/mono/efl_mono/efl_csharp_application.cs +++ b/src/bindings/mono/efl_mono/efl_csharp_application.cs @@ -209,7 +209,7 @@ public abstract class Application if (evt.arg.Initialization) { var evtArgv = evt.arg.Argv; - int n = evtArgv.Length; + int n = evtArgv.Count; var argv = new string[n]; for (int i = 0; i < n; ++i) { diff --git a/src/bindings/mono/eina_mono/eina_array.cs b/src/bindings/mono/eina_mono/eina_array.cs index 1573a88aa0..f5f807ad55 100644 --- a/src/bindings/mono/eina_mono/eina_array.cs +++ b/src/bindings/mono/eina_mono/eina_array.cs @@ -36,8 +36,9 @@ public static class ArrayNativeFunctions eina_array_free(IntPtr array); [DllImport(efl.Libs.Eina)] internal static extern void eina_array_flush(IntPtr array); + public delegate bool KeepCb(IntPtr data, IntPtr gdata); [DllImport(efl.Libs.Eina)] [return: MarshalAs(UnmanagedType.U1)] internal static extern bool - eina_array_remove(IntPtr array, IntPtr keep, IntPtr gdata); + eina_array_remove(IntPtr array, KeepCb keep, IntPtr gdata); [DllImport(efl.Libs.Eina)] [return: MarshalAs(UnmanagedType.U1)] internal static extern bool eina_array_push(IntPtr array, IntPtr data); @@ -45,6 +46,10 @@ public static class ArrayNativeFunctions eina_array_iterator_new(IntPtr array); [DllImport(efl.Libs.Eina)] internal static extern IntPtr eina_array_accessor_new(IntPtr array); + [DllImport(efl.Libs.Eina)] [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool + eina_array_find(IntPtr array, IntPtr data, + uint out_idx); [DllImport(efl.Libs.CustomExports)] internal static extern void eina_array_clean_custom_export_mono(IntPtr array); @@ -61,6 +66,8 @@ public static class ArrayNativeFunctions [DllImport(efl.Libs.CustomExports)] [return: MarshalAs(UnmanagedType.U1)] internal static extern bool eina_array_foreach_custom_export_mono(IntPtr array, IntPtr cb, IntPtr fdata); + [DllImport(efl.Libs.CustomExports)] internal static extern void + eina_array_insert_at_custom_export_mono(IntPtr array, uint index, IntPtr data); } /// A container of contiguous allocated elements. @@ -68,30 +75,42 @@ public static class ArrayNativeFunctions /// [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification="This is a generalized container mapping the native one.")] -public class Array : IEnumerable, IDisposable +public class Array : IList, IEnumerable, IDisposable { public const uint DefaultStep = 32; /// Pointer to the native buffer. [EditorBrowsable(EditorBrowsableState.Never)] - public IntPtr Handle {get;set;} = IntPtr.Zero; + public IntPtr Handle { get; set; } = IntPtr.Zero; + /// Whether this wrapper owns the native buffer. /// Since EFL 1.23. /// - public bool Own {get;set;} + internal bool Own { get; set; } + /// Who is in charge of releasing the resources wrapped by /// this instance. /// Since EFL 1.23. /// - public bool OwnContent {get;set;} - /// Length of the array. - /// Since EFL 1.23. + internal bool OwnContent { get; set; } + + /// Gets the number of elements contained in the . + /// Since EFL 1.24. /// - public int Length + public int Count { - get { return Count(); } + get => (int)eina_array_count_custom_export_mono(Handle); } + /// + /// Gets a value indicating whether the is read-only. + /// Since EFL 1.24. + /// + /// It's the negative of . + /// + /// + public bool IsReadOnly { get => !OwnContent; } + private void InitNew(uint step) { Handle = eina_array_new(step); @@ -104,23 +123,62 @@ public class Array : IEnumerable, IDisposable } internal bool InternalPush(IntPtr ele) - { - return eina_array_push_custom_export_mono(Handle, ele); - } + => eina_array_push_custom_export_mono(Handle, ele); internal IntPtr InternalPop() - { - return eina_array_pop_custom_export_mono(Handle); - } + => eina_array_pop_custom_export_mono(Handle); internal IntPtr InternalDataGet(int idx) - { - return eina_array_data_get_custom_export_mono(Handle, (uint)idx); // TODO: Check bounds ??? - } + => eina_array_data_get_custom_export_mono(Handle, CheckBounds(idx)); internal void InternalDataSet(int idx, IntPtr ele) + => eina_array_data_set_custom_export_mono(Handle, CheckBounds(idx), ele); + + private uint CheckBounds(int idx) { - eina_array_data_set_custom_export_mono(Handle, (uint)idx, ele); // TODO: Check bounds ??? + if (!(0 <= idx && idx < Count)) + { + throw new ArgumentOutOfRangeException(nameof(idx), $"{nameof(idx)} is out of bounds."); + } + + return (uint)idx; + } + + private U LoopingThrough(T val, Func f1, Func f2) + { + for (int i = 0, count = Count; i < count; ++i) + { + if (NativeToManaged(InternalDataGet(i)).Equals(val)) + { + return f1(i); + } + } + + return f2(); + } + + private void CheckOwnerships() + { + if ((Own == false) && (OwnContent == true)) + { + throw new InvalidOperationException(nameof(Own) + "/" + nameof(OwnContent)); + } + } + + private void RequireWritable() + { + if (IsReadOnly) + { + throw new NotSupportedException("This object's instance is read only."); + } + } + + private void DeleteData(IntPtr ele) + { + if (OwnContent) + { + NativeFree(ele); + } } /// @@ -156,6 +214,7 @@ public class Array : IEnumerable, IDisposable $"{nameof(Handle)} can't be null"); Own = own; OwnContent = own; + CheckOwnerships(); } /// @@ -173,6 +232,7 @@ public class Array : IEnumerable, IDisposable $"{nameof(Handle)} can't be null"); Own = own; OwnContent = ownContent; + CheckOwnerships(); } /// @@ -197,15 +257,17 @@ public class Array : IEnumerable, IDisposable return; } - if (Own && OwnContent) + for (int len = (int)eina_array_count_custom_export_mono(h), + i = 0; i < len; ++i) { - int len = (int)eina_array_count_custom_export_mono(h); - for (int i = 0; i < len; ++i) + if (!OwnContent) { - NativeFree(eina_array_data_get_custom_export_mono(h, (uint)i)); + break; } - } + DeleteData(eina_array_data_get_custom_export_mono(h, (uint)i)); + } + if (Own) { if (disposing) @@ -236,27 +298,16 @@ public class Array : IEnumerable, IDisposable Dispose(); } - /// - /// Releases the native array. - /// Since EFL 1.23. - /// - /// The native array. - public IntPtr Release() - { - IntPtr h = Handle; - Handle = IntPtr.Zero; - return h; - } - private void FreeElementsIfOwned() { - if (OwnContent) + if (IsReadOnly) { - int len = Length; - for (int i = 0; i < len; ++i) - { - NativeFree(InternalDataGet(i)); - } + throw new NotSupportedException("This object's instance is read only."); + } + + for (int i = 0, count = Count; i < count; ++i) + { + DeleteData(InternalDataGet(i)); } } @@ -279,26 +330,18 @@ public class Array : IEnumerable, IDisposable eina_array_flush(Handle); } - /// - /// Returns the number of elements in an array. - /// Since EFL 1.23. - /// - /// The number of elements. - public int Count() - { - return (int)eina_array_count_custom_export_mono(Handle); - } - - public void SetOwnership(bool ownAll) + internal void SetOwnership(bool ownAll) { Own = ownAll; OwnContent = ownAll; + CheckOwnerships(); } - public void SetOwnership(bool own, bool ownContent) + internal void SetOwnership(bool own, bool ownContent) { Own = own; OwnContent = ownContent; + CheckOwnerships(); } /// @@ -308,6 +351,8 @@ public class Array : IEnumerable, IDisposable /// The value of the element to be inserted. public bool Push(T val) { + RequireWritable(); + IntPtr ele = ManagedToNativeAlloc(val); var r = InternalPush(ele); if (!r) @@ -334,11 +379,13 @@ public class Array : IEnumerable, IDisposable /// The element at the end position. public T Pop() { + RequireWritable(); + IntPtr ele = InternalPop(); var r = NativeToManaged(ele); - if (OwnContent && ele != IntPtr.Zero) + if (ele != IntPtr.Zero) { - NativeFree(ele); + DeleteData(ele); } return r; @@ -351,10 +398,7 @@ public class Array : IEnumerable, IDisposable /// The position of the desired element. /// The element at the specified position public T DataGet(int idx) - { - IntPtr ele = InternalDataGet(idx); - return NativeToManaged(ele); - } + => NativeToManaged(InternalDataGet(idx)); /// /// Returns the element of the array at the specified position. @@ -363,9 +407,8 @@ public class Array : IEnumerable, IDisposable /// The position of the desired element. /// The element at the specified position public T At(int idx) - { - return DataGet(idx); - } + => DataGet(idx); + /// /// Replaces the element at the specified position. @@ -373,16 +416,17 @@ public class Array : IEnumerable, IDisposable /// /// The position of the desired element. /// The value of the element to be inserted. - public void DataSet(int idx, T val) + internal void DataSet(int idx, T val) { - IntPtr ele = InternalDataGet(idx); // TODO: check bondaries ?? - if (OwnContent && ele != IntPtr.Zero) + RequireWritable(); + + IntPtr ele = InternalDataGet(idx); + if (ele != IntPtr.Zero) { - NativeFree(ele); + DeleteData(ele); } - ele = ManagedToNativeAlloc(val); - InternalDataSet(idx, ele); + InternalDataSet(idx, ManagedToNativeAlloc(val)); } /// @@ -408,7 +452,7 @@ public class Array : IEnumerable, IDisposable /// A array public T[] ToArray() { - int len = Length; + int len = Count; var managed = new T[len]; for (int i = 0; i < len; ++i) { @@ -440,17 +484,14 @@ public class Array : IEnumerable, IDisposable /// Since EFL 1.23. /// public Eina.Iterator GetIterator() - { - return new Eina.Iterator(eina_array_iterator_new(Handle), true); - } + => new Eina.Iterator(eina_array_iterator_new(Handle), true); /// Gets an Enumerator for this Array. /// Since EFL 1.23. /// public IEnumerator GetEnumerator() { - int len = Length; - for (int i = 0; i < len; ++i) + for (int i = 0, count = Count; i < count; ++i) { yield return DataGet(i); } @@ -460,16 +501,113 @@ public class Array : IEnumerable, IDisposable /// Since EFL 1.23. /// System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return this.GetEnumerator(); - } + => this.GetEnumerator(); /// Gets an Accessor for this Array. /// Since EFL 1.23. /// public Eina.Accessor GetAccessor() + => new Eina.Accessor(eina_array_accessor_new(Handle), Ownership.Managed); + + /// + /// Removes the first occurrence of a specific object. + /// Since EFL 1.24. + /// + /// The object to remove. + public bool Remove(T val) + => LoopingThrough(val, + (i) => + { + RemoveAt(i); + return true; + }, () => false); + + /// + /// Adds an item. + /// Since EFL 1.24. + /// + /// The object to add. + public void Add(T val) => Push(val); + + /// + /// Removes all items. + /// Since EFL 1.24. + /// + public void Clear() => Clean(); + + /// + /// Determines whether the contains a specific value. + /// Since EFL 1.24. + /// + /// The object to locate. + public bool Contains(T val) + => LoopingThrough(val, (i) => true, () => false); + + /// + /// Copies the elements of the to an + /// , starting at a particular index. + /// Since EFL 1.24. + /// + /// The one-dimensional that is the + /// destination of the elements copied from . + /// The must have zero-based indexing. + /// The zero-based index in array at which copying + /// begins. + public void CopyTo(T[] array, int arrayIndex) + => ToArray().CopyTo(array, arrayIndex); + + /// + /// Determines the index of a specific item. + /// Since EFL 1.24. + /// + /// The object to locate. + public int IndexOf(T val) + => LoopingThrough(val, (i) => i, () => -1); + + /// + /// Inserts an item to the at the specified index. + /// Since EFL 1.24. + /// + /// The zero-based index at which item should be inserted. + /// The object to insert. + public void Insert(int index, T val) { - return new Eina.Accessor(eina_array_accessor_new(Handle), Ownership.Managed); + RequireWritable(); + + if (index < 0) + { + throw new ArgumentOutOfRangeException(nameof(index), $"{nameof(index)} cannot be negative."); + } + + if (Count < index) + { + throw new ArgumentOutOfRangeException(nameof(index), $"{nameof(index)} is greater than {nameof(Count)} + 1."); + } + + if (index == Count) + { + Push(val); + return; + } + + eina_array_insert_at_custom_export_mono(Handle, (uint)index, + ManagedToNativeAlloc(val)); + } + + /// + /// Removes the item at the specified index. + /// Since EFL 1.24. + /// + /// The zero-based index of the item to remove. + public void RemoveAt(int index) + { + RequireWritable(); + + var ele = InternalDataGet(index); + DeleteData(ele); + eina_array_remove(Handle, (data,gdata) + => ele != data, + IntPtr.Zero); } } diff --git a/src/lib/efl_mono/efl_custom_exports_mono.c b/src/lib/efl_mono/efl_custom_exports_mono.c index ede573f875..93cfc541ea 100644 --- a/src/lib/efl_mono/efl_custom_exports_mono.c +++ b/src/lib/efl_mono/efl_custom_exports_mono.c @@ -294,6 +294,17 @@ EAPI Eina_Bool eina_array_foreach_custom_export_mono(Eina_Array *array, Eina_Eac return eina_array_foreach(array, cb, fdata); } +EAPI void eina_array_insert_at_custom_export_mono(Eina_Array* array, unsigned int index, void* const data) +{ + eina_array_push(array, data); + for (unsigned int i = eina_array_count(array) - 1; i > index; --i) + { + void* tmp = eina_array_data_get(array, i); + eina_array_data_set(array, i, eina_array_data_get(array, i - 1)); + eina_array_data_set(array, i - 1, tmp); + } +} + // List // EAPI Eina_List *eina_list_last_custom_export_mono(const Eina_List *list) diff --git a/src/tests/efl_mono/Array.cs b/src/tests/efl_mono/Array.cs new file mode 100644 index 0000000000..83f9e35f18 --- /dev/null +++ b/src/tests/efl_mono/Array.cs @@ -0,0 +1,189 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace TestSuite +{ + +class TestArray +{ + public static void TestAdd() + { + IList array = new Eina.Array(); + Test.AssertEquals(array.Count, 0); + array.Add(1); + Test.AssertEquals(array.Count, 1); + array.Add(2); + Test.AssertEquals(array.Count, 2); + } + + public static void TestRemoveAt() + { + IList array = new Eina.Array(); + Test.AssertEquals(array.Count, 0); + array.Add(1); + Test.AssertEquals(array.Count, 1); + Test.AssertEquals(array[0], 1); + array.RemoveAt(0); + Test.AssertEquals(array.Count, 0); + array.Add(1); + array.Add(0); + array.Add(1); + Test.AssertEquals(array.Count, 3); + Test.AssertEquals(array[2], 1); + array.RemoveAt(2); + Test.AssertEquals(array.Count, 2); + Test.AssertEquals(array[0], 1); + } + + public static void TestRemove() + { + IList array = new Eina.Array(); + Test.Assert(!array.Remove(0)); + Test.AssertEquals(array.Count, 0); + array.Add(1); + Test.AssertEquals(array.Count, 1); + Test.Assert(array.Remove(1)); + Test.AssertEquals(array.Count, 0); + array.Add(1); + array.Add(1); + Test.AssertEquals(array.Count, 2); + Test.Assert(array.Remove(1)); + Test.AssertEquals(array.Count, 1); + array.Add(0); + array.Add(1); + Test.AssertEquals(array[1], 0); + Test.AssertEquals(array.Count, 3); + Test.Assert(!array.Remove(2)); + Test.Assert(array.Remove(1)); + Test.AssertEquals(array[1], 1); + Test.AssertEquals(array.Count, 2); + } + + public static void TestContains() + { + IList array = new Eina.Array(); + Test.AssertEquals(array.Count, 0); + Test.Assert(!array.Contains(0)); + array.Add(0); + Test.Assert(array.Contains(0)); + Test.Assert(array.Remove(0)); + Test.Assert(!array.Contains(0)); + array.Add(1); + array.Add(0); + Test.Assert(array.Contains(0)); + } + + public static void TestClear() + { + IList array = new Eina.Array(); + Test.AssertEquals(array.Count, 0); + array.Clear(); + Test.AssertEquals(array.Count, 0); + array.Add(0); + Test.AssertEquals(array.Count, 1); + array.Clear(); + Test.AssertEquals(array.Count, 0); + array.Add(0); + array.Add(0); + Test.AssertEquals(array.Count, 2); + array.Clear(); + Test.AssertEquals(array.Count, 0); + array.Add(0); + array.Add(0); + Test.AssertEquals(array.Count, 2); + Test.Assert(array.Remove(0)); + Test.AssertEquals(array.Count, 1); + array.Clear(); + Test.AssertEquals(array.Count, 0); + } + + public static void TestInsert() + { + IList array = new Eina.Array(); + array.Add(99); + Test.AssertEquals(array.Count, 1); + array.Insert(0, 6); + Test.AssertEquals(array.Count, 2); + Test.AssertEquals(array[0], 6); + array.Insert(1, 5); + Test.AssertEquals(array.Count, 3); + Test.AssertEquals(array[1], 5); + array.Insert(1, 10); + Test.AssertEquals(array.Count, 4); + Test.AssertEquals(array[1], 10); + array.RemoveAt(1); + Test.AssertEquals(array.Count, 3); + Test.AssertEquals(array[1], 5); + array.Insert(1, 42); + Test.AssertEquals(array.Count, 4); + Test.AssertEquals(array[1], 42); + } + + public static void TestIndexOf() + { + IList array = new Eina.Array(); + Test.AssertEquals(array.Count, 0); + array.Add(1); + Test.AssertEquals(array.Count, 1); + Test.AssertEquals(0, array.IndexOf(1)); + array.Insert(0, 0); + Test.AssertEquals(array.Count, 2); + Test.AssertEquals(0, array.IndexOf(0)); + Test.AssertEquals(1, array.IndexOf(1)); + array.Insert(0, 1); + Test.AssertEquals(array.Count, 3); + Test.AssertEquals(0, array.IndexOf(1)); + Test.AssertEquals(1, array.IndexOf(0)); + array.Insert(0, 1); + Test.AssertEquals(array.Count, 4); + Test.AssertEquals(0, array.IndexOf(1)); + Test.AssertEquals(2, array.IndexOf(0)); + } + + public static void TestCopyTo() + { + IList array = new Eina.Array(); + Test.AssertEquals(array.Count, 0); + int[] random = {4, 40, 10, 42, 99}; + array.Add(43); + array.Insert(0, 1); + array.Insert(1, 50); + Test.AssertEquals(array.Count, 3); + Array.ForEach(random, (n) => array.Add(n)); + Test.AssertEquals(array.Count, 8); + int[] expected = {1, 50, 43, 4, 40, 10, 42, 99}; + var result = new int[expected.Length]; + array.CopyTo(result, 0); + for (int i = 0; i < expected.Length; ++i) + { + Test.AssertEquals(expected[i], result[i]); + } + } + + public static void TestIdxOutBounds() + { + var array = new Eina.Array(); + array.Add(4); + Test.AssertRaises(()=>array.At(1)); + Test.AssertRaises(()=>array.At(-1)); + Test.AssertNotRaises + (()=>array.At(array.IndexOf(4))); + } + + public static void TestIsReadOnly() + { + var array = new Eina.Array(); + int[] tmp = {1, 3, 2, 6 ,5}; + array.Append(tmp); + Test.AssertEquals(array.Count, 5); + array.SetOwnership(false); + Test.AssertRaises(() => array.Add(4)); + Test.AssertRaises(() => array.Push(6)); + Test.AssertRaises(() => array.Append(tmp)); + Test.AssertEquals(array.Count, 5); + Test.AssertRaises(() => array.DataSet(2, 4)); + Test.Assert(array.ToArray().SequenceEqual(tmp)); + } +} +} diff --git a/src/tests/efl_mono/Eina.cs b/src/tests/efl_mono/Eina.cs index 638a65ce58..91e93986ff 100644 --- a/src/tests/efl_mono/Eina.cs +++ b/src/tests/efl_mono/Eina.cs @@ -787,16 +787,16 @@ class TestEinaArray { var a = new Eina.Array(); Test.Assert(a.Handle != IntPtr.Zero); - Test.Assert(a.Length == 0); + Test.Assert(a.Count == 0); Test.Assert(a.Push(88)); Test.Assert(a[0] == 88); - Test.Assert(a.Length == 1); + Test.Assert(a.Count == 1); Test.Assert(a.Push(44)); Test.Assert(a[1] == 44); - Test.Assert(a.Length == 2); + Test.Assert(a.Count == 2); Test.Assert(a.Push(22)); Test.Assert(a[2] == 22); - Test.Assert(a.Length == 3); + Test.Assert(a.Count == 3); a.Dispose(); } @@ -804,16 +804,16 @@ class TestEinaArray { var a = new Eina.Array(); Test.Assert(a.Handle != IntPtr.Zero); - Test.Assert(a.Length == 0); + Test.Assert(a.Count == 0); Test.Assert(a.Push("a")); Test.Assert(a[0] == "a"); - Test.Assert(a.Length == 1); + Test.Assert(a.Count == 1); Test.Assert(a.Push("b")); Test.Assert(a[1] == "b"); - Test.Assert(a.Length == 2); + Test.Assert(a.Count == 2); Test.Assert(a.Push("c")); Test.Assert(a[2] == "c"); - Test.Assert(a.Length == 3); + Test.Assert(a.Count == 3); a.Dispose(); } @@ -821,16 +821,16 @@ class TestEinaArray { var a = new Eina.Array(); Test.Assert(a.Handle != IntPtr.Zero); - Test.Assert(a.Length == 0); + Test.Assert(a.Count == 0); Test.Assert(a.Push("a")); Test.Assert(a[0] == "a"); - Test.Assert(a.Length == 1); + Test.Assert(a.Count == 1); Test.Assert(a.Push("b")); Test.Assert(a[1] == "b"); - Test.Assert(a.Length == 2); + Test.Assert(a.Count == 2); Test.Assert(a.Push("c")); Test.Assert(a[2] == "c"); - Test.Assert(a.Length == 3); + Test.Assert(a.Count == 3); a.Dispose(); } @@ -951,7 +951,7 @@ class TestEinaArray Test.Assert(t.EinaArrayIntOut(out arr)); Test.Assert(!arr.Own); Test.Assert(arr.ToArray().SequenceEqual(base_seq_int)); - Test.Assert(arr.Append(append_seq_int)); + Test.AssertRaises(() => arr.Append(append_seq_int)); arr.Dispose(); Test.Assert(arr.Handle == IntPtr.Zero); Test.Assert(t.CheckEinaArrayIntOut()); @@ -976,8 +976,9 @@ class TestEinaArray var t = new Dummy.TestObject(); var arr = t.EinaArrayIntReturn(); Test.Assert(!arr.Own); + Test.Assert(!arr.OwnContent); Test.Assert(arr.ToArray().SequenceEqual(base_seq_int)); - Test.Assert(arr.Append(append_seq_int)); + Test.AssertRaises(() => arr.Append(append_seq_int)); arr.Dispose(); Test.Assert(arr.Handle == IntPtr.Zero); Test.Assert(t.CheckEinaArrayIntReturn()); @@ -1031,7 +1032,7 @@ class TestEinaArray Test.Assert(t.EinaArrayStrOut(out arr)); Test.Assert(!arr.Own); Test.Assert(arr.ToArray().SequenceEqual(base_seq_str)); - Test.Assert(arr.Append(append_seq_str)); + Test.AssertRaises(() => arr.Append(append_seq_str)); arr.Dispose(); Test.Assert(arr.Handle == IntPtr.Zero); Test.Assert(t.CheckEinaArrayStrOut()); @@ -1057,7 +1058,7 @@ class TestEinaArray var arr = t.EinaArrayStrReturn(); Test.Assert(!arr.Own); Test.Assert(arr.ToArray().SequenceEqual(base_seq_str)); - Test.Assert(arr.Append(append_seq_str)); + Test.AssertRaises(() => arr.Append(append_seq_str)); arr.Dispose(); Test.Assert(arr.Handle == IntPtr.Zero); Test.Assert(t.CheckEinaArrayStrReturn()); @@ -1111,7 +1112,7 @@ class TestEinaArray Test.Assert(t.EinaArrayStrshareOut(out arr)); Test.Assert(!arr.Own); Test.Assert(arr.ToArray().SequenceEqual(base_seq_strshare)); - Test.Assert(arr.Append(append_seq_strshare)); + Test.AssertRaises(() => arr.Append(append_seq_strshare)); arr.Dispose(); Test.Assert(arr.Handle == IntPtr.Zero); Test.Assert(t.CheckEinaArrayStrshareOut()); @@ -1137,7 +1138,7 @@ class TestEinaArray var arr = t.EinaArrayStrshareReturn(); Test.Assert(!arr.Own); Test.Assert(arr.ToArray().SequenceEqual(base_seq_strshare)); - Test.Assert(arr.Append(append_seq_strshare)); + Test.AssertRaises(() => arr.Append(append_seq_strshare)); arr.Dispose(); Test.Assert(arr.Handle == IntPtr.Zero); Test.Assert(t.CheckEinaArrayStrshareReturn()); @@ -1192,7 +1193,7 @@ class TestEinaArray Test.Assert(t.EinaArrayObjOut(out arr)); Test.Assert(!arr.Own); NumberwrapperSequenceAssertEqual(arr.ToArray(), BaseSeqObj()); - Test.Assert(arr.Append(AppendSeqObj())); + Test.AssertRaises(() => arr.Append(AppendSeqObj())); arr.Dispose(); Test.Assert(arr.Handle == IntPtr.Zero); Test.Assert(t.CheckEinaArrayObjOut()); @@ -1218,7 +1219,7 @@ class TestEinaArray var arr = t.EinaArrayObjReturn(); Test.Assert(!arr.Own); NumberwrapperSequenceAssertEqual(arr.ToArray(), BaseSeqObj()); - Test.Assert(arr.Append(AppendSeqObj())); + Test.AssertRaises(() => arr.Append(AppendSeqObj())); arr.Dispose(); Test.Assert(arr.Handle == IntPtr.Zero); Test.Assert(t.CheckEinaArrayObjReturn()); @@ -1246,7 +1247,7 @@ class TestEinaArray var b = t.EinaArrayObjReturnIn(a); NumberwrapperSequenceAssertEqual(a.ToArray(), b.ToArray()); NumberwrapperSequenceAssertEqual(a.ToArray(), BaseSeqObj()); - int len = a.Length; + int len = a.Count; for (int i=0; i < len; ++i) { Test.Assert(a[i].NativeHandle == b[i].NativeHandle); diff --git a/src/tests/efl_mono/Events.cs b/src/tests/efl_mono/Events.cs index 88a7e8b1e1..824d9a132c 100644 --- a/src/tests/efl_mono/Events.cs +++ b/src/tests/efl_mono/Events.cs @@ -239,7 +239,7 @@ class TestEoEvents obj.EmitEventWithArray(sent); - Test.AssertEquals(sent.Length, received.Length); + Test.AssertEquals(sent.Count, received.Count); var pairs = sent.Zip(received, (string sentItem, string receivedItem) => new { Sent = sentItem, Received = receivedItem } ); foreach (var pair in pairs) { diff --git a/src/tests/efl_mono/dummy_test_object.c b/src/tests/efl_mono/dummy_test_object.c index d9ab519d0a..b87aff1cd4 100644 --- a/src/tests/efl_mono/dummy_test_object.c +++ b/src/tests/efl_mono/dummy_test_object.c @@ -579,7 +579,7 @@ Eina_Bool _dummy_test_object_check_eina_array_int_out(EINA_UNUSED Eo *obj, EINA_ { if (!_array_int_out_to_check) return EINA_FALSE; - Eina_Bool r = _array_int_equal(_array_int_out_to_check, modified_seq_int, modified_seq_int_size); + Eina_Bool r = _array_int_equal(_array_int_out_to_check, base_seq_int, base_seq_int_size); unsigned int i; int *ele; @@ -617,7 +617,7 @@ Eina_Bool _dummy_test_object_check_eina_array_int_return(EINA_UNUSED Eo *obj, EI { if (!_array_int_return_to_check) return EINA_FALSE; - Eina_Bool r = _array_int_equal(_array_int_return_to_check, modified_seq_int, modified_seq_int_size); + Eina_Bool r = _array_int_equal(_array_int_return_to_check, base_seq_int, base_seq_int_size); unsigned int i; int *ele; @@ -707,7 +707,7 @@ Eina_Bool _dummy_test_object_check_eina_array_str_out(EINA_UNUSED Eo *obj, EINA_ { if (!_array_str_out_to_check) return EINA_FALSE; - Eina_Bool r = _array_str_equal(_array_str_out_to_check, modified_seq_str, modified_seq_str_size); + Eina_Bool r = _array_str_equal(_array_str_out_to_check, base_seq_str, base_seq_str_size); unsigned int i; char *ele; @@ -745,7 +745,7 @@ Eina_Bool _dummy_test_object_check_eina_array_str_return(EINA_UNUSED Eo *obj, EI { if (!_array_str_return_to_check) return EINA_FALSE; - Eina_Bool r = _array_str_equal(_array_str_return_to_check, modified_seq_str, modified_seq_str_size); + Eina_Bool r = _array_str_equal(_array_str_return_to_check, base_seq_str,base_seq_str_size); unsigned int i; char *ele; @@ -840,7 +840,7 @@ Eina_Bool _dummy_test_object_check_eina_array_strshare_out(EINA_UNUSED Eo *obj, { if (!_array_strshare_out_to_check) return EINA_FALSE; - Eina_Bool r = _array_strshare_equal(_array_strshare_out_to_check, modified_seq_str, modified_seq_str_size); + Eina_Bool r = _array_strshare_equal(_array_strshare_out_to_check, base_seq_str, base_seq_str_size); unsigned int i; Eina_Stringshare *ele; @@ -878,7 +878,7 @@ Eina_Bool _dummy_test_object_check_eina_array_strshare_return(EINA_UNUSED Eo *ob { if (!_array_strshare_return_to_check) return EINA_FALSE; - Eina_Bool r = _array_strshare_equal(_array_strshare_return_to_check, modified_seq_str, modified_seq_str_size); + Eina_Bool r = _array_strshare_equal(_array_strshare_return_to_check, base_seq_str, base_seq_str_size); unsigned int i; Eina_Stringshare *ele; @@ -974,7 +974,7 @@ Eina_Bool _dummy_test_object_check_eina_array_obj_out(EINA_UNUSED Eo *obj, EINA_ { if (!_array_obj_out_to_check) return EINA_FALSE; - Eina_Bool r = _array_obj_equal(_array_obj_out_to_check, modified_seq_obj, modified_seq_obj_size); + Eina_Bool r = _array_obj_equal(_array_obj_out_to_check, base_seq_obj, base_seq_obj_size); if (!r) return r; unsigned int i; @@ -1013,7 +1013,7 @@ Eina_Bool _dummy_test_object_check_eina_array_obj_return(EINA_UNUSED Eo *obj, EI { if (!_array_obj_return_to_check) return EINA_FALSE; - Eina_Bool r = _array_obj_equal(_array_obj_return_to_check, modified_seq_obj, modified_seq_obj_size); + Eina_Bool r = _array_obj_equal(_array_obj_return_to_check, base_seq_obj, base_seq_obj_size); if (!r) return r; unsigned int i; diff --git a/src/tests/efl_mono/meson.build b/src/tests/efl_mono/meson.build index 54ddb64274..2bba162a5c 100644 --- a/src/tests/efl_mono/meson.build +++ b/src/tests/efl_mono/meson.build @@ -83,6 +83,7 @@ efl_mono_src = [ 'Inheritance.cs', 'Hash.cs', 'List.cs', + 'Array.cs', ] if get_option('dotnet') From f349510941a81649cbd040774c3d4939429e3293 Mon Sep 17 00:00:00 2001 From: Felipe Magno de Almeida Date: Mon, 23 Dec 2019 10:21:30 +0900 Subject: [PATCH 13/27] eolian: inherit since information from struct to field Summary: If struct field doesn't explicitly sets since information, then since is inherited from struct documentation if it is available. Reviewers: jptiz, Jaehyun_Cho, woohyun, q66 Reviewed By: q66 Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8359 Differential Revision: https://phab.enlightenment.org/D10948 --- src/lib/eolian/eo_parser.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index 96de7a77ec..65165dbfad 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c @@ -536,6 +536,8 @@ parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern, qual_end: check_next(ls, ';'); FILL_DOC(ls, fdef, doc); + if (def->doc && fdef->doc && def->doc->since && !fdef->doc->since) + fdef->doc->since = eina_stringshare_ref (def->doc->since); } check_match(ls, '}', '{', bline, bcolumn); FILL_BASE(def->base, ls, line, column, TYPEDECL); From 46ee203331d596ac3aa1ec48b729be42c084088a Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Mon, 23 Dec 2019 15:42:17 +0900 Subject: [PATCH 14/27] ui image: fix scale_method expand behavior. As efl_gfx_image_expand specification, it scales the image to cover the entire object area on one axis while maintaining the aspect ratio though image may become larger than the object. Thus, this option must work as one of fit_width / fit_height by detertimining either way. Previously, it was logically wrong. @fix --- src/lib/elementary/efl_ui_image.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index b110e9d998..213d55edd2 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -215,27 +215,22 @@ _image_sizing_eval(Eo *obj, Efl_Ui_Image_Data *sd, Evas_Object *img) case EFL_GFX_IMAGE_SCALE_METHOD_FIT: w = ow; h = ((double)ih * w) / (double)iw; - if (h > oh) { h = oh; w = ((double)iw * h) / (double)ih; } - - break; case EFL_GFX_IMAGE_SCALE_METHOD_FIT_WIDTH: w = ow; h = ((double)ih * w) / (double)iw; - break; case EFL_GFX_IMAGE_SCALE_METHOD_FIT_HEIGHT: h = oh; w = ((double)iw * h) / (double)ih; - break; case EFL_GFX_IMAGE_SCALE_METHOD_EXPAND: - if (ow > oh) + if (iw < ih) { w = ow; h = ((double)ih * w) / (double)iw; From b9b9287454bf8f17fa53611625529d4498b06faf Mon Sep 17 00:00:00 2001 From: SangHyeon Jade Lee Date: Mon, 23 Dec 2019 16:21:10 +0900 Subject: [PATCH 15/27] eolian_mono : add verb unselect on naming helper. Summary: currently select is verb and mono name is exposed SelectAll but unselect is non-verb and mono name is exposed AllUnselect. to fix this differencies, add unselect in the verb list. Reviewers: segfaultxavi, Jaehyun_Cho Reviewed By: Jaehyun_Cho Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10952 --- src/bin/eolian_mono/eolian/mono/name_helpers.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bin/eolian_mono/eolian/mono/name_helpers.hh b/src/bin/eolian_mono/eolian/mono/name_helpers.hh index 867b832444..7f71d9279b 100644 --- a/src/bin/eolian_mono/eolian/mono/name_helpers.hh +++ b/src/bin/eolian_mono/eolian/mono/name_helpers.hh @@ -174,7 +174,8 @@ static const std::vector verbs = "sync", "toggle", "unbind", - "unregister" + "unregister", + "unselect" }; const std::vector not_verbs = From 74c60b7887bfb2b624becac879db68dc8323249e Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Mon, 23 Dec 2019 17:39:21 +0900 Subject: [PATCH 16/27] Elm_Transit: Fix wrong intervention progress value Summary: If progress_value_set is called more than once, an error value occurs. The intervention progress must use progress that does not apply the previous intervention progress. Test Plan: meson_option.txt -> remove json in evas-loaders-disabler option elementary_test -to "animation view" Click Play -> Play back -> Play Reviewers: Hermet Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10907 --- src/lib/elementary/elm_transit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/elementary/elm_transit.c b/src/lib/elementary/elm_transit.c index 31c7961f50..39dc755604 100644 --- a/src/lib/elementary/elm_transit.c +++ b/src/lib/elementary/elm_transit.c @@ -61,6 +61,7 @@ struct _Elm_Transit } repeat; double progress; double inter_progress; + double base_progress; double revert_begin_progress; double revert_duration; double total_revert_time; @@ -359,6 +360,7 @@ _transit_animate_cb(void *data) } /* Intervention Progress */ + transit->base_progress = transit->progress; transit->progress += transit->inter_progress; switch (transit->tween_mode) @@ -956,7 +958,7 @@ elm_transit_progress_value_set(Elm_Transit *transit, double progress) if (progress < 0) progress = 0; else if (progress > 1) progress = 1; - transit->inter_progress = (progress - transit->progress); + transit->inter_progress = (progress - transit->base_progress); } EAPI double From 5827fdb3cb1a3a596cf3373f16177a2a55dc4211 Mon Sep 17 00:00:00 2001 From: WooHyun Jung Date: Mon, 23 Dec 2019 17:50:17 +0900 Subject: [PATCH 17/27] Revert "eolian: inherit since information from struct to field" This reverts commit f349510941a81649cbd040774c3d4939429e3293. This patch is causing some "ninja test" errors, so the errors should be fixed first. --- src/lib/eolian/eo_parser.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index 65165dbfad..96de7a77ec 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c @@ -536,8 +536,6 @@ parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern, qual_end: check_next(ls, ';'); FILL_DOC(ls, fdef, doc); - if (def->doc && fdef->doc && def->doc->since && !fdef->doc->since) - fdef->doc->since = eina_stringshare_ref (def->doc->since); } check_match(ls, '}', '{', bline, bcolumn); FILL_BASE(def->base, ls, line, column, TYPEDECL); From b90c50ad170a437ced84743b66de1f139dc715b8 Mon Sep 17 00:00:00 2001 From: Bruno da Silva Belo Date: Wed, 18 Dec 2019 20:42:08 +0000 Subject: [PATCH 18/27] c#: Fixing ca2208 for Eina.List. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some ca's warning reactivated. ref T8428 Reviewed-by: João Paulo Taylor Ienczak Zanette Differential Revision: https://phab.enlightenment.org/D10911 --- src/bindings/mono/eina_mono/eina_list.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bindings/mono/eina_mono/eina_list.cs b/src/bindings/mono/eina_mono/eina_list.cs index 60b33e5df0..cdd49c7245 100644 --- a/src/bindings/mono/eina_mono/eina_list.cs +++ b/src/bindings/mono/eina_mono/eina_list.cs @@ -188,13 +188,13 @@ public class List : IList, IEnumerable, IDisposable { if (!(0 <= idx && idx < Count)) { - throw new ArgumentOutOfRangeException(); + throw new ArgumentOutOfRangeException(nameof(idx), $"{nameof(idx)} cannot be negative, neither smaller than {nameof(Count)}"); } var ele = f(Handle, (uint)idx); if (ele == IntPtr.Zero) { - throw new ArgumentOutOfRangeException(); + throw new ArgumentOutOfRangeException(nameof(idx), $"There is no position {nameof(idx)}"); } return ele; From ed0572a33a28429f1ad6e47cb5bee9ef816e4a45 Mon Sep 17 00:00:00 2001 From: ali Date: Fri, 20 Dec 2019 06:13:36 +0000 Subject: [PATCH 19/27] edje_entry: avoid strstr undefined behaviour strstr behaviour is undefined when passing null to it, we will check if null is passed, then skip. elm_entry had issue, where crash happened when click on link for example. elementry_test -> entry -> click on link (crash will happened) T8535 Reviewed-by: Marcel Hollerbach Reviewed-by: Mike Blumenkrantz Differential Revision: https://phab.enlightenment.org/D10877 --- src/lib/edje/edje_entry.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c index 92bc0df031..3d4e47207d 100644 --- a/src/lib/edje/edje_entry.c +++ b/src/lib/edje/edje_entry.c @@ -799,20 +799,16 @@ _sel_update(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entr static Eina_Bool _edje_entry_style_tag_check(Edje_Real_Part *rp, const char *tag) { + if (!tag) return EINA_FALSE; const Evas_Textblock_Style *ts = NULL; ts = evas_object_textblock_style_user_peek(rp->object); + if (!ts) ts = evas_object_textblock_style_get(rp->object); if (ts) { - if (strstr(evas_textblock_style_get(ts), tag)) return EINA_TRUE; - } - else - { - ts = evas_object_textblock_style_get(rp->object); - if (ts) - { - if (strstr(evas_textblock_style_get(ts), tag)) return EINA_TRUE; - } + const char *style_str = evas_textblock_style_get(ts); + if (!style_str) return EINA_FALSE; + if (strstr(style_str, tag)) return EINA_TRUE; } return EINA_FALSE; From 0954e501fd4008c40b3848de1f2c91bcd53b2f71 Mon Sep 17 00:00:00 2001 From: Lauro Moura Date: Fri, 20 Dec 2019 01:35:23 +0000 Subject: [PATCH 20/27] csharp: Property Indexer implementation Use Indexers to use brackets, eg [i], syntax. Keys now can be used as following: var someVal = obj.SomeProperty[key]; obj.SomeProperty[key] = someNewVal; And for multiple keys: var someVal = obj.SomeProperty[(key1, key2)]; obj.SomeProperty[(key1, key2)] = someNewVal; T8384 Reviewed-by: WooHyun Jung Differential Revision: https://phab.enlightenment.org/D10791 --- src/bin/eolian_mono/eolian/mono/blacklist.hh | 29 +- .../eolian_mono/eolian/mono/documentation.hh | 52 +- .../eolian/mono/function_definition.hh | 578 +++++++++++++----- .../eolian/mono/generation_contexts.hh | 7 + src/bin/eolian_mono/eolian/mono/helpers.hh | 101 +++ src/bin/eolian_mono/eolian/mono/klass.hh | 14 +- .../eolian_mono/eolian/mono/name_helpers.hh | 61 +- src/bin/eolian_mono/eolian/mono/parameter.hh | 12 +- src/bin/eolian_mono/eolian_mono.cc | 3 +- src/bindings/mono/efl_mono/GenericModel.cs | 14 +- src/lib/eolian_cxx/grammar/klass_def.hpp | 2 +- src/tests/efl_mono/Eo.cs | 62 +- src/tests/efl_mono/dummy_event_manager.c | 6 + src/tests/efl_mono/dummy_event_manager.eo | 2 - src/tests/efl_mono/dummy_test_object.c | 31 + src/tests/efl_mono/dummy_test_object.eo | 25 + 16 files changed, 772 insertions(+), 227 deletions(-) diff --git a/src/bin/eolian_mono/eolian/mono/blacklist.hh b/src/bin/eolian_mono/eolian/mono/blacklist.hh index 8d8de9d1bf..70bc34a038 100644 --- a/src/bin/eolian_mono/eolian/mono/blacklist.hh +++ b/src/bin/eolian_mono/eolian/mono/blacklist.hh @@ -150,9 +150,34 @@ inline bool is_alias_blacklisted(attributes::alias_def const& alias, Context con return name_helpers::alias_full_eolian_name(alias) == "Eina.Error"; } -inline bool is_property_blacklisted(std::string const&) +inline bool is_property_blacklisted(std::string const& name) { - return false; + auto properties = std::vector{ + // These properties encode (void* arr, int len) arrays + "Efl.Gfx.IGradient.Stop" + , "Efl.Gfx.GradientConcrete.Stop" + , "Efl.Gfx.IShape.StrokeDash" + , "Efl.Gfx.ShapeConcrete.StrokeDash" + , "Efl.Gfx.Vg.ValueProvider.Transform" + , "Efl.Canvas.Vg.Node.Transformation" + // Will be bound manually + , "Efl.Core.Env.Env" + // Setter returns a future + , "Efl.IModel.Property" + // Protected + , "Efl.Access.IAction.ActionName" + , "Efl.Access.IAction.ActionLocalizedName" + , "Efl.Access.IComponent.Extents" + , "Efl.Access.IText.AccessSelection" + , "Efl.Access.IText.AccessText" + , "Efl.Access.IText.BoundedRanges" + , "Efl.Access.IText.Character" + , "Efl.Access.IText.OffsetAtPoint" + , "Efl.Access.IText.String" + , "Efl.Access.IText.TextAttributes" + }; + + return std::find(std::begin(properties), std::end(properties), name) != std::end(properties); } template diff --git a/src/bin/eolian_mono/eolian/mono/documentation.hh b/src/bin/eolian_mono/eolian/mono/documentation.hh index d009e4571d..db00ba8a0f 100644 --- a/src/bin/eolian_mono/eolian/mono/documentation.hh +++ b/src/bin/eolian_mono/eolian/mono/documentation.hh @@ -21,6 +21,7 @@ #include "grammar/html_escaped_string.hpp" #include "using_decl.hh" #include "name_helpers.hh" +#include "helpers.hh" #include "generation_contexts.hh" #include "blacklist.hh" @@ -76,7 +77,11 @@ struct documentation_generator // The name_tail parameter is the last 4 chars of the original string, which // could be ".set" or ".get" and in this case they are ignored by Eolian. // We want them to know what the documentation intended to reference. - static std::string function_conversion(const ::Eolian_Object *klass, const ::Eolian_Function *function, std::string name_tail) + template + static std::string function_conversion(const ::Eolian_Object *klass + , const ::Eolian_Function *function + , std::string name_tail + , Context const& context) { ::Eolian_Function_Type ftype = ::eolian_function_type_get(function); const char* eo_name = ::eolian_function_name_get(function); @@ -122,13 +127,27 @@ struct documentation_generator break; case ::EOLIAN_PROPERTY: { - int getter_nkeys = property_num_keys(function, ::EOLIAN_PROP_GET); - int setter_nkeys = property_num_keys(function, ::EOLIAN_PROP_SET); std::string short_name = name_helpers::property_managed_name(klass_d, eo_name); - bool blacklisted = blacklist::is_property_blacklisted(name + "." + short_name); - // EO properties with keys or blacklisted are not converted into C# properties. - // In these cases we refer to the getter method instead of the property. - if ((getter_nkeys > 0) || (setter_nkeys > 0) || (blacklisted)) name += ".Get" + short_name; + + // We need to replace the current class context with the context + // from the class that originated this property. + class_context::wrapper_kind klass_kind; + if (helpers::is_managed_interface(klass_d)) + klass_kind = class_context::interface; + else + klass_kind = class_context::inherit; + + auto my_context = grammar::context_replace_tag(class_context{klass_kind}, context); + + auto unit = eolian_object_unit_get((const Eolian_Object*)function); + attributes::function_def getter_func{function, ::EOLIAN_PROP_GET, nullptr, unit}; + attributes::function_def setter_func{function, ::EOLIAN_PROP_SET, nullptr, unit}; + attributes::property_def prop{function, getter_func, setter_func, unit}; + + auto has_wrapper = helpers::has_property_wrapper(prop, &klass_d, my_context); + + if (has_wrapper == helpers::has_property_wrapper_bit::has_none) + name += ".Get" + short_name; else if (name_tail == ".get") name += ".Get" + short_name; else if (name_tail == ".set") name += ".Set" + short_name; else name += "." + short_name; @@ -165,9 +184,13 @@ struct documentation_generator } // Turns an Eolian reference like @Efl.Input.Pointer.tool into a tag - static std::string ref_conversion(const ::Eolian_Doc_Token *token, const Eolian_State *state, std::string name_tail, - bool want_beta) + template + static std::string ref_conversion(const ::Eolian_Doc_Token *token + , const Eolian_State *state + , std::string name_tail + , Context const& context) { + bool want_beta = context_want_beta(context); const Eolian_Object *data, *data2; ::Eolian_Object_Type type = ::eolian_doc_token_ref_resolve(token, state, &data, &data2); @@ -195,7 +218,7 @@ struct documentation_generator is_beta = eolian_object_is_beta(data) || eolian_object_is_beta(data2); break; case ::EOLIAN_OBJECT_FUNCTION: - ref += function_conversion(data, (const ::Eolian_Function *)data2, name_tail); + ref += function_conversion(data, (const ::Eolian_Function *)data2, name_tail, context); is_beta = eolian_object_is_beta(data) || eolian_object_is_beta(data2); break; case ::EOLIAN_OBJECT_CONSTANT: @@ -227,7 +250,8 @@ struct documentation_generator } // Turns EO documentation syntax into C# triple-slash XML comment syntax - static std::string syntax_conversion(std::string text, const Eolian_State *state, bool want_beta) + template + static std::string syntax_conversion(std::string text, const Eolian_State *state, Context const& context) { std::string new_text, ref; ::Eolian_Doc_Token_Type previous_token_type = ::EOLIAN_DOC_TOKEN_UNKNOWN; @@ -266,7 +290,7 @@ struct documentation_generator new_text += token_text; break; case ::EOLIAN_DOC_TOKEN_REF: - ref = ref_conversion(&token, state, name_tail, want_beta); + ref = ref_conversion(&token, state, name_tail, context); if (ref != "") { if (utils::ends_with(ref, BETA_REF_SUFFIX)) @@ -331,7 +355,7 @@ struct documentation_generator if (!as_generator(html_escaped_string).generate(std::back_inserter(new_text), text, context)) return false; auto options = context_find_tag(context); - new_text = syntax_conversion( new_text, context_find_tag(context).state, options.want_beta); + new_text = syntax_conversion( new_text, context_find_tag(context).state, context); std::string tabs; as_generator(scope_tab(scope_size) << "/// ").generate (std::back_inserter(tabs), attributes::unused, context); @@ -653,7 +677,7 @@ struct documentation_string_generator auto options = context_find_tag(context); auto state = context_find_tag(context).state; - if (!as_generator(string).generate(sink, documentation_generator::syntax_conversion(escaped, state, options.want_beta), context)) + if (!as_generator(string).generate(sink, documentation_generator::syntax_conversion(escaped, state, context), context)) return false; return true; diff --git a/src/bin/eolian_mono/eolian/mono/function_definition.hh b/src/bin/eolian_mono/eolian/mono/function_definition.hh index cded973d23..86eb2db192 100644 --- a/src/bin/eolian_mono/eolian/mono/function_definition.hh +++ b/src/bin/eolian_mono/eolian/mono/function_definition.hh @@ -26,6 +26,7 @@ #include "grammar/list.hpp" #include "grammar/alternative.hpp" #include "grammar/attribute_reorder.hpp" +#include "grammar/eps.hpp" #include "grammar/counter.hpp" #include "logging.hh" #include "type.hh" @@ -44,7 +45,7 @@ namespace eolian_mono { struct native_function_definition_generator { attributes::klass_def const* klass; - + template bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const { @@ -181,7 +182,7 @@ struct native_function_definition_generator return true; } }; - + struct function_definition_generator { function_definition_generator(bool do_super = false) @@ -323,6 +324,199 @@ property_extension_method_definition_generator property_extension_method_definit struct property_wrapper_definition_generator { + template + bool generate_get_indexer(OutputIterator sink, attributes::property_def const& property, Context const& context + , std::string get_scope + , bool is_interface) const + { + if (is_interface) + { + if (!as_generator(scope_tab << scope_tab << get_scope << "get;\n" + ).generate(sink, attributes::unused, context)) + return false; + } + else + { + if (!as_generator(scope_tab << scope_tab << get_scope << "get\n" + << scope_tab << scope_tab << "{\n" + << scope_tab << scope_tab(2) << "var i = new " + << name_helpers::property_concrete_indexer_name(property) << "();\n" + << scope_tab << scope_tab(2) << "i.Self = this;\n" + << scope_tab << scope_tab(2) << "return i;\n" + << scope_tab << scope_tab << "}\n" + ).generate(sink, attributes::unused, context)) + return false; + } + + return true; + } + + template + bool generate_indexer(OutputIterator sink + , attributes::property_def const& property + , Context const& context + , std::string scope, std::string get_scope, std::string set_scope + , std::string class_name + , C1 keys, C2 values + , bool is_interface + , bool is_concrete_for_interface + , bool has_setter) const + { + if (is_interface) + return true; + + auto size_not_one = [] (std::vector k) { return k.size() != 1; }; + auto type_or_tuple + = + ( + ( + attribute_conditional(size_not_one)["("] + << (type(false) % ", ") + << ")" + ) + | *type(false) + ) + ; + + std::string parentship = "\n"; + + bool is_self_property = *implementing_klass == *klass_from_property; + + if (!(is_self_property && !is_concrete_for_interface)) + parentship = " : " + name_helpers::property_interface_indexer_name(property, *klass_from_property) + "\n"; + + if (!as_generator + ( + scope_tab << scope << "class " << name_helpers::property_concrete_indexer_name(property) << parentship + << scope_tab << "{\n" + << scope_tab(2) << "public " << class_name << " Self {get; set;}\n" + << scope_tab(2) << "public " + << type_or_tuple << " this[" << type_or_tuple <<" i]\n" + << scope_tab(2) << "{\n" + ).generate(sink, make_tuple(values, values, keys, keys), context)) + return false; + + assert (!keys.empty()); + std::vector get_keys; + if(keys.size() != 1) + { + unsigned int i = 0; + for (auto&& key : keys) + { + static_cast(key); + ++i; + get_keys.push_back("i.Item" + std::to_string(i)); + } + } + else + { + get_keys.push_back ("i"); + } + assert (!get_keys.empty()); + + generate_get(sink, property, context, get_scope, get_keys, values, is_interface, "Self."); + if (has_setter) + generate_set(sink, property, context, set_scope, get_keys, values, is_interface, "Self."); + + if (!as_generator + ( + scope_tab(2) << "}\n" + << scope_tab << "};\n" + ).generate(sink, attributes::unused, context)) + return false; + return true; + } + template + bool generate_set(OutputIterator sink, attributes::property_def const& property, Context const& context + , std::string set_scope + , CK keys, CV values + , bool is_interface + , std::string name_prefix = "") const + { + using efl::eolian::grammar::counter; + if (is_interface) + { + if (!as_generator(scope_tab << scope_tab << set_scope << "set;\n" + ).generate(sink, attributes::unused, context)) + return false; + } + else if (values.size() == 1) + { + if (!as_generator(scope_tab << scope_tab << set_scope << "set " << "{ " << name_prefix << name_helpers::managed_method_name(*property.setter) + "(" << *(string << ",") << "value); }\n" + ).generate(sink, keys, context)) + return false; + } + else if (values.size() > 1) + { + if (!as_generator( + scope_tab << scope_tab << set_scope << "set " + << ("{ " << name_prefix << name_helpers::managed_method_name(*property.setter) + "(") + << *(string << ",") << ((" value.Item" << counter(1)) % ", ") + << "); }\n" + ).generate(sink, std::make_tuple(keys, values), context)) + return false; + } + return true; + } + template + bool generate_get(OutputIterator sink, attributes::property_def const& property, Context const& context + , std::string get_scope + , CK keys, CV values + , bool is_interface + , std::string name_prefix = "") const + { + using efl::eolian::grammar::attribute_reorder; + using efl::eolian::grammar::attributes::parameter_direction; + using efl::eolian::grammar::attributes::parameter_def; + + if (is_interface) // only declaration + { + if (!as_generator(scope_tab << scope_tab << get_scope << "get;\n" + ).generate(sink, attributes::unused, context)) + return false; + } + else + if (/*has_getter && */values.size() == 1) + { + if (!as_generator + (scope_tab << scope_tab << get_scope + << "get " << "{ return " << name_prefix << name_helpers::managed_method_name(*property.getter) + << "(" << (string % ",") << "); }\n" + ).generate(sink, keys, context)) + return false; + } + else if (/*has_getter && */values.size() > 1) + { + if (!as_generator + (scope_tab << scope_tab << get_scope << "get " + << "{\n" + << *attribute_reorder<1, -1, 1> + (scope_tab(3) << type(true) << " _out_" + << argument(false) << " = default(" << type(true) << ");\n" + ) + << scope_tab(3) << name_prefix << name_helpers::managed_method_name(*property.getter) + << "(" << *(string << ",") << (("out _out_" << argument(false)) % ", ") << ");\n" + << scope_tab(3) << "return (" << (("_out_"<< argument(false)) % ", ") << ");\n" + << scope_tab(2) << "}" << "\n" + ).generate(sink, std::make_tuple(values, keys, values, values), context)) + return false; + } + // else if (values.size() == 1) + // { + // if (!as_generator + // (scope_tab << scope_tab << get_scope << "get " + // << "{\n" + // << *attribute_reorder<1, -1, 1>(scope_tab(3) << type(true) << " _out_" << argument(false) << " = default(" << type(true) << ");\n") + // << scope_tab(3) << name_prefix << name_helpers::managed_method_name(*property.getter) + // << "(" << *(string << ",") << (("out _out_" << argument(false)) % ",") << ");\n" + // << scope_tab(3) << "return " << (("_out_"<< argument(false)) % ",") << ";\n" + // << scope_tab(2) << "}" << "\n" + // ).generate(sink, std::make_tuple(values, keys, values, values), context)) + // return false; + // } + return true; + } + template bool generate(OutputIterator sink, attributes::property_def const& property, Context const& context) const { @@ -331,103 +525,127 @@ struct property_wrapper_definition_generator using efl::eolian::grammar::attributes::parameter_direction; using efl::eolian::grammar::attributes::parameter_def; - if (blacklist::is_property_blacklisted(property, *implementing_klass, context)) - return true; + /// C(k) = keys count, C(v) = values count + /// /------------\ /------\. + /// |blacklisted?|---yes-----| skip |--------------\. + /// \------------/ \------/ | + /// | | | + /// no yes | + /// | | | + /// /---------\ /------------\ | + /// |is-static|----yes-----|is-interface| | + /// \---------/ \------------/ | + /// | | | + /// no no | + /// | | | + /// /--------\ /-----------\ | + /// |has-get?|---no-conc---|is-concrete|-----yes---/ + /// \--------/ \-----------/ + /// / \. + /// no yes + /// / \. + /// /----\ /--------------------------------------\. + /// |skip|-yes-|explicit return != Eina.Error or void | + /// \----/ \--------------------------------------/ + /// | + /// no + /// | + /// /--------\. + /// |has-set?| + /// \--------/ + /// / \. + /// no yes + /// / \. + /// /------\ /--------------------------------------\. + /// /------------------|no-set| |explicit return != Eina.Error or void |---- yes --\. + /// | \------/ \--------------------------------------/ | + /// | \------------|----------------------------------------------/ + /// | no + /// | | + /// | /--------\. + /// | |has-both| + /// | \--------/ + /// | | + /// | /-------------------\. + /// | |set-keys = get-keys| + /// | \-------------------/ + /// | / | + /// | no | + /// | / | + /// | /----\ /-----------------------\. + /// | |skip|--no---|set-values = get-values| + /// | \----/ \-----------------------/ + /// | / + /// | yes + /// | / + /// | /--------\. + /// \-------------------------| keys | + /// \--------/ + /// / \. + /// 0 >0 + /// / \. + /// /----------\ /----------\. + /// |no-indexer| | keys > 1 | + /// \----------/ \----------/ + /// | / | + /// | no yes + /// | / | + /// | / | + /// | /---------\ /-------------------\. + /// | | indexer | | indexer tuple key | + /// | \---------/ \-------------------/ + /// | / | + /// /--------\ | + /// | values |----------/ + /// \--------/ + /// / \. + /// 1 >1 + /// / \. + /// /----------------\ /-------------\. + /// | no tuple value | | tuple value | + /// \----------------/ \-------------/ + /// + + auto has_wrapper = helpers::has_property_wrapper (property, implementing_klass, context); + bool has_getter = has_wrapper & helpers::has_property_wrapper_bit::has_getter; + if (!has_getter) return true; + bool has_setter = has_wrapper & helpers::has_property_wrapper_bit::has_setter; + bool has_indexer = has_wrapper & helpers::has_property_wrapper_bit::has_indexer; bool is_interface = context_find_tag(context).current_wrapper_kind == class_context::interface; bool is_static = (property.getter.is_engaged() && property.getter->is_static) || (property.setter.is_engaged() && property.setter->is_static); bool is_concrete = context_find_tag(context).current_wrapper_kind == class_context::concrete; + bool is_concrete_for_interface = is_concrete + && (implementing_klass->type == attributes::class_type::interface_ + || implementing_klass->type == attributes::class_type::mixin); - - if ((is_concrete || is_interface) && is_static) - return true; - - auto get_params = property.getter.is_engaged() ? property.getter->parameters.size() : 0; - //auto set_params = property.setter.is_engaged() ? property.setter->parameters.size() : 0; - - // C# properties must have a single value. - // - // Single values in getters are automatically converted to return_type, - // meaning they should have 0 parameters. - // - // For setters, we ignore the return type - usually boolean. - // if (get_params > 0 || set_params > 1) - // return true; - - if (property.getter - && std::find_if (property.getter->parameters.begin() - , property.getter->parameters.end() - , [] (parameter_def const& p) - { - return p.direction != parameter_direction::out; - }) != property.getter->parameters.end()) - return true; - if (property.setter - && std::find_if (property.setter->parameters.begin() - , property.setter->parameters.end() - , [] (parameter_def const& p) - { - return p.direction != parameter_direction::in; - }) != property.setter->parameters.end()) - return true; - - if (property.getter && property.setter) + //if (name_helpers::klass_concrete_or_interface_name (*implementing_klass) == "IMapping") + if (false) { - if (get_params != 0 && property.setter->parameters.size() != property.getter->parameters.size()) - return true; + if (!as_generator(grammar::lit("/// is interface ") << (int)is_interface + << " is static " << (int)is_static + << " is concrete " << (int)is_concrete + << " is concrete_for_interface " << (int)is_concrete_for_interface + << " klass_from_property->type " << (int)klass_from_property->type + << " has_setter " << (int)has_setter + << " property.setter->explicit_return_type != attributes::void_ " << (property.setter && property.setter->explicit_return_type != attributes::void_) + << " property.setter->keys != property.getter->keys " << (property.setter && property.setter->keys != property.getter->keys) + << " property.setter->values != property.getter->values " << (property.setter && property.setter->values != property.getter->values) + << " has_setter && property.setter->scope != attributes::member_scope::scope_public " << (property.setter && property.setter->scope != attributes::member_scope::scope_public) + << "\n") + .generate (sink, attributes::unused, context)) + return false; } - std::vector parameters; - - if (property.setter.is_engaged()) - { - std::transform (property.setter->parameters.begin(), property.setter->parameters.end() - , std::back_inserter(parameters) - , [] (parameter_def p) -> parameter_def - { - //p.direction = efl::eolian::attributes::parameter_direction::in; - return p; - }); - } - else if (property.getter.is_engaged()) - { - // if getter has parameters, then we ignore return type, otherwise - // we use the return type. - if (get_params == 0) - parameters.push_back({parameter_direction::in - , property.getter->return_type, "propertyResult", {} - , property.getter->unit}); - else - std::transform (property.getter->parameters.begin(), property.getter->parameters.end() - , std::back_inserter(parameters) - , [] (parameter_def p) -> parameter_def - { - p.direction = parameter_direction::in; - return p; - }); - } - else - { - EINA_CXX_DOM_LOG_ERR(eolian_mono::domain) << "Property must have either a getter or a setter." << std::endl; - return false; - } - - std::string dir_mod; - if (property.setter.is_engaged()) - dir_mod = direction_modifier(property.setter->parameters[0]); + if (blacklist::is_property_blacklisted(property, context)) + return true; std::string managed_name = name_helpers::property_managed_name(property); std::string scope = "public "; - std::string get_scope = property.getter.is_engaged() ? eolian_mono::function_scope_get(*property.getter) : ""; - bool is_get_public = get_scope == "public "; - std::string set_scope = property.setter.is_engaged() ? eolian_mono::function_scope_get(*property.setter) : ""; - bool is_set_public = set_scope == "public "; - - // No need to generate this wrapper as no accessor is public. - if (is_interface && (!is_get_public && !is_set_public)) - return true; + std::string get_scope = eolian_mono::function_scope_get(*property.getter); + std::string set_scope = has_setter ? eolian_mono::function_scope_get(*property.setter) : ""; // C# interface members are declared automatically as public if (is_interface) @@ -442,23 +660,64 @@ struct property_wrapper_definition_generator get_scope = ""; set_scope = ""; } - else if (!property.setter.is_engaged() || (get_scope == scope)) + else if (!has_setter || (get_scope == scope)) { scope = get_scope; get_scope = ""; } - else if (!property.getter.is_engaged() || (set_scope == scope)) - { - scope = set_scope; - set_scope = ""; - } - if (parameters.size() == 1) + std::string virtual_mod = (is_static || is_interface || is_concrete) ? "" : "virtual "; + + auto keys = property.getter->keys; + auto values = property.getter->values; + auto generated_values = values; + auto klass_name = name_helpers::klass_concrete_or_interface_name (*implementing_klass); + + if (has_indexer) + { + assert (!!implementing_klass); + generate_indexer (sink, property, context, scope, get_scope, set_scope + , klass_name, keys, values + , is_interface, is_concrete_for_interface, has_setter); + + generated_values.clear(); + if (!is_interface && *implementing_klass == *klass_from_property + && !is_concrete_for_interface) + { + generated_values.push_back + (attributes::parameter_def + {parameter_direction::in + , attributes::type_def + { + attributes::regular_type_def{name_helpers::property_concrete_indexer_name(property), {attributes::qualifier_info::is_none, ""}, {}} + , name_helpers::property_concrete_indexer_name(property) + , false, false, false, "" + } + , "indexer", {}, nullptr + }); + } + else + { + generated_values.push_back + (attributes::parameter_def + {parameter_direction::in + , attributes::type_def + { + attributes::regular_type_def{name_helpers::klass_full_concrete_or_interface_name (*klass_from_property) + managed_name + "Indexer", {attributes::qualifier_info::is_none, ""}, {}} + , name_helpers::property_interface_indexer_name(property, *klass_from_property) + , false, false, false, "" + } + , "indexer", {}, nullptr + }); + } + } + + if (generated_values.size() == 1) { if (!as_generator( documentation(1) - << scope_tab << scope << (is_static ? "static " : "") << type(true) << " " << managed_name << " {\n" - ).generate(sink, std::make_tuple(property, parameters[0].type), context)) + << scope_tab << scope << (is_static ? "static " : virtual_mod) << type(true) << " " << managed_name << " {\n" + ).generate(sink, std::make_tuple(property, generated_values[0].type), context)) return false; } else @@ -469,73 +728,21 @@ struct property_wrapper_definition_generator << scope_tab << scope << (is_static ? "static (" : "(") << (attribute_reorder<1, -1>(type(true) /*<< " " << argument*/) % ", ") << ") " << managed_name << " {\n" - ).generate(sink, std::make_tuple(property, parameters), context)) + ).generate(sink, std::make_tuple(property, generated_values), context)) return false; } - if (property.getter.is_engaged() && is_interface) + if (has_indexer) { - if (is_get_public) - if (!as_generator(scope_tab << scope_tab << set_scope << "get;\n" - ).generate(sink, attributes::unused, context)) - return false; + generate_get_indexer (sink, property, context, get_scope, is_interface); } - else if (property.getter.is_engaged() && get_params == 0/*parameters.size() == 1 && property.getter.is_engaged()*/) + else { - if (!as_generator - (scope_tab << scope_tab << get_scope - << "get " << "{ return " + name_helpers::managed_method_name(*property.getter) + "(); }\n" - ).generate(sink, attributes::unused, context)) - return false; - } - else if (parameters.size() >= 1 && property.getter) - { - if (!as_generator - (scope_tab << scope_tab << get_scope << "get " - << "{\n" - << *attribute_reorder<1, -1, 1> - (scope_tab(3) << type(true) << " _out_" - << argument(false) << " = default(" << type(true) << ");\n" - ) - << scope_tab(3) << name_helpers::managed_method_name(*property.getter) - << "(" << (("out _out_" << argument(false)) % ", ") << ");\n" - << scope_tab(3) << "return (" << (("_out_"<< argument(false)) % ", ") << ");\n" - << scope_tab(2) << "}" << "\n" - ).generate(sink, std::make_tuple(parameters, parameters, parameters), context)) - return false; - } - // else if (parameters.size() == 1) - // { - // if (!as_generator - // (scope_tab << scope_tab << get_scope << "get " - // << "{\n" - // << *attribute_reorder<1, -1, 1>(scope_tab(3) << type(true) << " _out_" << argument(false) << " = default(" << type(true) << ");\n") - // << scope_tab(3) << name_helpers::managed_method_name(*property.getter) - // << "(" << (("out _out_" << argument(false)) % ",") << ");\n" - // << scope_tab(3) << "return " << (("_out_"<< argument(false)) % ",") << ";\n" - // << scope_tab(2) << "}" << "\n" - // ).generate(sink, std::make_tuple(parameters, parameters, parameters), context)) - // return false; - // } + std::vector empty_keys; + generate_get(sink, property, context, get_scope, empty_keys, values, is_interface); - if (property.setter.is_engaged() && is_interface) - { - if (is_set_public) - if (!as_generator(scope_tab << scope_tab << set_scope << "set;\n" - ).generate(sink, attributes::unused, context)) - return false; - } - else if (parameters.size() == 1 && property.setter.is_engaged()) - { - if (!as_generator(scope_tab << scope_tab << set_scope << "set " << "{ " + name_helpers::managed_method_name(*property.setter) + "(" + dir_mod + "value); }\n" - ).generate(sink, attributes::unused, context)) - return false; - } - else if (parameters.size() > 1 && property.setter.is_engaged()) - { - if (!as_generator(scope_tab << scope_tab << set_scope << "set " << ("{ " + name_helpers::managed_method_name(*property.setter) + "(" + dir_mod) << ((" value.Item" << counter(1)) % ", ") << "); }" << "\n" - ).generate(sink, parameters, context)) - return false; + if (has_setter) + generate_set (sink, property, context, set_scope, empty_keys, values, is_interface); } if (!as_generator(scope_tab << "}\n\n").generate(sink, attributes::unused, context)) @@ -543,13 +750,14 @@ struct property_wrapper_definition_generator return true; } - attributes::klass_def const* implementing_klass; + attributes::klass_def const* implementing_klass, *klass_from_property; }; struct property_wrapper_definition_parameterized { - property_wrapper_definition_generator operator()(attributes::klass_def const& klass) const + property_wrapper_definition_generator operator()(attributes::klass_def const& klass + , attributes::klass_def const& prop_from_klass) const { - return {&klass}; + return {&klass, &prop_from_klass}; } } const property_wrapper_definition; property_wrapper_definition_generator as_generator(property_wrapper_definition_parameterized) @@ -557,6 +765,45 @@ property_wrapper_definition_generator as_generator(property_wrapper_definition_p return {}; } +struct interface_property_indexer_definition_generator +{ + template + bool generate(OutputIterator sink, attributes::property_def const& property, Context const& context) const + { + using efl::eolian::grammar::attribute_reorder; + using efl::eolian::grammar::counter; + using efl::eolian::grammar::attributes::parameter_direction; + using efl::eolian::grammar::attributes::parameter_def; + + bool is_interface = context_find_tag(context).current_wrapper_kind == class_context::interface; + + assert (is_interface); + auto klass_name = name_helpers::klass_concrete_or_interface_name (*implementing_klass); + std::string managed_name = name_helpers::property_managed_name(property); + + if (!as_generator + ("public interface " << name_helpers::property_interface_indexer_short_name(property, *implementing_klass) << "\n" + << "{\n" + << "}\n" + ).generate (sink, attributes::unused, context)) + return false; + + return true; + } + attributes::klass_def const* implementing_klass; +}; +struct interface_property_indexer_definition_parameterized +{ + interface_property_indexer_definition_generator operator()(attributes::klass_def const& klass) const + { + return {&klass}; + } +} const interface_property_indexer_definition; +interface_property_indexer_definition_generator as_generator(interface_property_indexer_definition_parameterized) +{ + return {}; +} + } namespace efl { namespace eolian { namespace grammar { @@ -572,6 +819,10 @@ struct is_eager_generator< ::eolian_mono::property_wrapper_definition_generator> template <> struct is_eager_generator< ::eolian_mono::property_wrapper_definition_parameterized> : std::true_type {}; template <> +struct is_eager_generator< ::eolian_mono::interface_property_indexer_definition_parameterized> : std::true_type {}; +template <> +struct is_eager_generator< ::eolian_mono::interface_property_indexer_definition_generator> : std::true_type {}; +template <> struct is_generator< ::eolian_mono::function_definition_generator> : std::true_type {}; template <> struct is_generator< ::eolian_mono::native_function_definition_generator> : std::true_type {}; @@ -583,6 +834,10 @@ template <> struct is_generator< ::eolian_mono::property_wrapper_definition_generator> : std::true_type {}; template <> struct is_generator< ::eolian_mono::property_wrapper_definition_parameterized> : std::true_type {}; +template <> +struct is_generator< ::eolian_mono::interface_property_indexer_definition_parameterized> : std::true_type {}; +template <> +struct is_generator< ::eolian_mono::interface_property_indexer_definition_generator> : std::true_type {}; namespace type_traits { template <> @@ -601,8 +856,13 @@ template <> struct attributes_needed< ::eolian_mono::property_wrapper_definition_generator> : std::integral_constant {}; template <> struct attributes_needed< ::eolian_mono::property_wrapper_definition_parameterized> : std::integral_constant {}; + +template <> +struct attributes_needed< ::eolian_mono::interface_property_indexer_definition_parameterized> : std::integral_constant {}; +template <> +struct attributes_needed< ::eolian_mono::interface_property_indexer_definition_generator> : std::integral_constant {}; } - + } } } #endif diff --git a/src/bin/eolian_mono/eolian/mono/generation_contexts.hh b/src/bin/eolian_mono/eolian/mono/generation_contexts.hh index f7376f056a..2ac16b0f61 100644 --- a/src/bin/eolian_mono/eolian/mono/generation_contexts.hh +++ b/src/bin/eolian_mono/eolian/mono/generation_contexts.hh @@ -26,6 +26,7 @@ namespace eolian_mono { struct class_context { enum wrapper_kind { + none, interface, concrete, inherit, @@ -109,6 +110,12 @@ struct options_context { std::string examples_dir; }; +template +bool context_want_beta(Context const& context) +{ + return efl::eolian::grammar::context_find_tag(context).want_beta; +} + } #endif diff --git a/src/bin/eolian_mono/eolian/mono/helpers.hh b/src/bin/eolian_mono/eolian/mono/helpers.hh index b34a985749..049f263d80 100644 --- a/src/bin/eolian_mono/eolian/mono/helpers.hh +++ b/src/bin/eolian_mono/eolian/mono/helpers.hh @@ -17,6 +17,7 @@ #define EOLIAN_MONO_HELPERS_HH #include "grammar/klass_def.hpp" +#include "grammar/context.hpp" #include "blacklist.hh" #include "generation_contexts.hh" #include "name_helpers.hh" @@ -305,6 +306,106 @@ inline std::vector reorder_constructors(std::vector return constructors; } +enum class has_property_wrapper_bit +{ + has_none = 0 + , has_getter = 1 << 0 + , has_setter = 1 << 1 + , has_indexer = 1 << 2 + , has_key_tuple = 1 << 3 + , has_value_tuple = 1 << 4 + , has_set_error_check = 1 << 5 + , has_get_error_check = 1 << 6 +}; + +has_property_wrapper_bit& operator|=(has_property_wrapper_bit& self, has_property_wrapper_bit bit) +{ + self = static_cast(static_cast(self) | static_cast(bit)); + return self; +} + +bool operator&(has_property_wrapper_bit self, has_property_wrapper_bit bit) +{ + return static_cast(self) & static_cast(bit); +} + +template +has_property_wrapper_bit has_property_wrapper(attributes::property_def const& property, attributes::klass_def const* implementing_klass + , Context const& context) +{ + using efl::eolian::grammar::context_find_tag; + has_property_wrapper_bit r = has_property_wrapper_bit::has_none; + + if (blacklist::is_property_blacklisted(property, *implementing_klass, context)) + return r; + + bool has_getter = property.getter.is_engaged(); + bool has_setter = property.setter.is_engaged(); + + bool is_interface = context_find_tag(context).current_wrapper_kind == class_context::interface; + bool is_static = (property.getter.is_engaged() && property.getter->is_static) + || (has_setter && property.setter->is_static); + bool is_concrete = context_find_tag(context).current_wrapper_kind == class_context::concrete; + + if (is_static) + { + if (is_interface) return r; + else if (is_concrete) return r; + } + + // EINA_LOG_ERR("Generating property %s", name_helpers::property_managed_name(property).c_str()); + // C# interface can have only + if (is_interface) + { + has_getter = has_getter && property.getter->scope == attributes::member_scope:: scope_public; + } + + if (!has_getter) + { + return r; + } + + if (property.getter->explicit_return_type != attributes::void_) + { + return r; + } + else if (has_setter) + { + if (property.setter->explicit_return_type != attributes::void_) + has_setter = false; // do not generate setter + else if (property.setter->keys != property.getter->keys) + has_setter = false; + else if (property.setter->values != property.getter->values) + has_setter = false; + } + + if (is_interface) + { + if (property.getter->scope != attributes::member_scope::scope_public) + return r; + else if (has_setter && property.setter->scope != attributes::member_scope::scope_public) + has_setter = false; + } + + if (has_getter) + r |= has_property_wrapper_bit::has_getter; + if (has_setter) + r |= has_property_wrapper_bit::has_setter; + + if (property.getter->keys.size() == 1) + r |= has_property_wrapper_bit::has_indexer; + else if (property.getter->keys.size() > 1) + { + r |= has_property_wrapper_bit::has_indexer; + r |= has_property_wrapper_bit::has_key_tuple; + } + + if (property.getter->values.size() > 1) + r |= has_property_wrapper_bit::has_value_tuple; + + return r; +} + } // namespace helpers } // namespace eolian_mono diff --git a/src/bin/eolian_mono/eolian/mono/klass.hh b/src/bin/eolian_mono/eolian/mono/klass.hh index 11a7cd6627..e26121c05d 100644 --- a/src/bin/eolian_mono/eolian/mono/klass.hh +++ b/src/bin/eolian_mono/eolian/mono/klass.hh @@ -106,6 +106,10 @@ struct klass name_helpers::klass_full_concrete_or_interface_name(cls)}, context); + // Property wrappers + if (!as_generator(*(interface_property_indexer_definition(cls))).generate(sink, cls.properties, iface_cxt)) + return false; + if(!as_generator(documentation).generate(sink, cls, iface_cxt)) return false; @@ -158,7 +162,7 @@ struct klass ).generate(sink, p, iface_cxt)) return false; - if (!as_generator(*(property_wrapper_definition(cls))).generate(sink, cls.properties, iface_cxt)) + if (!as_generator(*(property_wrapper_definition(cls, cls))).generate(sink, cls.properties, iface_cxt)) return false; // End of interface declaration @@ -259,13 +263,13 @@ struct klass return false; // Property wrappers - if (!as_generator(*(property_wrapper_definition(cls))).generate(sink, cls.properties, concrete_cxt)) + if (!as_generator(*(property_wrapper_definition(cls, cls))).generate(sink, cls.properties, concrete_cxt)) return false; for (auto&& klass : helpers::non_implemented_interfaces(cls, concrete_cxt)) { attributes::klass_def c(get_klass(klass, cls.unit), cls.unit); - if (!as_generator(*(property_wrapper_definition(cls))).generate(sink, c.properties, concrete_cxt)) + if (!as_generator(*(property_wrapper_definition(cls, c))).generate(sink, c.properties, concrete_cxt)) return false; } @@ -343,13 +347,13 @@ struct klass return false; // Property wrappers - if (!as_generator(*(property_wrapper_definition(cls))).generate(sink, cls.properties, inherit_cxt)) + if (!as_generator(*(property_wrapper_definition(cls, cls))).generate(sink, cls.properties, inherit_cxt)) return false; for (auto&& klass : helpers::non_implemented_interfaces(cls, inherit_cxt)) { attributes::klass_def c(get_klass(klass, cls.unit), cls.unit); - if (!as_generator(*(property_wrapper_definition(cls))).generate(sink, c.properties, inherit_cxt)) + if (!as_generator(*(property_wrapper_definition(cls, c))).generate(sink, c.properties, inherit_cxt)) return false; } diff --git a/src/bin/eolian_mono/eolian/mono/name_helpers.hh b/src/bin/eolian_mono/eolian/mono/name_helpers.hh index 7f71d9279b..bf0abb7863 100644 --- a/src/bin/eolian_mono/eolian/mono/name_helpers.hh +++ b/src/bin/eolian_mono/eolian/mono/name_helpers.hh @@ -334,28 +334,6 @@ inline std::string to_field_name(std::string const& in) return utils::capitalize(in); } - - -template -inline std::string property_managed_name(T const& klass, std::string const& name) -{ - auto names = utils::split(name, '_'); - // No need to escape keyword here as it will be capitalized and already - // namespaced inside the owner class. - auto managed_name = utils::to_pascal_case(names); - auto managed_klass_name = klass_concrete_or_interface_name(klass); - - if (managed_name == "Type") - managed_name = managed_klass_name + managed_name; - - return managed_name; -} - -inline std::string property_managed_name(attributes::property_def const& property) -{ - return property_managed_name(property.klass, property.name); -} - inline std::string managed_part_name(attributes::part_def const& part) { std::vector names = utils::split(part.name, '_'); @@ -512,6 +490,45 @@ inline std::string translate_inherited_event_name(const attributes::event_def &e return join_namespaces(klass.namespaces, '_') + klass_interface_name(klass) + "_" + managed_event_name(evt.name); } +// Properties + +template +inline std::string property_managed_name(T const& klass, std::string const& name) +{ + auto names = utils::split(name, '_'); + // No need to escape keyword here as it will be capitalized and already + // namespaced inside the owner class. + auto managed_name = utils::to_pascal_case(names); + auto managed_klass_name = klass_concrete_or_interface_name(klass); + + if (managed_name == "Type") + managed_name = managed_klass_name + managed_name; + + return managed_name; +} + +inline std::string property_managed_name(attributes::property_def const& property) +{ + return property_managed_name(property.klass, property.name); +} + +inline std::string property_concrete_indexer_name(attributes::property_def const& property) +{ + return property_managed_name(property) + "Indexer"; +} + +template +inline std::string property_interface_indexer_name(attributes::property_def const& property, T const& current_klass) +{ + return name_helpers::klass_full_interface_name(current_klass) + property_concrete_indexer_name(property); +} + +template +inline std::string property_interface_indexer_short_name(attributes::property_def const& property, T const& current_klass) +{ + return name_helpers::klass_interface_name(current_klass) + property_concrete_indexer_name(property); +} + // Open/close namespaces template bool open_namespaces(OutputIterator sink, std::vector namespaces, Context const& context) diff --git a/src/bin/eolian_mono/eolian/mono/parameter.hh b/src/bin/eolian_mono/eolian/mono/parameter.hh index 210e5f22d5..4af5fe2aef 100644 --- a/src/bin/eolian_mono/eolian/mono/parameter.hh +++ b/src/bin/eolian_mono/eolian/mono/parameter.hh @@ -65,7 +65,7 @@ struct is_generator< ::eolian_mono::parameter_generator> : std::true_type {}; namespace type_traits { template <> -struct attributes_needed< ::eolian_mono::parameter_generator> : std::integral_constant {}; +struct attributes_needed< ::eolian_mono::parameter_generator> : std::integral_constant {}; } template <> @@ -75,9 +75,9 @@ struct is_generator< ::eolian_mono::marshall_parameter_generator> : std::true_ty namespace type_traits { template <> -struct attributes_needed< ::eolian_mono::marshall_parameter_generator> : std::integral_constant {}; +struct attributes_needed< ::eolian_mono::marshall_parameter_generator> : std::integral_constant {}; } - + template <> struct is_eager_generator< ::eolian_mono::argument_generator> : std::true_type {}; template <> @@ -85,9 +85,9 @@ struct is_generator< ::eolian_mono::argument_generator> : std::true_type {}; namespace type_traits { template <> -struct attributes_needed< ::eolian_mono::argument_generator> : std::integral_constant {}; +struct attributes_needed< ::eolian_mono::argument_generator> : std::integral_constant {}; } - + template <> struct is_eager_generator< ::eolian_mono::argument_invocation_generator> : std::true_type {}; template <> @@ -1553,7 +1553,7 @@ struct native_convert_function_pointer_generator struct constructor_parameter_name_generator { - + template bool generate(OutputIterator sink, attributes::parameter_def const& param, Context const& context) const { diff --git a/src/bin/eolian_mono/eolian_mono.cc b/src/bin/eolian_mono/eolian_mono.cc index 62eed11b2a..b6d2b6f1a0 100644 --- a/src/bin/eolian_mono/eolian_mono.cc +++ b/src/bin/eolian_mono/eolian_mono.cc @@ -182,13 +182,14 @@ run(options_type const& opts) auto context = context_add_tag(eolian_mono::indentation_context{0}, context_add_tag(eolian_mono::eolian_state_context{opts.state}, + context_add_tag(eolian_mono::class_context{eolian_mono::class_context::none}, context_add_tag(eolian_mono::options_context{opts.want_beta, opts.examples_dir}, context_add_tag(eolian_mono::library_context{opts.dllimport, opts.v_major, opts.v_minor, opts.references_map}, - efl::eolian::grammar::context_null())))); + efl::eolian::grammar::context_null()))))); EINA_ITERATOR_FOREACH(aliases, tp) { diff --git a/src/bindings/mono/efl_mono/GenericModel.cs b/src/bindings/mono/efl_mono/GenericModel.cs index 8d7cc813a2..faa2a2f099 100644 --- a/src/bindings/mono/efl_mono/GenericModel.cs +++ b/src/bindings/mono/efl_mono/GenericModel.cs @@ -52,7 +52,7 @@ public class GenericModel : Efl.Object, Efl.IModel /// Gets the value of the given property in the wrapped model. /// The property of the model. /// The value of the property. - public Eina.Value GetProperty( System.String property) + public Eina.Value GetProperty(System.String property) { return model.GetProperty(property); } @@ -62,7 +62,7 @@ public class GenericModel : Efl.Object, Efl.IModel /// The value of the property. /// An that resolves when the property has /// been set or reports an error if it could not be set. - public Eina.Future SetProperty( System.String property, Eina.Value value) + public Eina.Future SetProperty(System.String property, Eina.Value value) { return model.SetProperty(property, value); } @@ -77,7 +77,7 @@ public class GenericModel : Efl.Object, Efl.IModel /// Returns an that will resolve when the property is ready to be read. /// The property of the model. /// An that resolves when the property is ready. - public Eina.Future GetPropertyReady( System.String property) + public Eina.Future GetPropertyReady(System.String property) { return model.GetPropertyReady(property); } @@ -87,7 +87,7 @@ public class GenericModel : Efl.Object, Efl.IModel /// The size of the range. /// An that resolves to an /// of children models. - public Eina.Future GetChildrenSlice( uint start, uint count) + public Eina.Future GetChildrenSlice(uint start, uint count) { return model.GetChildrenSlice(start, count); } @@ -141,7 +141,7 @@ public class GenericModel : Efl.Object, Efl.IModel /// The token for the task's cancellation. /// Task that resolves when the property has been set or could not /// be set. - public System.Threading.Tasks.Task SetPropertyAsync( System.String property, Eina.Value value, System.Threading.CancellationToken token=default(System.Threading.CancellationToken)) + public System.Threading.Tasks.Task SetPropertyAsync(System.String property, Eina.Value value, System.Threading.CancellationToken token=default(System.Threading.CancellationToken)) { return model.SetPropertyAsync(property, value, token); } @@ -151,7 +151,7 @@ public class GenericModel : Efl.Object, Efl.IModel /// The token for the task's cancellation. /// Task that resolves when the given property is ready to be /// read. - public System.Threading.Tasks.Task GetPropertyReadyAsync( System.String property, System.Threading.CancellationToken token=default(System.Threading.CancellationToken)) + public System.Threading.Tasks.Task GetPropertyReadyAsync(System.String property, System.Threading.CancellationToken token=default(System.Threading.CancellationToken)) { return model.GetPropertyReadyAsync(property, token); } @@ -162,7 +162,7 @@ public class GenericModel : Efl.Object, Efl.IModel /// Token to notify the async operation of external request to cancel. /// Task that resolves when the desired of /// children models is ready. - public System.Threading.Tasks.Task GetChildrenSliceAsync( uint start, uint count, System.Threading.CancellationToken token=default(System.Threading.CancellationToken)) + public System.Threading.Tasks.Task GetChildrenSliceAsync(uint start, uint count, System.Threading.CancellationToken token=default(System.Threading.CancellationToken)) { return model.GetChildrenSliceAsync(start, count, token); } diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp index 86fb61e8a3..48b8b52c80 100644 --- a/src/lib/eolian_cxx/grammar/klass_def.hpp +++ b/src/lib/eolian_cxx/grammar/klass_def.hpp @@ -897,7 +897,7 @@ struct function_def } else if(type == EOLIAN_PROP_GET) { - for(auto&& v : values) + for(auto v : values) { v.direction = parameter_direction::out; parameters.push_back(v); diff --git a/src/tests/efl_mono/Eo.cs b/src/tests/efl_mono/Eo.cs index 7c580480ad..af40bf12d8 100644 --- a/src/tests/efl_mono/Eo.cs +++ b/src/tests/efl_mono/Eo.cs @@ -402,15 +402,15 @@ class TestCsharpProperties obj.Dispose(); } - public static void test_setter_only() - { - var obj = new Dummy.TestObject(); - int val = -1984; + // public static void test_setter_only() + // { + // var obj = new Dummy.TestObject(); + // int val = -1984; - obj.SetterOnly = val; - Test.AssertEquals(val, obj.GetSetterOnly()); - obj.Dispose(); - } + // obj.SetterOnly = val; + // Test.AssertEquals(val, obj.GetSetterOnly()); + // obj.Dispose(); + // } public static void test_class_property() { @@ -436,6 +436,52 @@ class TestCsharpProperties Test.AssertEquals(ret, (1, 2)); obj.Dispose(); } + + public static void test_csharp_keyed_multi_valued_prop() + { + var obj = new Dummy.TestObject(); + obj.KeyedMultiValuedProp[100] = (1, 2); + Test.AssertEquals(obj.KeyedMultiValuedProp[100], (1, 2)); + obj.Dispose(); + } + + public static void test_csharp_multi_keyed_multi_valued_prop() + { + var obj = new Dummy.TestObject(); + obj.MultiKeyedMultiValuedProp[(100, 101)] = (1, 2); + Test.AssertEquals(obj.MultiKeyedMultiValuedProp[(100, 101)], (1, 2)); + obj.Dispose(); + } + + public static void test_csharp_multi_prop() + { + var obj = new Dummy.TestObject(); + obj.MultiKeyedMultiValuedProp[(100, 101)] = (1, 2); + obj.KeyedMultiValuedProp[100] = (1, 2); + Test.AssertEquals(obj.KeyedMultiValuedProp[100], + obj.MultiKeyedMultiValuedProp[(100, 101)]); + int a1, b1, a2, b2; +#if __MonoCS__ + (int a, int b) t1 = obj.MultiKeyedMultiValuedProp[(100, 101)]; + (a1, b1) = (t1.Item1, t1.Item2); + (int a, int b) t2 = obj.KeyedMultiValuedProp[100]; + (a2, b2) = (t2.Item1, t2.Item2); +#else + (a1, b1) = obj.MultiKeyedMultiValuedProp[(100, 101)]; + (a2, b2) = obj.KeyedMultiValuedProp[100]; +#endif + Test.AssertEquals(a1, a2); + Test.AssertEquals(b1, b2); + var i = (100, 101); + var j = 100; + Test.AssertEquals(obj.KeyedMultiValuedProp[j], + obj.MultiKeyedMultiValuedProp[i]); + obj.MultiKeyedMultiValuedProp[i] = (1, 3); + obj.KeyedMultiValuedProp[j] = obj.MultiKeyedMultiValuedProp[i]; + Test.AssertEquals(obj.KeyedMultiValuedProp[j], + obj.MultiKeyedMultiValuedProp[i]); + + } } class TestEoGrandChildrenFinalize diff --git a/src/tests/efl_mono/dummy_event_manager.c b/src/tests/efl_mono/dummy_event_manager.c index 62bdd05c7f..813622929a 100644 --- a/src/tests/efl_mono/dummy_event_manager.c +++ b/src/tests/efl_mono/dummy_event_manager.c @@ -43,6 +43,12 @@ _dummy_event_manager_emitter_set(EINA_UNUSED Eo *obj, Dummy_Event_Manager_Data * pd->emitter = emitter; } +static Efl_Object* +_dummy_event_manager_emitter_get(EINA_UNUSED Eo const *obj, Dummy_Event_Manager_Data *pd) +{ + return pd->emitter; +} + static Eina_Bool _dummy_event_manager_emit_with_int(EINA_UNUSED Eo *obj, Dummy_Event_Manager_Data *pd, int data) { diff --git a/src/tests/efl_mono/dummy_event_manager.eo b/src/tests/efl_mono/dummy_event_manager.eo index b16f7b92cb..5c8b1d0791 100644 --- a/src/tests/efl_mono/dummy_event_manager.eo +++ b/src/tests/efl_mono/dummy_event_manager.eo @@ -4,8 +4,6 @@ class Dummy.Event_Manager extends Efl.Object { methods { @property emitter { - set { - } values { emitter: Efl.Object @move; } diff --git a/src/tests/efl_mono/dummy_test_object.c b/src/tests/efl_mono/dummy_test_object.c index b87aff1cd4..19539906f4 100644 --- a/src/tests/efl_mono/dummy_test_object.c +++ b/src/tests/efl_mono/dummy_test_object.c @@ -16,6 +16,7 @@ #define DUMMY_TEST_IFACE_PROTECTED +#include #include "libefl_mono_native_test.h" typedef struct Dummy_Test_Object_Data @@ -4612,6 +4613,36 @@ void _dummy_test_object_multi_valued_prop_set(Eo* obj EINA_UNUSED, Dummy_Test_Ob pd->prop2 = prop2; } +void _dummy_test_object_keyed_multi_valued_prop_get(Eo const* obj EINA_UNUSED, Dummy_Test_Object_Data* pd, int prop_key1, int* prop1, int* prop2) +{ + assert (prop_key1 == 100); + *prop1 = pd->prop1; + *prop2 = pd->prop2; +} + +void _dummy_test_object_keyed_multi_valued_prop_set(Eo* obj EINA_UNUSED, Dummy_Test_Object_Data* pd, int prop_key1, int prop1, int prop2) +{ + assert (prop_key1 == 100); + pd->prop1 = prop1; + pd->prop2 = prop2; +} + +void _dummy_test_object_multi_keyed_multi_valued_prop_get(Eo const* obj EINA_UNUSED, Dummy_Test_Object_Data* pd, int prop_key1, int prop_key2, int* prop1, int* prop2) +{ + assert (prop_key1 == 100); + assert (prop_key2 == 101); + *prop1 = pd->prop1; + *prop2 = pd->prop2; +} + +void _dummy_test_object_multi_keyed_multi_valued_prop_set(Eo* obj EINA_UNUSED, Dummy_Test_Object_Data* pd, int prop_key1, int prop_key2, int prop1, int prop2) +{ + assert (prop_key1 == 100); + assert (prop_key2 == 101); + pd->prop1 = prop1; + pd->prop2 = prop2; +} + /* Class Properties */ static int _dummy_test_object_klass_prop = 0; diff --git a/src/tests/efl_mono/dummy_test_object.eo b/src/tests/efl_mono/dummy_test_object.eo index cf2ae7ce03..37c08cb495 100644 --- a/src/tests/efl_mono/dummy_test_object.eo +++ b/src/tests/efl_mono/dummy_test_object.eo @@ -1581,6 +1581,31 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface { } } + @property keyed_multi_valued_prop { + get {} + set {} + keys { + key1: int; + } + values { + prop1: int; + prop2: int; + } + } + + @property multi_keyed_multi_valued_prop { + get {} + set {} + keys { + key1: int; + key2: int; + } + values { + prop1: int; + prop2: int; + } + } + @property klass_prop @static { get {} set {} From 934a93e39fea7ec157421af91f5cfc5ec94047b0 Mon Sep 17 00:00:00 2001 From: Yeongjong Lee Date: Mon, 23 Dec 2019 08:18:02 +0000 Subject: [PATCH 21/27] eolian_mono: check extension part/property existence before generate ExtensionMethods Empty ExtensionMethods class won't be generated. Reviewed-by: Felipe Magno de Almeida Differential Revision: https://phab.enlightenment.org/D10954 --- src/bin/eolian_mono/eolian/mono/klass.hh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/bin/eolian_mono/eolian/mono/klass.hh b/src/bin/eolian_mono/eolian/mono/klass.hh index e26121c05d..478c6a9c80 100644 --- a/src/bin/eolian_mono/eolian/mono/klass.hh +++ b/src/bin/eolian_mono/eolian/mono/klass.hh @@ -385,7 +385,16 @@ struct klass std::copy(c.properties.begin(), c.properties.end(), std::back_inserter(implementable_properties)); } - if (implementable_properties.size() == 0 && cls.parts.size() == 0) + std::stringstream extension_method_stream; + std::ostream_iterator extension_method_iterator(extension_method_stream); + + if (!as_generator + (*property_extension_method_definition(cls) + << *part_extension_method_definition(cls)) + .generate(extension_method_iterator, std::make_tuple(implementable_properties, cls.parts), context)) + return false; + + if (extension_method_stream.tellp() <= 0) return true; if(!as_generator @@ -393,12 +402,11 @@ struct klass << "#pragma warning disable CS1591\n" // Disabling warnings as DocFx will hide these classes <<"public static class " << (string % "_") << name_helpers::klass_inherit_name(cls) << "_ExtensionMethods {\n" - << *(property_extension_method_definition(cls)) - << *(part_extension_method_definition(cls)) + << extension_method_stream.str() << "}\n" << "#pragma warning restore CS1591\n" << "#endif\n") - .generate(sink, std::make_tuple(cls.namespaces, implementable_properties, cls.parts), context)) + .generate(sink, cls.namespaces, context)) return false; return true; From b4846c95a2181b52bf1deb4abd7e7bf3bb1fa7df Mon Sep 17 00:00:00 2001 From: Yeongjong Lee Date: Fri, 20 Dec 2019 11:00:45 +0000 Subject: [PATCH 22/27] eo_mono: make Eo.Globals internal All members of `Eo.Globals` are already `internal`. It is unnecessary for `Eo.Globals` to be `public`. Reviewed-by: Felipe Magno de Almeida Differential Revision: https://phab.enlightenment.org/D10938 --- src/bindings/mono/eo_mono/iwrapper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings/mono/eo_mono/iwrapper.cs b/src/bindings/mono/eo_mono/iwrapper.cs index 29a346dcc4..ea7104b384 100644 --- a/src/bindings/mono/eo_mono/iwrapper.cs +++ b/src/bindings/mono/eo_mono/iwrapper.cs @@ -34,7 +34,7 @@ namespace Efl namespace Eo { -public static class Globals +internal static class Globals { /// Represents the type of the native Efl_Class. internal enum EflClassType From a56b96d33c6aa26894fc373e520c9d5fcbbe03ce Mon Sep 17 00:00:00 2001 From: Yeongjong Lee Date: Fri, 20 Dec 2019 10:24:29 +0000 Subject: [PATCH 23/27] eo_mono: make BindingEntityAttribute internal `BindingEntityAttribute` is used internally to check whether the object is generated binding classes or not. API user should use protected `IsGeneratedBindingClass` instead. Reviewed-by: Felipe Magno de Almeida Differential Revision: https://phab.enlightenment.org/D10937 --- src/bindings/mono/eo_mono/iwrapper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings/mono/eo_mono/iwrapper.cs b/src/bindings/mono/eo_mono/iwrapper.cs index ea7104b384..2a8ebf0620 100644 --- a/src/bindings/mono/eo_mono/iwrapper.cs +++ b/src/bindings/mono/eo_mono/iwrapper.cs @@ -981,7 +981,7 @@ class PrivateNativeClass : NativeClass AllowMultiple = false, Inherited = false) ] -public class BindingEntityAttribute: System.Attribute +internal class BindingEntityAttribute: System.Attribute { public static bool IsBindingEntity(System.Type t) { From 5679a5d2a2d96d076e7f0a7309b01b04f1aad606 Mon Sep 17 00:00:00 2001 From: Yeongjong Lee Date: Thu, 19 Dec 2019 02:46:11 +0000 Subject: [PATCH 24/27] eina_mono: make internal classes internal This hide internal classes.. Reviewed-by: Felipe Magno de Almeida Differential Revision: https://phab.enlightenment.org/D10912 --- src/bindings/mono/eina_mono/eina_array.cs | 2 +- .../mono/eina_mono/eina_container_common.cs | 36 +++++++++---------- src/bindings/mono/eina_mono/eina_hash.cs | 4 +-- src/bindings/mono/eina_mono/eina_inarray.cs | 2 +- src/bindings/mono/eina_mono/eina_inlist.cs | 2 +- src/bindings/mono/eina_mono/eina_iterator.cs | 2 +- src/bindings/mono/eina_mono/eina_list.cs | 2 +- .../mono/eina_mono/eina_stringshare.cs | 2 +- 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/bindings/mono/eina_mono/eina_array.cs b/src/bindings/mono/eina_mono/eina_array.cs index f5f807ad55..37251be6cd 100644 --- a/src/bindings/mono/eina_mono/eina_array.cs +++ b/src/bindings/mono/eina_mono/eina_array.cs @@ -28,7 +28,7 @@ namespace Eina { [EditorBrowsable(EditorBrowsableState.Never)] -public static class ArrayNativeFunctions +internal static class ArrayNativeFunctions { [DllImport(efl.Libs.Eina)] internal static extern IntPtr eina_array_new(uint step); diff --git a/src/bindings/mono/eina_mono/eina_container_common.cs b/src/bindings/mono/eina_mono/eina_container_common.cs index 5366fab20c..192469a033 100644 --- a/src/bindings/mono/eina_mono/eina_container_common.cs +++ b/src/bindings/mono/eina_mono/eina_container_common.cs @@ -33,7 +33,7 @@ namespace Eina { [EditorBrowsable(EditorBrowsableState.Never)] -public enum ElementType +internal enum ElementType { NumericType, StringType, @@ -43,7 +43,7 @@ public enum ElementType [EditorBrowsable(EditorBrowsableState.Never)] [StructLayout(LayoutKind.Sequential)] -public struct InlistMem : IEquatable +internal struct InlistMem : IEquatable { public IntPtr next {get;set;} public IntPtr prev {get;set;} @@ -98,7 +98,7 @@ public struct InlistMem : IEquatable [EditorBrowsable(EditorBrowsableState.Never)] [StructLayout(LayoutKind.Sequential)] -public struct InlistNode : IEquatable> +internal struct InlistNode : IEquatable> { public InlistMem __in_list {get;set;} public T Val {get;set;} @@ -151,7 +151,7 @@ public struct InlistNode : IEquatable> } [EditorBrowsable(EditorBrowsableState.Never)] -public interface IBaseElementTraits +internal interface IBaseElementTraits { IntPtr ManagedToNativeAlloc(T man); IntPtr ManagedToNativeAllocInlistNode(T man); @@ -172,7 +172,7 @@ public interface IBaseElementTraits } [EditorBrowsable(EditorBrowsableState.Never)] -public class StringElementTraits : IBaseElementTraits +internal class StringElementTraits : IBaseElementTraits { public StringElementTraits() { @@ -311,7 +311,7 @@ public class StringElementTraits : IBaseElementTraits } [EditorBrowsable(EditorBrowsableState.Never)] -public class StringshareElementTraits : IBaseElementTraits +internal class StringshareElementTraits : IBaseElementTraits { public StringshareElementTraits() { @@ -451,7 +451,7 @@ public class StringshareElementTraits : IBaseElementTraits } [EditorBrowsable(EditorBrowsableState.Never)] -public class EflObjectElementTraits : IBaseElementTraits +internal class EflObjectElementTraits : IBaseElementTraits { public IntPtr ManagedToNativeAlloc(T man) { @@ -609,7 +609,7 @@ public class EflObjectElementTraits : IBaseElementTraits } [EditorBrowsable(EditorBrowsableState.Never)] -public abstract class PrimitiveElementTraits +internal abstract class PrimitiveElementTraits { private Eina.Callbacks.EinaCompareCb dlgt = null; @@ -711,7 +711,7 @@ public abstract class PrimitiveElementTraits } [EditorBrowsable(EditorBrowsableState.Never)] -abstract public class Primitive32ElementTraits : PrimitiveElementTraits, IBaseElementTraits +internal abstract class Primitive32ElementTraits : PrimitiveElementTraits, IBaseElementTraits { private static IBaseElementTraits int32Traits = null; @@ -750,7 +750,7 @@ abstract public class Primitive32ElementTraits : PrimitiveElementTraits, I } [EditorBrowsable(EditorBrowsableState.Never)] -abstract public class Primitive64ElementTraits : PrimitiveElementTraits, IBaseElementTraits +internal abstract class Primitive64ElementTraits : PrimitiveElementTraits, IBaseElementTraits { private static IBaseElementTraits int64Traits = null; @@ -789,7 +789,7 @@ abstract public class Primitive64ElementTraits : PrimitiveElementTraits, I } [EditorBrowsable(EditorBrowsableState.Never)] -public class IntElementTraits : Primitive32ElementTraits, IBaseElementTraits +internal class IntElementTraits : Primitive32ElementTraits, IBaseElementTraits { override public void ManagedToNativeCopyTo(int man, IntPtr mem) { @@ -814,7 +814,7 @@ public class IntElementTraits : Primitive32ElementTraits, IBaseElementTrait } [EditorBrowsable(EditorBrowsableState.Never)] -public class CharElementTraits : Primitive32ElementTraits, IBaseElementTraits +internal class CharElementTraits : Primitive32ElementTraits, IBaseElementTraits { override public void ManagedToNativeCopyTo(char man, IntPtr mem) { @@ -839,7 +839,7 @@ public class CharElementTraits : Primitive32ElementTraits, IBaseElementTra } [EditorBrowsable(EditorBrowsableState.Never)] -public class LongElementTraits : Primitive64ElementTraits, IBaseElementTraits +internal class LongElementTraits : Primitive64ElementTraits, IBaseElementTraits { override public void ManagedToNativeCopyTo(long man, IntPtr mem) { @@ -864,7 +864,7 @@ public class LongElementTraits : Primitive64ElementTraits, IBaseElementTra } [EditorBrowsable(EditorBrowsableState.Never)] -public class ShortElementTraits : Primitive32ElementTraits, IBaseElementTraits +internal class ShortElementTraits : Primitive32ElementTraits, IBaseElementTraits { override public void ManagedToNativeCopyTo(short man, IntPtr mem) { @@ -889,7 +889,7 @@ public class ShortElementTraits : Primitive32ElementTraits, IBaseElementT } [EditorBrowsable(EditorBrowsableState.Never)] -public class FloatElementTraits : Primitive32ElementTraits, IBaseElementTraits +internal class FloatElementTraits : Primitive32ElementTraits, IBaseElementTraits { override public void ManagedToNativeCopyTo(float man, IntPtr mem) { @@ -914,7 +914,7 @@ public class FloatElementTraits : Primitive32ElementTraits, IBaseElementT } [EditorBrowsable(EditorBrowsableState.Never)] -public class DoubleElementTraits : Primitive64ElementTraits, IBaseElementTraits +internal class DoubleElementTraits : Primitive64ElementTraits, IBaseElementTraits { override public void ManagedToNativeCopyTo(double man, IntPtr mem) { @@ -939,7 +939,7 @@ public class DoubleElementTraits : Primitive64ElementTraits, IBaseElemen } [EditorBrowsable(EditorBrowsableState.Never)] -public class ByteElementTraits : Primitive32ElementTraits, IBaseElementTraits +internal class ByteElementTraits : Primitive32ElementTraits, IBaseElementTraits { override public void ManagedToNativeCopyTo(byte man, IntPtr mem) { @@ -964,7 +964,7 @@ public class ByteElementTraits : Primitive32ElementTraits, IBaseElementTra } [EditorBrowsable(EditorBrowsableState.Never)] -public static class TraitFunctions +internal static class TraitFunctions { public static bool IsEflObject(System.Type type) { diff --git a/src/bindings/mono/eina_mono/eina_hash.cs b/src/bindings/mono/eina_mono/eina_hash.cs index 2e1d184ab8..3cc8980e7f 100644 --- a/src/bindings/mono/eina_mono/eina_hash.cs +++ b/src/bindings/mono/eina_mono/eina_hash.cs @@ -31,7 +31,7 @@ namespace Eina [StructLayout(LayoutKind.Sequential)] [EditorBrowsable(EditorBrowsableState.Never)] -public struct HashTupleNative : IEquatable +internal struct HashTupleNative : IEquatable { public IntPtr key; public IntPtr data; @@ -85,7 +85,7 @@ public struct HashTupleNative : IEquatable } [EditorBrowsable(EditorBrowsableState.Never)] -public static class HashNativeFunctions +internal static class HashNativeFunctions { [DllImport(efl.Libs.Eina)] internal static extern IntPtr eina_hash_new(IntPtr key_length_cb, IntPtr key_cmp_cb, IntPtr key_hash_cb, IntPtr data_free_cb, int buckets_power_size); diff --git a/src/bindings/mono/eina_mono/eina_inarray.cs b/src/bindings/mono/eina_mono/eina_inarray.cs index f341a54c3c..b88570833d 100644 --- a/src/bindings/mono/eina_mono/eina_inarray.cs +++ b/src/bindings/mono/eina_mono/eina_inarray.cs @@ -28,7 +28,7 @@ namespace Eina { [EditorBrowsable(EditorBrowsableState.Never)] -public static class InarrayNativeFunctions +internal static class InarrayNativeFunctions { [DllImport(efl.Libs.Eina)] internal static extern IntPtr eina_inarray_new(uint member_size, uint step); diff --git a/src/bindings/mono/eina_mono/eina_inlist.cs b/src/bindings/mono/eina_mono/eina_inlist.cs index f4c95e1887..cef686b469 100644 --- a/src/bindings/mono/eina_mono/eina_inlist.cs +++ b/src/bindings/mono/eina_mono/eina_inlist.cs @@ -29,7 +29,7 @@ namespace Eina { [EditorBrowsable(EditorBrowsableState.Never)] -public static class InlistNativeFunctions +internal static class InlistNativeFunctions { [DllImport(efl.Libs.Eina)] internal static extern IntPtr eina_inlist_append(IntPtr in_list, IntPtr in_item); diff --git a/src/bindings/mono/eina_mono/eina_iterator.cs b/src/bindings/mono/eina_mono/eina_iterator.cs index cf06b8c21f..f142c3cc0b 100644 --- a/src/bindings/mono/eina_mono/eina_iterator.cs +++ b/src/bindings/mono/eina_mono/eina_iterator.cs @@ -28,7 +28,7 @@ namespace Eina { [EditorBrowsable(EditorBrowsableState.Never)] -public static class IteratorNativeFunctions +internal static class IteratorNativeFunctions { [DllImport(efl.Libs.Eina)] internal static extern void eina_iterator_free(IntPtr iterator); diff --git a/src/bindings/mono/eina_mono/eina_list.cs b/src/bindings/mono/eina_mono/eina_list.cs index cdd49c7245..667b80834f 100644 --- a/src/bindings/mono/eina_mono/eina_list.cs +++ b/src/bindings/mono/eina_mono/eina_list.cs @@ -29,7 +29,7 @@ namespace Eina { [EditorBrowsable(EditorBrowsableState.Never)] -public static class ListNativeFunctions +internal static class ListNativeFunctions { [DllImport(efl.Libs.Eina)] internal static extern IntPtr eina_list_append(IntPtr list, IntPtr data); diff --git a/src/bindings/mono/eina_mono/eina_stringshare.cs b/src/bindings/mono/eina_mono/eina_stringshare.cs index cfef948dc4..58656fe8ca 100644 --- a/src/bindings/mono/eina_mono/eina_stringshare.cs +++ b/src/bindings/mono/eina_mono/eina_stringshare.cs @@ -25,7 +25,7 @@ namespace Eina // TODO: move all native functions to a "NativeMethods" class [EditorBrowsable(EditorBrowsableState.Never)] -public static partial class NativeMethods +internal static partial class NativeMethods { [DllImport(efl.Libs.Eina)] internal static extern IntPtr eina_stringshare_add(IntPtr str); From b3cc7d403b4a9f69f2ad8c4bbd37e482f34e6deb Mon Sep 17 00:00:00 2001 From: Felipe Magno de Almeida Date: Tue, 24 Dec 2019 07:26:33 +0900 Subject: [PATCH 25/27] eolian: inherit since information from struct and enum to field Summary: If a struct or enum field doesn't explicitly sets since information, then since is inherited from struct documentation if it is available. Reviewers: jptiz, Jaehyun_Cho, woohyun, q66 Reviewed By: q66 Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8359 Differential Revision: https://phab.enlightenment.org/D10948 --- src/lib/eolian/eo_parser.c | 4 ++++ src/tests/eolian/data/docs_ref.h | 18 ++++++++++++++---- src/tests/eolian/data/eo_docs.eo | 4 +++- src/tests/eolian/eolian_parsing.c | 3 ++- .../eolian_cxx_test_documentation.cc | 4 ++-- 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index 96de7a77ec..253e99e929 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c @@ -536,6 +536,8 @@ parse_struct(Eo_Lexer *ls, const char *name, Eina_Bool is_extern, qual_end: check_next(ls, ';'); FILL_DOC(ls, fdef, doc); + if (def->doc && fdef->doc && def->doc->since && !fdef->doc->since) + fdef->doc->since = eina_stringshare_ref (def->doc->since); } check_match(ls, '}', '{', bline, bcolumn); FILL_BASE(def->base, ls, line, column, TYPEDECL); @@ -656,6 +658,8 @@ parse_enum(Eo_Lexer *ls, const char *name, Eina_Bool is_extern, if (want_next) eo_lexer_get(ls); FILL_DOC(ls, fdef, doc); + if (def->doc && fdef->doc && def->doc->since && !fdef->doc->since) + fdef->doc->since = eina_stringshare_ref (def->doc->since); if (!want_next || ls->t.token == '}') break; } diff --git a/src/tests/eolian/data/docs_ref.h b/src/tests/eolian/data/docs_ref.h index 158b814ae0..a00fafb5a5 100644 --- a/src/tests/eolian/data/docs_ref.h +++ b/src/tests/eolian/data/docs_ref.h @@ -29,20 +29,30 @@ typedef Eo Eo_Docs; */ typedef struct _Foo { - int field1; /**< Field documentation. */ + int field1; /**< Field documentation. + * + * @since 1.66 */ float field2; - short field3; /**< Another field documentation. */ + short field3; /**< Another field documentation. + * + * @since 1.66 */ } Foo; /** Docs for enum Bar. + * + * @since 1.55 * * @ingroup Bar */ typedef enum { BAR_BLAH = 0, - BAR_FOO = 1, /**< Docs for foo. */ - BAR_BAR = 2 /**< Docs for bar. */ + BAR_FOO = 1, /**< Docs for foo. + * + * @since 1.55 */ + BAR_BAR = 2 /**< Docs for bar. + * + * @since 1.55 */ } Bar; /** diff --git a/src/tests/eolian/data/eo_docs.eo b/src/tests/eolian/data/eo_docs.eo index d42cdfcd95..8c62559d5a 100644 --- a/src/tests/eolian/data/eo_docs.eo +++ b/src/tests/eolian/data/eo_docs.eo @@ -19,7 +19,9 @@ struct Foo { } enum Bar { - [[Docs for enum Bar.]] + [[Docs for enum Bar. + @since 1.55 + ]] blah = 0, foo = 1, [[Docs for foo.]] bar = 2 [[Docs for bar.]] diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c index ac06f99eba..9d137dcec3 100644 --- a/src/tests/eolian/eolian_parsing.c +++ b/src/tests/eolian/eolian_parsing.c @@ -1150,7 +1150,8 @@ EFL_START_TEST(eolian_docs) fail_if(strcmp(eolian_documentation_summary_get(doc), "Docs for enum Bar.")); fail_if(eolian_documentation_description_get(doc)); - fail_if(eolian_documentation_since_get(doc)); + fail_if(strcmp(eolian_documentation_since_get(doc), + "1.55")); fail_if(!(efl = eolian_typedecl_enum_field_get(tdl, "blah"))); fail_if(eolian_typedecl_enum_field_documentation_get(efl)); diff --git a/src/tests/eolian_cxx/eolian_cxx_test_documentation.cc b/src/tests/eolian_cxx/eolian_cxx_test_documentation.cc index 961519d16e..eb683e3312 100644 --- a/src/tests/eolian_cxx/eolian_cxx_test_documentation.cc +++ b/src/tests/eolian_cxx/eolian_cxx_test_documentation.cc @@ -279,7 +279,7 @@ EFL_START_TEST(eolian_cxx_test_struct_docs) doc = field_iter->documentation; ck_assert_str_eq(doc.summary.c_str(), "Field documentation."); ck_assert_str_eq(doc.description.c_str(), ""); - ck_assert_str_eq(doc.since.c_str(), ""); + ck_assert_str_eq(doc.since.c_str(), "1.66"); field_iter++; @@ -293,7 +293,7 @@ EFL_START_TEST(eolian_cxx_test_struct_docs) doc = field_iter->documentation; ck_assert_str_eq(doc.summary.c_str(), "Another field documentation."); ck_assert_str_eq(doc.description.c_str(), ""); - ck_assert_str_eq(doc.since.c_str(), ""); + ck_assert_str_eq(doc.since.c_str(), "1.66"); } EFL_END_TEST From 9178166e233e0e4df8f53086b5283bcf25280cab Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Tue, 24 Dec 2019 00:22:37 +0000 Subject: [PATCH 26/27] ecore-x - fix fallbacks to use capital X in lib name thanks peter. fixes T8543 @fix --- src/lib/ecore_x/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/ecore_x/meson.build b/src/lib/ecore_x/meson.build index 957b11c44e..ba7d01f961 100644 --- a/src/lib/ecore_x/meson.build +++ b/src/lib/ecore_x/meson.build @@ -71,7 +71,7 @@ endif x11 = dependency('x11', required: false) if x11.found() == false - x11 = cc.find_library('x11', required: true) + x11 = cc.find_library('X11', required: true) endif xcb = dependency('xcb', required: false) @@ -81,7 +81,7 @@ endif x11_xcb = dependency('x11-xcb', required: false) if x11_xcb.found() == false - x11_xcb = cc.find_library('x11-xcb', required: true) + x11_xcb = cc.find_library('X11-xcb', required: true) endif foreach ecore_x_check : ecore_x_checks From 1a93a4c2ccc51ff8a7643facb387172c16813316 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Tue, 24 Dec 2019 10:54:04 +0900 Subject: [PATCH 27/27] evas_vg_cache: Prevent memory leak Summary: free hash_key pointer Test Plan: N/A Reviewers: Hermet, YOhoho Reviewed By: YOhoho Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10960 --- src/lib/evas/vg/evas_vg_cache.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/evas/vg/evas_vg_cache.c b/src/lib/evas/vg/evas_vg_cache.c index 90adcaf00d..c980046ff1 100644 --- a/src/lib/evas/vg/evas_vg_cache.c +++ b/src/lib/evas/vg/evas_vg_cache.c @@ -276,7 +276,11 @@ evas_cache_vg_surface_key_get(Efl_Canvas_Vg_Node *root, int w, int h, int frame_ Eina_Strbuf *hash_key = eina_strbuf_new(); eina_strbuf_append_printf(hash_key, "%p/%d/%d/%d", root, w, h, frame_idx); const char *new_key = eina_strbuf_string_get(hash_key); - if (!new_key) return NULL; + if (!new_key) + { + eina_strbuf_free(hash_key); + return NULL; + } Eina_List *l; char *key;