From 31ff76436c6ab3ddb6beb20afef1b13d6db5b026 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 28 Jan 2019 11:10:40 -0500 Subject: [PATCH] efl.text_markup: move cursor-related methods to efl.text_markup_interactive many users of the markup property are not interactive text cases, so splitting off the interactive methods resolves a number of unimplemented method issues ref T5719 Differential Revision: https://phab.enlightenment.org/D7787 --- src/Makefile_Efl.am | 1 + src/lib/edje/edje_part_invalid.c | 2 +- src/lib/edje/edje_part_text.c | 2 +- src/lib/edje/efl_canvas_layout_part_invalid.eo | 4 ++-- src/lib/edje/efl_canvas_layout_part_text.eo | 4 ++-- src/lib/efl/Efl.h | 1 + src/lib/efl/interfaces/efl_interfaces_main.c | 1 + src/lib/efl/interfaces/efl_text_markup.eo | 20 +--------------- .../efl/interfaces/efl_text_markup_interactive.eo | 27 ++++++++++++++++++++++ src/lib/efl/interfaces/meson.build | 1 + src/lib/elementary/efl_ui_text.c | 4 ++-- src/lib/evas/canvas/efl_canvas_text.eo | 6 ++--- src/lib/evas/canvas/evas_object_textblock.c | 4 ++-- src/tests/evas/evas_test_textblock.c | 4 ++-- 14 files changed, 47 insertions(+), 34 deletions(-) create mode 100644 src/lib/efl/interfaces/efl_text_markup_interactive.eo diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am index ada411a..475a5f1eb 100644 --- a/src/Makefile_Efl.am +++ b/src/Makefile_Efl.am @@ -34,6 +34,7 @@ efl_eolian_files = \ lib/efl/interfaces/efl_text_cursor.eo \ lib/efl/interfaces/efl_text_annotate.eo \ lib/efl/interfaces/efl_text_markup.eo \ + lib/efl/interfaces/efl_text_markup_interactive.eo \ lib/efl/interfaces/efl_text_markup_util.eo \ lib/efl/interfaces/efl_gfx_stack.eo \ lib/efl/interfaces/efl_gfx_view.eo \ diff --git a/src/lib/edje/edje_part_invalid.c b/src/lib/edje/edje_part_invalid.c index 469de82..3e508b3 100644 --- a/src/lib/edje/edje_part_invalid.c +++ b/src/lib/edje/edje_part_invalid.c @@ -71,7 +71,7 @@ EDJE_PART_INVALID_VOID(efl_text_cursor_line_jump_by, _efl_canvas_layout_part_inv EDJE_PART_INVALID_VOID(efl_text_cursor_copy, _efl_canvas_layout_part_invalid_efl_text_cursor_cursor_copy, Efl_Text_Cursor_Cursor *dst, const Efl_Text_Cursor_Cursor *src) EDJE_PART_INVALID_CONST(Eina_Unicode, 0, efl_text_cursor_content_get, _efl_canvas_layout_part_invalid_efl_text_cursor_cursor_content_get, const Efl_Text_Cursor_Cursor *cur) EDJE_PART_INVALID_CONST(Eina_Bool, 0, efl_text_cursor_geometry_get, _efl_canvas_layout_part_invalid_efl_text_cursor_cursor_geometry_get, const Efl_Text_Cursor_Cursor *cur, Efl_Text_Cursor_Type ctype, int *cx, int *cy, int *cw, int *ch, int *cx2, int *cy2, int *cw2, int *ch2) -EDJE_PART_INVALID_VOID(efl_text_markup_cursor_markup_insert, _efl_canvas_layout_part_invalid_efl_text_markup_cursor_markup_insert, Efl_Text_Cursor_Cursor *cur, const char *markup) +EDJE_PART_INVALID_VOID(efl_text_markup_interactive_cursor_markup_insert, _efl_canvas_layout_part_invalid_efl_text_markup_interactive_cursor_markup_insert, Efl_Text_Cursor_Cursor *cur, const char *markup) EDJE_PART_INVALID(Eina_Iterator *, 0, efl_content_iterate, _efl_canvas_layout_part_invalid_efl_container_content_iterate) EDJE_PART_INVALID(int, 0, efl_content_count, _efl_canvas_layout_part_invalid_efl_container_content_count) EDJE_PART_INVALID(Eina_Bool, 0, efl_content_remove, _efl_canvas_layout_part_invalid_efl_container_content_remove, Efl_Gfx_Entity *content) diff --git a/src/lib/edje/edje_part_text.c b/src/lib/edje/edje_part_text.c index c9b6981..6376453 100644 --- a/src/lib/edje/edje_part_text.c +++ b/src/lib/edje/edje_part_text.c @@ -195,7 +195,7 @@ _efl_canvas_layout_part_text_efl_text_cursor_cursor_geometry_get(const Eo *obj, } EOLIAN static void -_efl_canvas_layout_part_text_efl_text_markup_cursor_markup_insert(Eo *obj, +_efl_canvas_layout_part_text_efl_text_markup_interactive_cursor_markup_insert(Eo *obj, void *_pd EINA_UNUSED, Efl_Text_Cursor_Cursor *cur EINA_UNUSED, const char *text) { diff --git a/src/lib/edje/efl_canvas_layout_part_invalid.eo b/src/lib/edje/efl_canvas_layout_part_invalid.eo index 6c8f3fe..1dbef9f 100644 --- a/src/lib/edje/efl_canvas_layout_part_invalid.eo +++ b/src/lib/edje/efl_canvas_layout_part_invalid.eo @@ -1,7 +1,7 @@ class Efl.Canvas.Layout_Part_Invalid extends Efl.Canvas.Layout_Part implements Efl.Content, Efl.Pack_Linear, Efl.Ui.Direction_Readonly, Efl.Pack_Table, Efl.Text, - Efl.Text_Markup + Efl.Text_Markup, Efl.Text_Markup_Interactive { [[Common class for part proxy objects for @Efl.Canvas.Layout. @@ -31,6 +31,7 @@ class Efl.Canvas.Layout_Part_Invalid extends Efl.Canvas.Layout_Part implements E // Efl.Canvas.Layout_Part_Text Efl.Text.text { set; get; } Efl.Text_Markup.markup { get; set; } + Efl.Text_Markup_Interactive.cursor_markup_insert; Efl.Text_Cursor.text_cursor { get; } Efl.Text_Cursor.cursor_paragraph_first; Efl.Text_Cursor.cursor_paragraph_last; @@ -44,7 +45,6 @@ class Efl.Canvas.Layout_Part_Invalid extends Efl.Canvas.Layout_Part implements E Efl.Text_Cursor.cursor_copy; Efl.Text_Cursor.cursor_content { get; } Efl.Text_Cursor.cursor_geometry { get; } - Efl.Text_Markup.cursor_markup_insert; // Efl.Canvas.Layout_Part_Box Efl.Container.content_iterate; Efl.Container.content_count; diff --git a/src/lib/edje/efl_canvas_layout_part_text.eo b/src/lib/edje/efl_canvas_layout_part_text.eo index 0546118..b987c91 100644 --- a/src/lib/edje/efl_canvas_layout_part_text.eo +++ b/src/lib/edje/efl_canvas_layout_part_text.eo @@ -11,7 +11,7 @@ enum Efl.Canvas.Layout_Part_Text_Expand } class Efl.Canvas.Layout_Part_Text extends Efl.Canvas.Layout_Part implements Efl.Text, -Efl.Text_Markup, Efl.Text_Format, Efl.Text_Font, Efl.Text_Style +Efl.Text_Markup, Efl.Text_Markup_Interactive, Efl.Text_Format, Efl.Text_Font, Efl.Text_Style { [[Represents a TEXT part of a layout @@ -36,6 +36,7 @@ Efl.Text_Markup, Efl.Text_Format, Efl.Text_Font, Efl.Text_Style implements { Efl.Text.text { set; get; } Efl.Text_Markup.markup { get; set; } + Efl.Text_Markup_Interactive.cursor_markup_insert; Efl.Text_Cursor.text_cursor { get; } Efl.Text_Cursor.cursor_paragraph_first; Efl.Text_Cursor.cursor_paragraph_last; @@ -49,7 +50,6 @@ Efl.Text_Markup, Efl.Text_Format, Efl.Text_Font, Efl.Text_Style Efl.Text_Cursor.cursor_copy; Efl.Text_Cursor.cursor_content { get; } Efl.Text_Cursor.cursor_geometry { get; } - Efl.Text_Markup.cursor_markup_insert; Efl.Text_Format.ellipsis { set; get; } Efl.Text_Format.wrap { set; get; } Efl.Text_Font.font { set; get; } diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h index f4c7991..7daa52d 100644 --- a/src/lib/efl/Efl.h +++ b/src/lib/efl/Efl.h @@ -182,6 +182,7 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command; #include "interfaces/efl_text_cursor.eo.h" #include "interfaces/efl_text_annotate.eo.h" #include "interfaces/efl_text_markup.eo.h" +#include "interfaces/efl_text_markup_interactive.eo.h" #include "interfaces/efl_text_markup_util.eo.h" EAPI void efl_observable_tuple_free(Efl_Observable_Tuple *tuple); diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c index 3e6f983..4e2490a 100644 --- a/src/lib/efl/interfaces/efl_interfaces_main.c +++ b/src/lib/efl/interfaces/efl_interfaces_main.c @@ -27,6 +27,7 @@ #include "interfaces/efl_text_cursor.eo.c" #include "interfaces/efl_text_annotate.eo.c" #include "interfaces/efl_text_markup.eo.c" +#include "interfaces/efl_text_markup_interactive.eo.c" #include "interfaces/efl_gfx_entity.eo.c" #include "interfaces/efl_gfx_buffer.eo.c" diff --git a/src/lib/efl/interfaces/efl_text_markup.eo b/src/lib/efl/interfaces/efl_text_markup.eo index 97de567..7d69684 100644 --- a/src/lib/efl/interfaces/efl_text_markup.eo +++ b/src/lib/efl/interfaces/efl_text_markup.eo @@ -1,4 +1,4 @@ -interface Efl.Text_Markup extends Efl.Text_Cursor { +interface Efl.Text_Markup { [[Markup data that populates the text object's style and format @since 1.21 @@ -10,24 +10,6 @@ interface Efl.Text_Markup extends Efl.Text_Cursor { markup: string; [[The markup-text representation set to this text.]] } } - @property markup_range { - [[Markup of a given range in the text]] - values { - markup: mstring @owned; [[The markup-text representation set to - this text of a given range]] - } - keys { - start: ptr(Efl.Text_Cursor_Cursor); - end: ptr(Efl.Text_Cursor_Cursor); - } - } - cursor_markup_insert { - [[Inserts a markup text to the text object in a given cursor position]] - params { - cur: ptr(Efl.Text_Cursor_Cursor); [[Cursor position to insert markup]] - @in markup: string; [[The markup text to insert]] - } - } } } diff --git a/src/lib/efl/interfaces/efl_text_markup_interactive.eo b/src/lib/efl/interfaces/efl_text_markup_interactive.eo new file mode 100644 index 0000000..4906d59 --- /dev/null +++ b/src/lib/efl/interfaces/efl_text_markup_interactive.eo @@ -0,0 +1,27 @@ +interface Efl.Text_Markup_Interactive extends Efl.Text_Cursor { + [[Markup data that populates the text object's style and format + + @since 1.22 + ]] + methods { + @property markup_range { + [[Markup of a given range in the text]] + values { + markup: mstring @owned; [[The markup-text representation set to + this text of a given range]] + } + keys { + start: ptr(Efl.Text_Cursor_Cursor); + end: ptr(Efl.Text_Cursor_Cursor); + } + } + cursor_markup_insert { + [[Inserts a markup text to the text object in a given cursor position]] + params { + cur: ptr(Efl.Text_Cursor_Cursor); [[Cursor position to insert markup]] + @in markup: string; [[The markup text to insert]] + } + } + } +} + diff --git a/src/lib/efl/interfaces/meson.build b/src/lib/efl/interfaces/meson.build index e325bdc..61d91fb 100644 --- a/src/lib/efl/interfaces/meson.build +++ b/src/lib/efl/interfaces/meson.build @@ -59,6 +59,7 @@ pub_eo_files = [ 'efl_text_cursor.eo', 'efl_text_annotate.eo', 'efl_text_markup.eo', + 'efl_text_markup_interactive.eo', 'efl_text_markup_util.eo', 'efl_gfx_stack.eo', 'efl_gfx_view.eo', diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c index 000ba0e..c134351 100644 --- a/src/lib/elementary/efl_ui_text.c +++ b/src/lib/elementary/efl_ui_text.c @@ -610,7 +610,7 @@ _selection_data_cb(void *data EINA_UNUSED, Eo *obj, cur = efl_text_cursor_get(obj, EFL_TEXT_CURSOR_GET_MAIN); if (sel_data->format == EFL_UI_SELECTION_FORMAT_MARKUP) { - efl_text_markup_cursor_markup_insert(obj, cur, buf); + efl_text_markup_interactive_cursor_markup_insert(obj, cur, buf); } else // TEXT { @@ -1161,7 +1161,7 @@ _selection_store(Efl_Ui_Selection_Type seltype, EFL_UI_TEXT_DATA_GET(obj, sd); efl_text_interactive_selection_cursors_get(obj, &start, &end); - sel = efl_text_markup_range_get(obj, start, end); + sel = efl_text_markup_interactive_markup_range_get(obj, start, end); if ((!sel) || (!sel[0])) return; /* avoid deleting our own selection */ diff --git a/src/lib/evas/canvas/efl_canvas_text.eo b/src/lib/evas/canvas/efl_canvas_text.eo index 9e569a6..644b1c4 100644 --- a/src/lib/evas/canvas/efl_canvas_text.eo +++ b/src/lib/evas/canvas/efl_canvas_text.eo @@ -5,7 +5,7 @@ struct Efl.Canvas.Text_Style; [[EFL text style data structure]] class Efl.Canvas.Text extends Efl.Canvas.Object implements Efl.Text, Efl.Canvas.Filter.Internal, Efl.Text_Font, Efl.Text_Style, Efl.Text_Format, Efl.Text_Cursor, - Efl.Text_Annotate, Efl.Text_Markup, Efl.Ui.I18n + Efl.Text_Annotate, Efl.Text_Markup, Efl.Text_Markup_Interactive, Efl.Ui.I18n { [[Efl canvas text class]] legacy_prefix: evas_object_textblock; @@ -353,8 +353,8 @@ class Efl.Canvas.Text extends Efl.Canvas.Object implements Efl.Text, Efl.Text_Annotate.cursor_item_annotation { get; } Efl.Text_Annotate.cursor_item_insert; Efl.Text_Markup.markup { set; get; } - Efl.Text_Markup.cursor_markup_insert; - Efl.Text_Markup.markup_range { get;} + Efl.Text_Markup_Interactive.cursor_markup_insert; + Efl.Text_Markup_Interactive.markup_range { get;} Efl.Gfx.Entity.scale { set; } } events { diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index 8958b25..2f6a8f9 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -8138,7 +8138,7 @@ evas_object_textblock_text_markup_prepend(Efl_Text_Cursor_Cursor *cur, const cha } EOLIAN static void -_efl_canvas_text_efl_text_markup_cursor_markup_insert(Eo *eo_obj, +_efl_canvas_text_efl_text_markup_interactive_cursor_markup_insert(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur, const char *markup) { @@ -12072,7 +12072,7 @@ _evas_textblock_cursor_range_text_markup_get(const Efl_Text_Cursor_Cursor *cur1, } EOLIAN char * -_efl_canvas_text_efl_text_markup_markup_range_get(const Eo *eo_obj, +_efl_canvas_text_efl_text_markup_interactive_markup_range_get(const Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *start, Efl_Text_Cursor_Cursor *end) { diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c index 776713c..b82e7e4 100644 --- a/src/tests/evas/evas_test_textblock.c +++ b/src/tests/evas/evas_test_textblock.c @@ -4632,14 +4632,14 @@ EFL_START_TEST(efl_canvas_text_markup) efl_text_cursor_position_set(txt, start, 1); efl_text_cursor_position_set(txt, end, 2); - res = efl_text_markup_range_get(txt, start, end); + res = efl_text_markup_interactive_markup_range_get(txt, start, end); ck_assert_str_eq(res, "
"); free(res); efl_text_set(txt, "a\u2029bc\ndef\n\u2029"); efl_text_cursor_position_set(txt, start, 2); efl_text_cursor_position_set(txt, end, 5); - res = efl_text_markup_range_get(txt, start, end); + res = efl_text_markup_interactive_markup_range_get(txt, start, end); ck_assert_str_eq(res, "bc
"); free(res); -- 2.7.4