Changeset View
Changeset View
Standalone View
Standalone View
src/lib/evas/canvas/evas_object_textblock.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Line(s) | |||||
65 | #define EFL_CANVAS_FILTER_INTERNAL_PROTECTED | 65 | #define EFL_CANVAS_FILTER_INTERNAL_PROTECTED | ||
66 | 66 | | |||
67 | #include "evas_common_private.h" | 67 | #include "evas_common_private.h" | ||
68 | #include "evas_private.h" | 68 | #include "evas_private.h" | ||
69 | 69 | | |||
70 | //#define LYDBG(f, args...) printf(f, ##args) | 70 | //#define LYDBG(f, args...) printf(f, ##args) | ||
71 | #define LYDBG(f, args...) | 71 | #define LYDBG(f, args...) | ||
72 | 72 | | |||
73 | #define MY_CLASS EFL_CANVAS_TEXT_CLASS | 73 | #define MY_CLASS EFL_CANVAS_TEXT_CANVAS_CLASS | ||
74 | 74 | | |||
75 | #define MY_CLASS_NAME "Efl Canvas Text" | 75 | #define MY_CLASS_NAME "Efl Canvas Text" | ||
76 | 76 | | |||
77 | #include "linebreak.h" | 77 | #include "linebreak.h" | ||
78 | #include "wordbreak.h" | 78 | #include "wordbreak.h" | ||
79 | #include "graphemebreak.h" | 79 | #include "graphemebreak.h" | ||
80 | 80 | | |||
81 | #include "evas_filter.h" | 81 | #include "evas_filter.h" | ||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | |||||
138 | 138 | | |||
139 | // testing out some macros to maybe add to eina | 139 | // testing out some macros to maybe add to eina | ||
140 | #define EINA_INLIST_REMOVE(l,i) do { l = (__typeof__(l)) eina_inlist_remove(EINA_INLIST_GET(l), EINA_INLIST_GET(i)); } while (0) | 140 | #define EINA_INLIST_REMOVE(l,i) do { l = (__typeof__(l)) eina_inlist_remove(EINA_INLIST_GET(l), EINA_INLIST_GET(i)); } while (0) | ||
141 | #define EINA_INLIST_APPEND(l,i) do { l = (__typeof__(l)) eina_inlist_append(EINA_INLIST_GET(l), EINA_INLIST_GET(i)); } while (0) | 141 | #define EINA_INLIST_APPEND(l,i) do { l = (__typeof__(l)) eina_inlist_append(EINA_INLIST_GET(l), EINA_INLIST_GET(i)); } while (0) | ||
142 | 142 | | |||
143 | /* private struct for textblock object internal data */ | 143 | /* private struct for textblock object internal data */ | ||
144 | /** | 144 | /** | ||
145 | * @internal | 145 | * @internal | ||
146 | * @typedef Efl_Canvas_Text_Data | 146 | * @typedef Efl_Canvas_Text_Canvas_Data | ||
147 | * The actual textblock object. | 147 | * The actual textblock object. | ||
148 | */ | 148 | */ | ||
149 | typedef struct _Evas_Object_Textblock Efl_Canvas_Text_Data; | 149 | typedef struct _Evas_Object_Textblock Efl_Canvas_Text_Canvas_Data; | ||
150 | /** | 150 | /** | ||
151 | * @internal | 151 | * @internal | ||
152 | * @typedef Evas_Object_Style_Tag | 152 | * @typedef Evas_Object_Style_Tag | ||
153 | * The structure used for finding style tags. | 153 | * The structure used for finding style tags. | ||
154 | */ | 154 | */ | ||
155 | typedef struct _Evas_Object_Style_Tag Evas_Object_Style_Tag; | 155 | typedef struct _Evas_Object_Style_Tag Evas_Object_Style_Tag; | ||
156 | /** | 156 | /** | ||
157 | * @internal | 157 | * @internal | ||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | |||||
216 | /** | 216 | /** | ||
217 | * @internal | 217 | * @internal | ||
218 | * @typedef Efl_Text_Annotate_Annotation_Iterator | 218 | * @typedef Efl_Text_Annotate_Annotation_Iterator | ||
219 | * A textblock annotation iterator. | 219 | * A textblock annotation iterator. | ||
220 | */ | 220 | */ | ||
221 | typedef struct _Efl_Text_Annotate_Annotation_Iterator Efl_Text_Annotate_Annotation_Iterator; | 221 | typedef struct _Efl_Text_Annotate_Annotation_Iterator Efl_Text_Annotate_Annotation_Iterator; | ||
222 | /** | 222 | /** | ||
223 | * @internal | 223 | * @internal | ||
224 | * @typedef Efl_Canvas_Text_Filter | 224 | * @typedef Efl_Canvas_Text_Canvas_Filter | ||
225 | * A structure holding gfx filter information for a text item | 225 | * A structure holding gfx filter information for a text item | ||
226 | */ | 226 | */ | ||
227 | typedef struct _Efl_Canvas_Text_Filter Efl_Canvas_Text_Filter; | 227 | typedef struct _Efl_Canvas_Text_Canvas_Filter Efl_Canvas_Text_Canvas_Filter; | ||
228 | /** | 228 | /** | ||
229 | * @internal | 229 | * @internal | ||
230 | * @typedef Efl_Canvas_Text_Filter_Post_Render | 230 | * @typedef Efl_Canvas_Text_Canvas_Filter_Post_Render | ||
231 | * Post-render data for async rendering of gfx filters | 231 | * Post-render data for async rendering of gfx filters | ||
232 | */ | 232 | */ | ||
233 | typedef struct _Efl_Canvas_Text_Filter_Post_Render Efl_Canvas_Text_Filter_Post_Render; | 233 | typedef struct _Efl_Canvas_Text_Canvas_Filter_Post_Render Efl_Canvas_Text_Canvas_Filter_Post_Render; | ||
234 | /** | 234 | /** | ||
235 | * @internal | 235 | * @internal | ||
236 | * @typedef Efl_Canvas_Text_Filter_Program | 236 | * @typedef Efl_Canvas_Text_Canvas_Filter_Program | ||
237 | * Filter name - code database | 237 | * Filter name - code database | ||
238 | */ | 238 | */ | ||
239 | typedef struct _Efl_Canvas_Text_Filter_Program Efl_Canvas_Text_Filter_Program; | 239 | typedef struct _Efl_Canvas_Text_Canvas_Filter_Program Efl_Canvas_Text_Canvas_Filter_Program; | ||
240 | /** | 240 | /** | ||
241 | * @internal | 241 | * @internal | ||
242 | * @typedef Text_Item_Filter | 242 | * @typedef Text_Item_Filter | ||
243 | * Text item filter properties (run context, output buffer, ...) | 243 | * Text item filter properties (run context, output buffer, ...) | ||
244 | */ | 244 | */ | ||
245 | typedef struct _Text_Item_Filter Text_Item_Filter; | 245 | typedef struct _Text_Item_Filter Text_Item_Filter; | ||
246 | /** | 246 | /** | ||
247 | * @internal | 247 | * @internal | ||
▲ Show 20 Lines • Show All 215 Lines • ▼ Show 20 Line(s) | 458 | { | |||
463 | unsigned char vsize : 2; /**< VSIZE_FULL or VSIZE_ASCENT */ | 463 | unsigned char vsize : 2; /**< VSIZE_FULL or VSIZE_ASCENT */ | ||
464 | unsigned char size : 2; /**< SIZE, SIZE_ABS or SIZE_REL*/ | 464 | unsigned char size : 2; /**< SIZE, SIZE_ABS or SIZE_REL*/ | ||
465 | Eina_Bool formatme : 1; /**< EINA_TRUE if format required, else EINA_FALSE */ | 465 | Eina_Bool formatme : 1; /**< EINA_TRUE if format required, else EINA_FALSE */ | ||
466 | }; | 466 | }; | ||
467 | 467 | | |||
468 | struct _Text_Item_Filter | 468 | struct _Text_Item_Filter | ||
469 | { | 469 | { | ||
470 | EINA_INLIST; /**< list on the tb object */ | 470 | EINA_INLIST; /**< list on the tb object */ | ||
471 | Efl_Canvas_Text_Data *textblock; | 471 | Efl_Canvas_Text_Canvas_Data *textblock; | ||
472 | Evas_Object_Textblock_Text_Item *ti; /**< associated text item. if null, it was deleted */ | 472 | Evas_Object_Textblock_Text_Item *ti; /**< associated text item. if null, it was deleted */ | ||
473 | Evas_Filter_Context *ctx; /**< running context for the filter */ | 473 | Evas_Filter_Context *ctx; /**< running context for the filter */ | ||
474 | Evas_Public_Data *evas; /**< evas instance */ | 474 | Evas_Public_Data *evas; /**< evas instance */ | ||
475 | void *output; /**< output rgba buffer for this text item (engine image) */ | 475 | void *output; /**< output rgba buffer for this text item (engine image) */ | ||
476 | Eina_Bool do_async; /**< do_async flag when running the filter */ | 476 | Eina_Bool do_async; /**< do_async flag when running the filter */ | ||
477 | }; | 477 | }; | ||
478 | 478 | | |||
479 | struct _Efl_Canvas_Text_Filter | 479 | struct _Efl_Canvas_Text_Canvas_Filter | ||
480 | { | 480 | { | ||
481 | Eina_Stringshare *name; | 481 | Eina_Stringshare *name; | ||
482 | Evas_Object *eo_obj; | 482 | Evas_Object *eo_obj; | ||
483 | Evas_Public_Data *evas; | 483 | Evas_Public_Data *evas; | ||
484 | void *dc; /* draw context - no clip, white, no colmul... */ | 484 | void *dc; /* draw context - no clip, white, no colmul... */ | ||
485 | Evas_Filter_Padding pad; | 485 | Evas_Filter_Padding pad; | ||
486 | Eina_Bool invalid; | 486 | Eina_Bool invalid; | ||
487 | Eina_Bool redraw; | 487 | Eina_Bool redraw; | ||
488 | }; | 488 | }; | ||
489 | 489 | | |||
490 | struct _Efl_Canvas_Text_Filter_Post_Render | 490 | struct _Efl_Canvas_Text_Canvas_Filter_Post_Render | ||
491 | { | 491 | { | ||
492 | Evas_Filter_Context *ctx; | 492 | Evas_Filter_Context *ctx; | ||
493 | Eina_Bool success; | 493 | Eina_Bool success; | ||
494 | }; | 494 | }; | ||
495 | 495 | | |||
496 | struct _Efl_Canvas_Text_Filter_Program | 496 | struct _Efl_Canvas_Text_Canvas_Filter_Program | ||
497 | { | 497 | { | ||
498 | EINA_INLIST; | 498 | EINA_INLIST; | ||
499 | Eina_Stringshare *name; | 499 | Eina_Stringshare *name; | ||
500 | Eina_Stringshare *code; | 500 | Eina_Stringshare *code; | ||
501 | Evas_Filter_Program *pgm; | 501 | Evas_Filter_Program *pgm; | ||
502 | Eina_Bool changed; | 502 | Eina_Bool changed; | ||
503 | }; | 503 | }; | ||
504 | 504 | | |||
Show All 13 Lines | 517 | struct { | |||
518 | struct { | 518 | struct { | ||
519 | unsigned char r, g, b, a; | 519 | unsigned char r, g, b, a; | ||
520 | } normal, underline, underline2, underline_dash, outline, shadow, glow, glow2, backing, | 520 | } normal, underline, underline2, underline_dash, outline, shadow, glow, glow2, backing, | ||
521 | strikethrough; | 521 | strikethrough; | ||
522 | } color; | 522 | } color; | ||
523 | struct { | 523 | struct { | ||
524 | int l, r; | 524 | int l, r; | ||
525 | } margin; /**< Left and right margin width. */ | 525 | } margin; /**< Left and right margin width. */ | ||
526 | Efl_Canvas_Text_Filter *gfx_filter; /**< Gfx Filter to apply to the children text items */ | 526 | Efl_Canvas_Text_Canvas_Filter *gfx_filter; /**< Gfx Filter to apply to the children text items */ | ||
527 | int ref; /**< Value of the ref. */ | 527 | int ref; /**< Value of the ref. */ | ||
528 | int tabstops; /**< Value of the size of the tab character. */ | 528 | int tabstops; /**< Value of the size of the tab character. */ | ||
529 | int linesize; /**< Value of the size of the line of the text. */ | 529 | int linesize; /**< Value of the size of the line of the text. */ | ||
530 | int linegap; /**< Value to set the line gap in text. */ | 530 | int linegap; /**< Value to set the line gap in text. */ | ||
531 | int underline_dash_width; /**< Valule to set the width of the underline dash. */ | 531 | int underline_dash_width; /**< Valule to set the width of the underline dash. */ | ||
532 | int underline_dash_gap; /**< Value to set the gap of the underline dash. */ | 532 | int underline_dash_gap; /**< Value to set the gap of the underline dash. */ | ||
533 | double underline_height; /**< Value to set the height of the single underline. */ | 533 | double underline_height; /**< Value to set the height of the single underline. */ | ||
534 | double linerelsize; /**< Value to set the size of line of text. */ | 534 | double linerelsize; /**< Value to set the size of line of text. */ | ||
Show All 9 Lines | |||||
544 | Eina_Bool underline2 : 1; /**< EINA_TRUE if two lines under the text, else EINA_FALSE */ | 544 | Eina_Bool underline2 : 1; /**< EINA_TRUE if two lines under the text, else EINA_FALSE */ | ||
545 | Eina_Bool underline_dash : 1; /**< EINA_TRUE if a dashed line under the text, else EINA_FALSE */ | 545 | Eina_Bool underline_dash : 1; /**< EINA_TRUE if a dashed line under the text, else EINA_FALSE */ | ||
546 | Eina_Bool strikethrough : 1; /**< EINA_TRUE if text should be stricked off, else EINA_FALSE */ | 546 | Eina_Bool strikethrough : 1; /**< EINA_TRUE if text should be stricked off, else EINA_FALSE */ | ||
547 | Eina_Bool backing : 1; /**< EINA_TRUE if enable background color, else EINA_FALSE */ | 547 | Eina_Bool backing : 1; /**< EINA_TRUE if enable background color, else EINA_FALSE */ | ||
548 | Eina_Bool password : 1; /**< EINA_TRUE if the text is password, else EINA_FALSE */ | 548 | Eina_Bool password : 1; /**< EINA_TRUE if the text is password, else EINA_FALSE */ | ||
549 | Evas_Textblock_Align_Auto halign_auto : 2; /**< Auto horizontal align mode */ | 549 | Evas_Textblock_Align_Auto halign_auto : 2; /**< Auto horizontal align mode */ | ||
550 | }; | 550 | }; | ||
551 | 551 | | |||
552 | struct _Efl_Canvas_Text_Style | 552 | struct _Efl_Canvas_Text_Canvas_Style | ||
553 | { | 553 | { | ||
554 | const char *style_text; | 554 | const char *style_text; | ||
555 | const char *default_tag; | 555 | const char *default_tag; | ||
556 | Evas_Object_Style_Tag *tags; | 556 | Evas_Object_Style_Tag *tags; | ||
557 | Eina_List *objects; | 557 | Eina_List *objects; | ||
558 | Eina_Bool delete_me : 1; | 558 | Eina_Bool delete_me : 1; | ||
559 | Eina_Bool legacy : 1; | 559 | Eina_Bool legacy : 1; | ||
560 | }; | 560 | }; | ||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Line(s) | 599 | { | |||
645 | const char *repch; | 645 | const char *repch; | ||
646 | const char *bidi_delimiters; | 646 | const char *bidi_delimiters; | ||
647 | Evas_BiDi_Direction paragraph_direction : 2; | 647 | Evas_BiDi_Direction paragraph_direction : 2; | ||
648 | struct { | 648 | struct { | ||
649 | int w, h, oneline_h; | 649 | int w, h, oneline_h; | ||
650 | Eina_Bool valid : 1; | 650 | Eina_Bool valid : 1; | ||
651 | } formatted, native; | 651 | } formatted, native; | ||
652 | struct { | 652 | struct { | ||
653 | Efl_Canvas_Text_Filter_Program *programs; | 653 | Efl_Canvas_Text_Canvas_Filter_Program *programs; | ||
654 | Evas_Filter_Data_Binding *data_bindings; | 654 | Evas_Filter_Data_Binding *data_bindings; | ||
655 | Eina_Hash *sources; | 655 | Eina_Hash *sources; | ||
656 | Text_Item_Filter *text_items; // inlist | 656 | Text_Item_Filter *text_items; // inlist | ||
657 | } gfx_filter; | 657 | } gfx_filter; | ||
658 | Eina_Bool redraw : 1; | 658 | Eina_Bool redraw : 1; | ||
659 | Eina_Bool changed : 1; | 659 | Eina_Bool changed : 1; | ||
660 | Eina_Bool obstacle_changed : 1; | 660 | Eina_Bool obstacle_changed : 1; | ||
661 | Eina_Bool content_changed : 1; | 661 | Eina_Bool content_changed : 1; | ||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Line(s) | |||||
735 | }; | 735 | }; | ||
736 | 736 | | |||
737 | /* the actual api call to add a textblock */ | 737 | /* the actual api call to add a textblock */ | ||
738 | 738 | | |||
739 | #define TB_HEAD() \ | 739 | #define TB_HEAD() \ | ||
740 | MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); \ | 740 | MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); \ | ||
741 | return; \ | 741 | return; \ | ||
742 | MAGIC_CHECK_END(); \ | 742 | MAGIC_CHECK_END(); \ | ||
743 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 743 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
744 | 744 | | |||
745 | #define TB_HEAD_RETURN(x) \ | 745 | #define TB_HEAD_RETURN(x) \ | ||
746 | MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); \ | 746 | MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); \ | ||
747 | return (x); \ | 747 | return (x); \ | ||
748 | MAGIC_CHECK_END(); | 748 | MAGIC_CHECK_END(); | ||
749 | static Eina_Bool _evas_textblock_cursor_is_at_the_end(const Efl_Text_Cursor_Cursor *cur); | 749 | static Eina_Bool _evas_textblock_cursor_is_at_the_end(const Efl_Text_Cursor_Cursor *cur); | ||
750 | static void _evas_textblock_node_text_remove(Efl_Canvas_Text_Data *o, Evas_Object_Textblock_Node_Text *n); | 750 | static void _evas_textblock_node_text_remove(Efl_Canvas_Text_Canvas_Data *o, Evas_Object_Textblock_Node_Text *n); | ||
751 | static Evas_Object_Textblock_Node_Format *_evas_textblock_cursor_node_format_before_or_at_pos_get(const Efl_Text_Cursor_Cursor *cur); | 751 | static Evas_Object_Textblock_Node_Format *_evas_textblock_cursor_node_format_before_or_at_pos_get(const Efl_Text_Cursor_Cursor *cur); | ||
752 | static size_t _evas_textblock_node_format_pos_get(const Evas_Object_Textblock_Node_Format *fmt); | 752 | static size_t _evas_textblock_node_format_pos_get(const Evas_Object_Textblock_Node_Format *fmt); | ||
753 | static void _evas_textblock_node_format_remove(Efl_Canvas_Text_Data *o, Evas_Object_Textblock_Node_Format *n, int visual_adjustment); | 753 | static void _evas_textblock_node_format_remove(Efl_Canvas_Text_Canvas_Data *o, Evas_Object_Textblock_Node_Format *n, int visual_adjustment); | ||
754 | static void _evas_textblock_node_format_free(Efl_Canvas_Text_Data *o, Evas_Object_Textblock_Node_Format *n); | 754 | static void _evas_textblock_node_format_free(Efl_Canvas_Text_Canvas_Data *o, Evas_Object_Textblock_Node_Format *n); | ||
755 | static void _evas_textblock_node_text_free(Evas_Object_Textblock_Node_Text *n); | 755 | static void _evas_textblock_node_text_free(Evas_Object_Textblock_Node_Text *n); | ||
756 | static void _evas_textblock_changed(Efl_Canvas_Text_Data *o, Evas_Object *eo_obj); | 756 | static void _evas_textblock_changed(Efl_Canvas_Text_Canvas_Data *o, Evas_Object *eo_obj); | ||
757 | static void _evas_textblock_invalidate_all(Efl_Canvas_Text_Data *o); | 757 | static void _evas_textblock_invalidate_all(Efl_Canvas_Text_Canvas_Data *o); | ||
758 | static void _evas_textblock_cursors_update_offset(const Efl_Text_Cursor_Cursor *cur, const Evas_Object_Textblock_Node_Text *n, size_t start, int offset); | 758 | static void _evas_textblock_cursors_update_offset(const Efl_Text_Cursor_Cursor *cur, const Evas_Object_Textblock_Node_Text *n, size_t start, int offset); | ||
759 | static void _evas_textblock_cursors_set_node(Efl_Canvas_Text_Data *o, const Evas_Object_Textblock_Node_Text *n, Evas_Object_Textblock_Node_Text *new_node); | 759 | static void _evas_textblock_cursors_set_node(Efl_Canvas_Text_Canvas_Data *o, const Evas_Object_Textblock_Node_Text *n, Evas_Object_Textblock_Node_Text *new_node); | ||
760 | static void _evas_textblock_annotations_clear(Efl_Canvas_Text_Data *o); | 760 | static void _evas_textblock_annotations_clear(Efl_Canvas_Text_Canvas_Data *o); | ||
761 | static void _evas_textblock_annotation_remove(Efl_Canvas_Text_Data *o, Efl_Text_Annotate_Annotation *an, Eina_Bool remove_nodes); | 761 | static void _evas_textblock_annotation_remove(Efl_Canvas_Text_Canvas_Data *o, Efl_Text_Annotate_Annotation *an, Eina_Bool remove_nodes); | ||
762 | 762 | | |||
763 | static Eina_Bool _evas_textblock_cursor_format_is_visible_get(const Efl_Text_Cursor_Cursor *cur); | 763 | static Eina_Bool _evas_textblock_cursor_format_is_visible_get(const Efl_Text_Cursor_Cursor *cur); | ||
764 | static void _evas_textblock_cursor_at_format_set(Efl_Text_Cursor_Cursor *cur, const Evas_Object_Textblock_Node_Format *fmt); | 764 | static void _evas_textblock_cursor_at_format_set(Efl_Text_Cursor_Cursor *cur, const Evas_Object_Textblock_Node_Format *fmt); | ||
765 | static void _evas_textblock_cursor_init(Efl_Text_Cursor_Cursor *cur, const Evas_Object *tb); | 765 | static void _evas_textblock_cursor_init(Efl_Text_Cursor_Cursor *cur, const Evas_Object *tb); | ||
766 | static Evas_Filter_Program *_format_filter_program_get(Efl_Canvas_Text_Data *o, Evas_Object_Textblock_Format *fmt); | 766 | static Evas_Filter_Program *_format_filter_program_get(Efl_Canvas_Text_Canvas_Data *o, Evas_Object_Textblock_Format *fmt); | ||
767 | static const char *_textblock_format_node_from_style_tag(Efl_Canvas_Text_Data *o, Evas_Object_Textblock_Node_Format *fnode, const char *format, size_t format_len); | 767 | static const char *_textblock_format_node_from_style_tag(Efl_Canvas_Text_Canvas_Data *o, Evas_Object_Textblock_Node_Format *fnode, const char *format, size_t format_len); | ||
768 | #ifdef HAVE_HYPHEN | 768 | #ifdef HAVE_HYPHEN | ||
769 | /* Hyphenation */ | 769 | /* Hyphenation */ | ||
770 | #include "evas_textblock_hyphenation.x" | 770 | #include "evas_textblock_hyphenation.x" | ||
771 | #endif | 771 | #endif | ||
772 | 772 | | |||
773 | static int _efl_canvas_text_cursor_text_append(Efl_Text_Cursor_Cursor *cur, const char *text); | 773 | static int _efl_canvas_text_canvas_cursor_text_append(Efl_Text_Cursor_Cursor *cur, const char *text); | ||
774 | static Eina_Bool _evas_textblock_cursor_format_append(Efl_Text_Cursor_Cursor *cur, const char *format, Evas_Object_Textblock_Node_Format **_fnode, Eina_Bool is_item); | 774 | static Eina_Bool _evas_textblock_cursor_format_append(Efl_Text_Cursor_Cursor *cur, const char *format, Evas_Object_Textblock_Node_Format **_fnode, Eina_Bool is_item); | ||
775 | EAPI Eina_Bool evas_textblock_cursor_eol_get(const Evas_Textblock_Cursor *cur); | 775 | EAPI Eina_Bool evas_textblock_cursor_eol_get(const Evas_Textblock_Cursor *cur); | ||
776 | static void _evas_textblock_cursor_init(Efl_Text_Cursor_Cursor *cur, const Evas_Object *tb); | 776 | static void _evas_textblock_cursor_init(Efl_Text_Cursor_Cursor *cur, const Evas_Object *tb); | ||
777 | static Eina_Bool _evas_textblock_cursor_format_is_visible_get(const Efl_Text_Cursor_Cursor *cur); | 777 | static Eina_Bool _evas_textblock_cursor_format_is_visible_get(const Efl_Text_Cursor_Cursor *cur); | ||
778 | static void _find_layout_item_line_match(Evas_Object *eo_obj, Evas_Object_Textblock_Node_Text *n, size_t pos, Evas_Object_Textblock_Line **lnr, Evas_Object_Textblock_Item **itr); | 778 | static void _find_layout_item_line_match(Evas_Object *eo_obj, Evas_Object_Textblock_Node_Text *n, size_t pos, Evas_Object_Textblock_Line **lnr, Evas_Object_Textblock_Item **itr); | ||
779 | static Evas_Object_Textblock_Node_Format *_evas_textblock_cursor_node_format_at_pos_get(const Efl_Text_Cursor_Cursor *cur); | 779 | static Evas_Object_Textblock_Node_Format *_evas_textblock_cursor_node_format_at_pos_get(const Efl_Text_Cursor_Cursor *cur); | ||
780 | static int _evas_textblock_cursor_text_prepend(Efl_Text_Cursor_Cursor *cur, const char *_text); | 780 | static int _evas_textblock_cursor_text_prepend(Efl_Text_Cursor_Cursor *cur, const char *_text); | ||
781 | static void _evas_textblock_cursor_copy(Efl_Text_Cursor_Cursor *dst, const Efl_Text_Cursor_Cursor *src); | 781 | static void _evas_textblock_cursor_copy(Efl_Text_Cursor_Cursor *dst, const Efl_Text_Cursor_Cursor *src); | ||
▲ Show 20 Lines • Show All 167 Lines • ▼ Show 20 Line(s) | |||||
949 | /** | 949 | /** | ||
950 | * @internal | 950 | * @internal | ||
951 | * Clears all the nodes (text and format) of the textblock object. | 951 | * Clears all the nodes (text and format) of the textblock object. | ||
952 | * @param obj The evas object, must not be NULL. | 952 | * @param obj The evas object, must not be NULL. | ||
953 | */ | 953 | */ | ||
954 | static void | 954 | static void | ||
955 | _nodes_clear(const Evas_Object *eo_obj) | 955 | _nodes_clear(const Evas_Object *eo_obj) | ||
956 | { | 956 | { | ||
957 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 957 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
958 | 958 | | |||
959 | /* First, clear all annotations that may have spawned format nodes. */ | 959 | /* First, clear all annotations that may have spawned format nodes. */ | ||
960 | _evas_textblock_annotations_clear(o); | 960 | _evas_textblock_annotations_clear(o); | ||
961 | 961 | | |||
962 | while (o->text_nodes) | 962 | while (o->text_nodes) | ||
963 | { | 963 | { | ||
964 | Evas_Object_Textblock_Node_Text *n; | 964 | Evas_Object_Textblock_Node_Text *n; | ||
965 | 965 | | |||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | |||||
1019 | * @internal | 1019 | * @internal | ||
1020 | * Free a layout item | 1020 | * Free a layout item | ||
1021 | * @param obj The evas object, must not be NULL. | 1021 | * @param obj The evas object, must not be NULL. | ||
1022 | * @param ln the layout line on which the item is in, must not be NULL. | 1022 | * @param ln the layout line on which the item is in, must not be NULL. | ||
1023 | * @param it the layout item to be freed | 1023 | * @param it the layout item to be freed | ||
1024 | */ | 1024 | */ | ||
1025 | static void | 1025 | static void | ||
1026 | _item_free(Evas_Public_Data *evas, | 1026 | _item_free(Evas_Public_Data *evas, | ||
1027 | Efl_Canvas_Text_Data *o, | 1027 | Efl_Canvas_Text_Canvas_Data *o, | ||
1028 | Evas_Object_Protected_Data *evas_o, | 1028 | Evas_Object_Protected_Data *evas_o, | ||
1029 | Evas_Object_Textblock_Line *ln, Evas_Object_Textblock_Item *it) | 1029 | Evas_Object_Textblock_Line *ln, Evas_Object_Textblock_Item *it) | ||
1030 | { | 1030 | { | ||
1031 | if (it->type == EVAS_TEXTBLOCK_ITEM_TEXT) | 1031 | if (it->type == EVAS_TEXTBLOCK_ITEM_TEXT) | ||
1032 | { | 1032 | { | ||
1033 | Evas_Object_Textblock_Text_Item *ti = _ITEM_TEXT(it); | 1033 | Evas_Object_Textblock_Text_Item *ti = _ITEM_TEXT(it); | ||
1034 | 1034 | | |||
1035 | evas_common_text_props_content_unref(&ti->text_props); | 1035 | evas_common_text_props_content_unref(&ti->text_props); | ||
▲ Show 20 Lines • Show All 1243 Lines • ▼ Show 20 Line(s) | 2273 | if (endptr) | |||
2279 | } | 2279 | } | ||
2280 | fmt->valign = val; | 2280 | fmt->valign = val; | ||
2281 | if (fmt->valign < 0.0) fmt->valign = 0.0; | 2281 | if (fmt->valign < 0.0) fmt->valign = 0.0; | ||
2282 | else if (fmt->valign > 1.0) fmt->valign = 1.0; | 2282 | else if (fmt->valign > 1.0) fmt->valign = 1.0; | ||
2283 | } | 2283 | } | ||
2284 | } | 2284 | } | ||
2285 | else if (cmd == text_valignstr) | 2285 | else if (cmd == text_valignstr) | ||
2286 | { | 2286 | { | ||
2287 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 2287 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
2288 | char *endptr = NULL; | 2288 | char *endptr = NULL; | ||
2289 | double val = strtod(param, &endptr); | 2289 | double val = strtod(param, &endptr); | ||
2290 | o->valign = val; | 2290 | o->valign = val; | ||
2291 | if (o->valign < 0.0) o->valign = 0.0; | 2291 | if (o->valign < 0.0) o->valign = 0.0; | ||
2292 | else if (o->valign > 1.0) o->valign = 1.0; | 2292 | else if (o->valign > 1.0) o->valign = 1.0; | ||
2293 | } | 2293 | } | ||
2294 | else if (cmd == wrapstr) | 2294 | else if (cmd == wrapstr) | ||
2295 | { | 2295 | { | ||
▲ Show 20 Lines • Show All 453 Lines • ▼ Show 20 Line(s) | 2737 | { | |||
2749 | * @endcode | 2749 | * @endcode | ||
2750 | */ | 2750 | */ | ||
2751 | char *endptr = NULL; | 2751 | char *endptr = NULL; | ||
2752 | fmt->ellipsis = strtod(param, &endptr); | 2752 | fmt->ellipsis = strtod(param, &endptr); | ||
2753 | if ((fmt->ellipsis < 0.0) || (fmt->ellipsis > 1.0)) | 2753 | if ((fmt->ellipsis < 0.0) || (fmt->ellipsis > 1.0)) | ||
2754 | fmt->ellipsis = -1.0; | 2754 | fmt->ellipsis = -1.0; | ||
2755 | else | 2755 | else | ||
2756 | { | 2756 | { | ||
2757 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 2757 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
2758 | o->have_ellipsis = 1; | 2758 | o->have_ellipsis = 1; | ||
2759 | } | 2759 | } | ||
2760 | } | 2760 | } | ||
2761 | else if (cmd == passwordstr) | 2761 | else if (cmd == passwordstr) | ||
2762 | { | 2762 | { | ||
2763 | /** | 2763 | /** | ||
2764 | * @page evas_textblock_style_page Evas Textblock Style Options | 2764 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2765 | * | 2765 | * | ||
Show All 10 Lines | |||||
2776 | */ | 2776 | */ | ||
2777 | if (len == 3 && !strcmp(param, "off")) | 2777 | if (len == 3 && !strcmp(param, "off")) | ||
2778 | fmt->password = 0; | 2778 | fmt->password = 0; | ||
2779 | else if (len == 2 && !strcmp(param, "on")) | 2779 | else if (len == 2 && !strcmp(param, "on")) | ||
2780 | fmt->password = 1; | 2780 | fmt->password = 1; | ||
2781 | } | 2781 | } | ||
2782 | else if (cmd == replacement_charstr) | 2782 | else if (cmd == replacement_charstr) | ||
2783 | { | 2783 | { | ||
2784 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 2784 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
2785 | eina_stringshare_replace(&o->repch, param); | 2785 | eina_stringshare_replace(&o->repch, param); | ||
2786 | } | 2786 | } | ||
2787 | else if (cmd == underline_dash_widthstr) | 2787 | else if (cmd == underline_dash_widthstr) | ||
2788 | { | 2788 | { | ||
2789 | /** | 2789 | /** | ||
2790 | * @page evas_textblock_style_page Evas Textblock Style Options | 2790 | * @page evas_textblock_style_page Evas Textblock Style Options | ||
2791 | * | 2791 | * | ||
2792 | * @subsection evas_textblock_style_underline_dash_width Underline dash width | 2792 | * @subsection evas_textblock_style_underline_dash_width Underline dash width | ||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 2833 | { | |||
2837 | * @subsection evas_textblock_style_gfx_filter Gfx Filter | 2837 | * @subsection evas_textblock_style_gfx_filter Gfx Filter | ||
2838 | * | 2838 | * | ||
2839 | * Experimental filter, see efl_gfx_filter for more information. | 2839 | * Experimental filter, see efl_gfx_filter for more information. | ||
2840 | * @code | 2840 | * @code | ||
2841 | * gfx_filter='filter name' | 2841 | * gfx_filter='filter name' | ||
2842 | * @endcode | 2842 | * @endcode | ||
2843 | */ | 2843 | */ | ||
2844 | if (!fmt->gfx_filter) | 2844 | if (!fmt->gfx_filter) | ||
2845 | fmt->gfx_filter = calloc(1, sizeof(Efl_Canvas_Text_Filter)); | 2845 | fmt->gfx_filter = calloc(1, sizeof(Efl_Canvas_Text_Canvas_Filter)); | ||
2846 | eina_stringshare_replace(&fmt->gfx_filter->name, param); | 2846 | eina_stringshare_replace(&fmt->gfx_filter->name, param); | ||
2847 | } | 2847 | } | ||
2848 | } | 2848 | } | ||
2849 | 2849 | | |||
2850 | /* | 2850 | /* | ||
2851 | * @internal | 2851 | * @internal | ||
2852 | * just to create a constant without using marco | 2852 | * just to create a constant without using marco | ||
2853 | * 2 cacheline is enough for the string we parse | 2853 | * 2 cacheline is enough for the string we parse | ||
▲ Show 20 Lines • Show All 287 Lines • ▼ Show 20 Line(s) | |||||
3141 | * A pack of information that needed to be passed around in the layout engine, | 3141 | * A pack of information that needed to be passed around in the layout engine, | ||
3142 | * packed for easier access. | 3142 | * packed for easier access. | ||
3143 | */ | 3143 | */ | ||
3144 | typedef struct _Ctxt Ctxt; | 3144 | typedef struct _Ctxt Ctxt; | ||
3145 | 3145 | | |||
3146 | struct _Ctxt | 3146 | struct _Ctxt | ||
3147 | { | 3147 | { | ||
3148 | Evas_Object *obj; | 3148 | Evas_Object *obj; | ||
3149 | Efl_Canvas_Text_Data *o; | 3149 | Efl_Canvas_Text_Canvas_Data *o; | ||
3150 | Evas_Object_Protected_Data *evas_o; | 3150 | Evas_Object_Protected_Data *evas_o; | ||
3151 | Evas_Public_Data *evas; | 3151 | Evas_Public_Data *evas; | ||
3152 | 3152 | | |||
3153 | Evas_Object_Textblock_Paragraph *paragraphs; | 3153 | Evas_Object_Textblock_Paragraph *paragraphs; | ||
3154 | Evas_Object_Textblock_Paragraph *par; | 3154 | Evas_Object_Textblock_Paragraph *par; | ||
3155 | Evas_Object_Textblock_Line *ln; | 3155 | Evas_Object_Textblock_Line *ln; | ||
3156 | Evas_Object_Textblock_Text_Item *hyphen_ti; | 3156 | Evas_Object_Textblock_Text_Item *hyphen_ti; | ||
3157 | 3157 | | |||
▲ Show 20 Lines • Show All 199 Lines • ▼ Show 20 Line(s) | 3350 | { | |||
3357 | c->x = 0; | 3357 | c->x = 0; | ||
3358 | c->ascent = c->descent = 0; | 3358 | c->ascent = c->descent = 0; | ||
3359 | c->maxascent = c->maxdescent = 0; | 3359 | c->maxascent = c->maxdescent = 0; | ||
3360 | c->ln->line_no = -1; | 3360 | c->ln->line_no = -1; | ||
3361 | c->ln->par = c->par; | 3361 | c->ln->par = c->par; | ||
3362 | } | 3362 | } | ||
3363 | 3363 | | |||
3364 | static inline Evas_Object_Textblock_Paragraph * | 3364 | static inline Evas_Object_Textblock_Paragraph * | ||
3365 | _layout_find_paragraph_by_y(Efl_Canvas_Text_Data *o, Evas_Coord y) | 3365 | _layout_find_paragraph_by_y(Efl_Canvas_Text_Canvas_Data *o, Evas_Coord y) | ||
3366 | { | 3366 | { | ||
3367 | Evas_Object_Textblock_Paragraph *start, *par; | 3367 | Evas_Object_Textblock_Paragraph *start, *par; | ||
3368 | int i; | 3368 | int i; | ||
3369 | 3369 | | |||
3370 | start = o->paragraphs; | 3370 | start = o->paragraphs; | ||
3371 | 3371 | | |||
3372 | for (i = 0 ; i < TEXTBLOCK_PAR_INDEX_SIZE ; i++) | 3372 | for (i = 0 ; i < TEXTBLOCK_PAR_INDEX_SIZE ; i++) | ||
3373 | { | 3373 | { | ||
Show All 9 Lines | 3382 | { | |||
3383 | if ((par->y <= y) && (y < par->y + par->h)) | 3383 | if ((par->y <= y) && (y < par->y + par->h)) | ||
3384 | return par; | 3384 | return par; | ||
3385 | } | 3385 | } | ||
3386 | 3386 | | |||
3387 | return NULL; | 3387 | return NULL; | ||
3388 | } | 3388 | } | ||
3389 | 3389 | | |||
3390 | static inline Evas_Object_Textblock_Paragraph * | 3390 | static inline Evas_Object_Textblock_Paragraph * | ||
3391 | _layout_find_paragraph_by_line_no(Efl_Canvas_Text_Data *o, int line_no) | 3391 | _layout_find_paragraph_by_line_no(Efl_Canvas_Text_Canvas_Data *o, int line_no) | ||
3392 | { | 3392 | { | ||
3393 | Evas_Object_Textblock_Paragraph *start, *par; | 3393 | Evas_Object_Textblock_Paragraph *start, *par; | ||
3394 | int i; | 3394 | int i; | ||
3395 | 3395 | | |||
3396 | start = o->paragraphs; | 3396 | start = o->paragraphs; | ||
3397 | 3397 | | |||
3398 | for (i = 0 ; i < TEXTBLOCK_PAR_INDEX_SIZE ; i++) | 3398 | for (i = 0 ; i < TEXTBLOCK_PAR_INDEX_SIZE ; i++) | ||
3399 | { | 3399 | { | ||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Line(s) | |||||
3464 | #ifdef BIDI_SUPPORT | 3464 | #ifdef BIDI_SUPPORT | ||
3465 | /** | 3465 | /** | ||
3466 | * @internal | 3466 | * @internal | ||
3467 | * Update bidi paragraph props. | 3467 | * Update bidi paragraph props. | ||
3468 | * | 3468 | * | ||
3469 | * @param par The paragraph to update | 3469 | * @param par The paragraph to update | ||
3470 | */ | 3470 | */ | ||
3471 | static inline void | 3471 | static inline void | ||
3472 | _layout_update_bidi_props(const Efl_Canvas_Text_Data *o, | 3472 | _layout_update_bidi_props(const Efl_Canvas_Text_Canvas_Data *o, | ||
3473 | Evas_Object_Textblock_Paragraph *par) | 3473 | Evas_Object_Textblock_Paragraph *par) | ||
3474 | { | 3474 | { | ||
3475 | if (par->text_node) | 3475 | if (par->text_node) | ||
3476 | { | 3476 | { | ||
3477 | const Eina_Unicode *text; | 3477 | const Eina_Unicode *text; | ||
3478 | int *segment_idxs = NULL; | 3478 | int *segment_idxs = NULL; | ||
3479 | Evas_BiDi_Direction par_dir; | 3479 | Evas_BiDi_Direction par_dir; | ||
3480 | EvasBiDiParType bidi_par_type; | 3480 | EvasBiDiParType bidi_par_type; | ||
Show All 33 Lines | |||||
3514 | 3514 | | |||
3515 | 3515 | | |||
3516 | /** | 3516 | /** | ||
3517 | * @internal | 3517 | * @internal | ||
3518 | * Free the visual lines in the paragraph (logical items are kept) | 3518 | * Free the visual lines in the paragraph (logical items are kept) | ||
3519 | */ | 3519 | */ | ||
3520 | static void | 3520 | static void | ||
3521 | _paragraph_clear(Evas_Public_Data *evas, | 3521 | _paragraph_clear(Evas_Public_Data *evas, | ||
3522 | Efl_Canvas_Text_Data *o, Evas_Object_Protected_Data *obj, | 3522 | Efl_Canvas_Text_Canvas_Data *o, Evas_Object_Protected_Data *obj, | ||
3523 | Evas_Object_Textblock_Paragraph *par) | 3523 | Evas_Object_Textblock_Paragraph *par) | ||
3524 | { | 3524 | { | ||
3525 | while (par->lines) | 3525 | while (par->lines) | ||
3526 | { | 3526 | { | ||
3527 | Evas_Object_Textblock_Line *ln; | 3527 | Evas_Object_Textblock_Line *ln; | ||
3528 | 3528 | | |||
3529 | ln = (Evas_Object_Textblock_Line *) par->lines; | 3529 | ln = (Evas_Object_Textblock_Line *) par->lines; | ||
3530 | par->lines = (Evas_Object_Textblock_Line *)eina_inlist_remove(EINA_INLIST_GET(par->lines), EINA_INLIST_GET(par->lines)); | 3530 | par->lines = (Evas_Object_Textblock_Line *)eina_inlist_remove(EINA_INLIST_GET(par->lines), EINA_INLIST_GET(par->lines)); | ||
Show All 20 Lines | |||||
3551 | } | 3551 | } | ||
3552 | 3552 | | |||
3553 | /** | 3553 | /** | ||
3554 | * @internal | 3554 | * @internal | ||
3555 | * Free the layout paragraph and all of it's lines and logical items. | 3555 | * Free the layout paragraph and all of it's lines and logical items. | ||
3556 | */ | 3556 | */ | ||
3557 | static void | 3557 | static void | ||
3558 | _paragraph_free(Evas_Public_Data *evas, | 3558 | _paragraph_free(Evas_Public_Data *evas, | ||
3559 | Efl_Canvas_Text_Data *o, Evas_Object_Protected_Data *obj, | 3559 | Efl_Canvas_Text_Canvas_Data *o, Evas_Object_Protected_Data *obj, | ||
3560 | Evas_Object_Textblock_Paragraph *par) | 3560 | Evas_Object_Textblock_Paragraph *par) | ||
3561 | { | 3561 | { | ||
3562 | _paragraph_clear(evas, o, obj, par); | 3562 | _paragraph_clear(evas, o, obj, par); | ||
3563 | 3563 | | |||
3564 | { | 3564 | { | ||
3565 | Evas_Object_Textblock_Item *it; | 3565 | Evas_Object_Textblock_Item *it; | ||
3566 | EINA_LIST_FREE(par->logical_items, it) | 3566 | EINA_LIST_FREE(par->logical_items, it) | ||
3567 | { | 3567 | { | ||
Show All 36 Lines | |||||
3604 | * Free the paragraphs from the inlist pars, the difference between this and | 3604 | * Free the paragraphs from the inlist pars, the difference between this and | ||
3605 | * _paragraphs_clear is that the latter keeps the logical items and the par | 3605 | * _paragraphs_clear is that the latter keeps the logical items and the par | ||
3606 | * items, while the former frees them as well. | 3606 | * items, while the former frees them as well. | ||
3607 | * | 3607 | * | ||
3608 | * @param c the context - Not NULL. | 3608 | * @param c the context - Not NULL. | ||
3609 | */ | 3609 | */ | ||
3610 | static void | 3610 | static void | ||
3611 | _paragraphs_free(Evas_Public_Data *evas, | 3611 | _paragraphs_free(Evas_Public_Data *evas, | ||
3612 | Efl_Canvas_Text_Data *o, Evas_Object_Protected_Data *obj, | 3612 | Efl_Canvas_Text_Canvas_Data *o, Evas_Object_Protected_Data *obj, | ||
3613 | Evas_Object_Textblock_Paragraph *pars) | 3613 | Evas_Object_Textblock_Paragraph *pars) | ||
3614 | { | 3614 | { | ||
3615 | o->num_paragraphs = 0; | 3615 | o->num_paragraphs = 0; | ||
3616 | 3616 | | |||
3617 | while (pars) | 3617 | while (pars) | ||
3618 | { | 3618 | { | ||
3619 | Evas_Object_Textblock_Paragraph *par; | 3619 | Evas_Object_Textblock_Paragraph *par; | ||
3620 | 3620 | | |||
Show All 10 Lines | |||||
3631 | * @param c the context to work on - Not NULL. | 3631 | * @param c the context to work on - Not NULL. | ||
3632 | * @param fmt the format to push. | 3632 | * @param fmt the format to push. | ||
3633 | * @see _layout_format_pop() | 3633 | * @see _layout_format_pop() | ||
3634 | */ | 3634 | */ | ||
3635 | static Evas_Object_Textblock_Format * | 3635 | static Evas_Object_Textblock_Format * | ||
3636 | _layout_format_push(Ctxt *c, Evas_Object_Textblock_Format *fmt, | 3636 | _layout_format_push(Ctxt *c, Evas_Object_Textblock_Format *fmt, | ||
3637 | Evas_Object_Textblock_Node_Format *fnode) | 3637 | Evas_Object_Textblock_Node_Format *fnode) | ||
3638 | { | 3638 | { | ||
3639 | Efl_Canvas_Text_Data *o = c->o; | 3639 | Efl_Canvas_Text_Canvas_Data *o = c->o; | ||
3640 | 3640 | | |||
3641 | if (fmt) | 3641 | if (fmt) | ||
3642 | { | 3642 | { | ||
3643 | fmt = _format_dup(c->obj, fmt); | 3643 | fmt = _format_dup(c->obj, fmt); | ||
3644 | c->format_stack = eina_list_prepend(c->format_stack, fmt); | 3644 | c->format_stack = eina_list_prepend(c->format_stack, fmt); | ||
3645 | fmt->fnode = fnode; | 3645 | fmt->fnode = fnode; | ||
3646 | } | 3646 | } | ||
3647 | else | 3647 | else | ||
Show All 32 Lines | 3677 | fmt->font.font = evas_font_load(evas_obj->layer->evas->font_path, | |||
3680 | fmt->font.source, | 3680 | fmt->font.source, | ||
3681 | (int)(((double) _FMT_INFO(size)) * evas_obj->cur->scale), | 3681 | (int)(((double) _FMT_INFO(size)) * evas_obj->cur->scale), | ||
3682 | fmt->font.bitmap_scalable); | 3682 | fmt->font.bitmap_scalable); | ||
3683 | } | 3683 | } | ||
3684 | if (_FMT_INFO(gfx_filter_name)) | 3684 | if (_FMT_INFO(gfx_filter_name)) | ||
3685 | { | 3685 | { | ||
3686 | if (!fmt->gfx_filter) | 3686 | if (!fmt->gfx_filter) | ||
3687 | { | 3687 | { | ||
3688 | fmt->gfx_filter = calloc(1, sizeof(Efl_Canvas_Text_Filter)); | 3688 | fmt->gfx_filter = calloc(1, sizeof(Efl_Canvas_Text_Canvas_Filter)); | ||
3689 | eina_stringshare_replace(&fmt->gfx_filter->name, | 3689 | eina_stringshare_replace(&fmt->gfx_filter->name, | ||
3690 | _FMT_INFO(gfx_filter_name)); | 3690 | _FMT_INFO(gfx_filter_name)); | ||
3691 | } | 3691 | } | ||
3692 | } | 3692 | } | ||
3693 | } | 3693 | } | ||
3694 | 3694 | | |||
3695 | return fmt; | 3695 | return fmt; | ||
3696 | } | 3696 | } | ||
▲ Show 20 Lines • Show All 1155 Lines • ▼ Show 20 Line(s) | 4851 | fmt->font.font = evas_font_load(obj->layer->evas->font_path, | |||
4852 | obj->layer->evas->hinting, | 4852 | obj->layer->evas->hinting, | ||
4853 | fmt->font.fdesc, | 4853 | fmt->font.fdesc, | ||
4854 | fmt->font.source, | 4854 | fmt->font.source, | ||
4855 | (int)(((double) fmt->font.size) * obj->cur->scale), | 4855 | (int)(((double) fmt->font.size) * obj->cur->scale), | ||
4856 | fmt->font.bitmap_scalable); | 4856 | fmt->font.bitmap_scalable); | ||
4857 | evas_font_free(of); | 4857 | evas_font_free(of); | ||
4858 | } | 4858 | } | ||
4859 | 4859 | | |||
4860 | static Efl_Canvas_Text_Filter_Program * | 4860 | static Efl_Canvas_Text_Canvas_Filter_Program * | ||
4861 | _filter_program_find(Efl_Canvas_Text_Data *o, const char *name) | 4861 | _filter_program_find(Efl_Canvas_Text_Canvas_Data *o, const char *name) | ||
4862 | { | 4862 | { | ||
4863 | Efl_Canvas_Text_Filter_Program *prg; | 4863 | Efl_Canvas_Text_Canvas_Filter_Program *prg; | ||
4864 | 4864 | | |||
4865 | if (!name) return NULL; | 4865 | if (!name) return NULL; | ||
4866 | EINA_INLIST_FOREACH(o->gfx_filter.programs, prg) | 4866 | EINA_INLIST_FOREACH(o->gfx_filter.programs, prg) | ||
4867 | { | 4867 | { | ||
4868 | if (eina_streq(name, prg->name)) | 4868 | if (eina_streq(name, prg->name)) | ||
4869 | return prg; | 4869 | return prg; | ||
4870 | } | 4870 | } | ||
4871 | 4871 | | |||
4872 | return NULL; | 4872 | return NULL; | ||
4873 | } | 4873 | } | ||
4874 | 4874 | | |||
4875 | static Evas_Filter_Program * | 4875 | static Evas_Filter_Program * | ||
4876 | _format_filter_program_get(Efl_Canvas_Text_Data *o, Evas_Object_Textblock_Format *fmt) | 4876 | _format_filter_program_get(Efl_Canvas_Text_Canvas_Data *o, Evas_Object_Textblock_Format *fmt) | ||
4877 | { | 4877 | { | ||
4878 | Efl_Canvas_Text_Filter_Program *program; | 4878 | Efl_Canvas_Text_Canvas_Filter_Program *program; | ||
4879 | Efl_Canvas_Text_Filter *filter; | 4879 | Efl_Canvas_Text_Canvas_Filter *filter; | ||
4880 | Evas_Filter_Program *pgm; | 4880 | Evas_Filter_Program *pgm; | ||
4881 | 4881 | | |||
4882 | filter = fmt->gfx_filter; | 4882 | filter = fmt->gfx_filter; | ||
4883 | if (!filter) return NULL; | 4883 | if (!filter) return NULL; | ||
4884 | 4884 | | |||
4885 | program = _filter_program_find(o, filter->name); | 4885 | program = _filter_program_find(o, filter->name); | ||
4886 | if (!program) return NULL; | 4886 | if (!program) return NULL; | ||
4887 | 4887 | | |||
▲ Show 20 Lines • Show All 785 Lines • ▼ Show 20 Line(s) | 5571 | #endif | |||
5673 | 5673 | | |||
5674 | c->position = (c->position == TEXTBLOCK_POSITION_START) ? | 5674 | c->position = (c->position == TEXTBLOCK_POSITION_START) ? | ||
5675 | TEXTBLOCK_POSITION_SINGLE : TEXTBLOCK_POSITION_END; | 5675 | TEXTBLOCK_POSITION_SINGLE : TEXTBLOCK_POSITION_END; | ||
5676 | _layout_line_finalize(c, ellip_ti->parent.format); | 5676 | _layout_line_finalize(c, ellip_ti->parent.format); | ||
5677 | } | 5677 | } | ||
5678 | 5678 | | |||
5679 | /* Don't do much for the meanwhile. */ | 5679 | /* Don't do much for the meanwhile. */ | ||
5680 | static inline void | 5680 | static inline void | ||
5681 | _layout_paragraph_render(Efl_Canvas_Text_Data *o, | 5681 | _layout_paragraph_render(Efl_Canvas_Text_Canvas_Data *o, | ||
5682 | Evas_Object_Textblock_Paragraph *par) | 5682 | Evas_Object_Textblock_Paragraph *par) | ||
5683 | { | 5683 | { | ||
5684 | if (par->rendered) | 5684 | if (par->rendered) | ||
5685 | return; | 5685 | return; | ||
5686 | par->rendered = EINA_TRUE; | 5686 | par->rendered = EINA_TRUE; | ||
5687 | 5687 | | |||
5688 | (void) o; | 5688 | (void) o; | ||
5689 | } | 5689 | } | ||
▲ Show 20 Lines • Show All 835 Lines • ▼ Show 20 Line(s) | |||||
6525 | } | 6525 | } | ||
6526 | 6526 | | |||
6527 | /** FIXME: Document */ | 6527 | /** FIXME: Document */ | ||
6528 | static void | 6528 | static void | ||
6529 | _layout_pre(Ctxt *c) | 6529 | _layout_pre(Ctxt *c) | ||
6530 | { | 6530 | { | ||
6531 | int *style_pad_l, *style_pad_r, *style_pad_t, *style_pad_b; | 6531 | int *style_pad_l, *style_pad_r, *style_pad_t, *style_pad_b; | ||
6532 | Evas_Object *eo_obj = c->obj; | 6532 | Evas_Object *eo_obj = c->obj; | ||
6533 | Efl_Canvas_Text_Data *o = c->o; | 6533 | Efl_Canvas_Text_Canvas_Data *o = c->o; | ||
6534 | 6534 | | |||
6535 | style_pad_l = &c->style_pad.l; | 6535 | style_pad_l = &c->style_pad.l; | ||
6536 | style_pad_r = &c->style_pad.r; | 6536 | style_pad_r = &c->style_pad.r; | ||
6537 | style_pad_b = &c->style_pad.b; | 6537 | style_pad_b = &c->style_pad.b; | ||
6538 | style_pad_t = &c->style_pad.t; | 6538 | style_pad_t = &c->style_pad.t; | ||
6539 | 6539 | | |||
6540 | /* Mark text nodes as dirty if format have changed. */ | 6540 | /* Mark text nodes as dirty if format have changed. */ | ||
6541 | if (o->format_changed) | 6541 | if (o->format_changed) | ||
▲ Show 20 Lines • Show All 351 Lines • ▼ Show 20 Line(s) | 6892 | { | |||
6893 | c->o->style_pad.l = c->style_pad.l; | 6893 | c->o->style_pad.l = c->style_pad.l; | ||
6894 | c->o->style_pad.r = c->style_pad.r; | 6894 | c->o->style_pad.r = c->style_pad.r; | ||
6895 | c->o->style_pad.t = c->style_pad.t; | 6895 | c->o->style_pad.t = c->style_pad.t; | ||
6896 | c->o->style_pad.b = c->style_pad.b; | 6896 | c->o->style_pad.b = c->style_pad.b; | ||
6897 | _paragraphs_clear(c); | 6897 | _paragraphs_clear(c); | ||
6898 | LYDBG("ZZ: ... layout #2\n"); | 6898 | LYDBG("ZZ: ... layout #2\n"); | ||
6899 | c->o->content_changed = 0; | 6899 | c->o->content_changed = 0; | ||
6900 | _layout(c->obj, c->w, c->h, w_ret, h_ret); | 6900 | _layout(c->obj, c->w, c->h, w_ret, h_ret); | ||
6901 | efl_event_callback_call(c->obj, EFL_CANVAS_TEXT_EVENT_STYLE_INSETS_CHANGED, NULL); | 6901 | efl_event_callback_call(c->obj, EFL_CANVAS_TEXT_CANVAS_EVENT_STYLE_INSETS_CHANGED, NULL); | ||
6902 | 6902 | | |||
6903 | c->o->obstacle_changed = EINA_FALSE; | 6903 | c->o->obstacle_changed = EINA_FALSE; | ||
6904 | } | 6904 | } | ||
6905 | } | 6905 | } | ||
6906 | 6906 | | |||
6907 | static Eina_Bool | 6907 | static Eina_Bool | ||
6908 | _layout_setup(Ctxt *c, const Eo *eo_obj, Evas_Coord w, Evas_Coord h) | 6908 | _layout_setup(Ctxt *c, const Eo *eo_obj, Evas_Coord w, Evas_Coord h) | ||
6909 | { | 6909 | { | ||
6910 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 6910 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
6911 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 6911 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
6912 | Evas *eo_e; | 6912 | Evas *eo_e; | ||
6913 | /* setup context */ | 6913 | /* setup context */ | ||
6914 | c->obj = (Evas_Object *)eo_obj; | 6914 | c->obj = (Evas_Object *)eo_obj; | ||
6915 | c->o = o; | 6915 | c->o = o; | ||
6916 | c->paragraphs = c->par = NULL; | 6916 | c->paragraphs = c->par = NULL; | ||
6917 | c->format_stack = NULL; | 6917 | c->format_stack = NULL; | ||
6918 | c->fmt = NULL; | 6918 | c->fmt = NULL; | ||
▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Line(s) | |||||
7025 | * Relayout the object according to current object size. | 7025 | * Relayout the object according to current object size. | ||
7026 | * | 7026 | * | ||
7027 | * @param obj the evas object - NOT NULL. | 7027 | * @param obj the evas object - NOT NULL. | ||
7028 | */ | 7028 | */ | ||
7029 | static void | 7029 | static void | ||
7030 | _relayout(const Evas_Object *eo_obj) | 7030 | _relayout(const Evas_Object *eo_obj) | ||
7031 | { | 7031 | { | ||
7032 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 7032 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
7033 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 7033 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
7034 | _layout(eo_obj, obj->cur->geometry.w, obj->cur->geometry.h, | 7034 | _layout(eo_obj, obj->cur->geometry.w, obj->cur->geometry.h, | ||
7035 | &o->formatted.w, &o->formatted.h); | 7035 | &o->formatted.w, &o->formatted.h); | ||
7036 | o->formatted.valid = 1; | 7036 | o->formatted.valid = 1; | ||
7037 | o->formatted.oneline_h = 0; | 7037 | o->formatted.oneline_h = 0; | ||
7038 | o->last_w = obj->cur->geometry.w; | 7038 | o->last_w = obj->cur->geometry.w; | ||
7039 | o->wrap_changed = EINA_FALSE; | 7039 | o->wrap_changed = EINA_FALSE; | ||
7040 | LYDBG("ZZ: --------- layout %p @ %ix%i = %ix%i\n", eo_obj, obj->cur->geometry.w, obj->cur->geometry.h, o->formatted.w, o->formatted.h); | 7040 | LYDBG("ZZ: --------- layout %p @ %ix%i = %ix%i\n", eo_obj, obj->cur->geometry.w, obj->cur->geometry.h, o->formatted.w, o->formatted.h); | ||
7041 | o->last_h = obj->cur->geometry.h; | 7041 | o->last_h = obj->cur->geometry.h; | ||
Show All 15 Lines | |||||
7057 | #endif | 7057 | #endif | ||
7058 | } | 7058 | } | ||
7059 | 7059 | | |||
7060 | /* | 7060 | /* | ||
7061 | * @internal | 7061 | * @internal | ||
7062 | * Check if the object needs a relayout, and if so, execute it. | 7062 | * Check if the object needs a relayout, and if so, execute it. | ||
7063 | */ | 7063 | */ | ||
7064 | static Eina_Bool | 7064 | static Eina_Bool | ||
7065 | _relayout_if_needed(const Evas_Object *eo_obj, Efl_Canvas_Text_Data *o) | 7065 | _relayout_if_needed(const Evas_Object *eo_obj, Efl_Canvas_Text_Canvas_Data *o) | ||
7066 | { | 7066 | { | ||
7067 | ASYNC_BLOCK; | 7067 | ASYNC_BLOCK; | ||
7068 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 7068 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
7069 | 7069 | | |||
7070 | if (obj->delete_me) return EINA_TRUE; | 7070 | if (obj->delete_me) return EINA_TRUE; | ||
7071 | 7071 | | |||
7072 | /* XXX const */ | 7072 | /* XXX const */ | ||
7073 | evas_object_textblock_coords_recalc((Evas_Object *)eo_obj, obj, obj->private_data); | 7073 | evas_object_textblock_coords_recalc((Evas_Object *)eo_obj, obj, obj->private_data); | ||
Show All 17 Lines | |||||
7091 | * @param[out] tir the item found - not null. | 7091 | * @param[out] tir the item found - not null. | ||
7092 | * @see _find_layout_format_item_line_match() | 7092 | * @see _find_layout_format_item_line_match() | ||
7093 | */ | 7093 | */ | ||
7094 | static void | 7094 | static void | ||
7095 | _find_layout_item_line_match(Evas_Object *eo_obj, Evas_Object_Textblock_Node_Text *n, size_t pos, Evas_Object_Textblock_Line **lnr, Evas_Object_Textblock_Item **itr) | 7095 | _find_layout_item_line_match(Evas_Object *eo_obj, Evas_Object_Textblock_Node_Text *n, size_t pos, Evas_Object_Textblock_Line **lnr, Evas_Object_Textblock_Item **itr) | ||
7096 | { | 7096 | { | ||
7097 | Evas_Object_Textblock_Paragraph *found_par; | 7097 | Evas_Object_Textblock_Paragraph *found_par; | ||
7098 | Evas_Object_Textblock_Line *ln; | 7098 | Evas_Object_Textblock_Line *ln; | ||
7099 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 7099 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
7100 | 7100 | | |||
7101 | _relayout_if_needed(eo_obj, o); | 7101 | _relayout_if_needed(eo_obj, o); | ||
7102 | 7102 | | |||
7103 | found_par = n->par; | 7103 | found_par = n->par; | ||
7104 | if (found_par) | 7104 | if (found_par) | ||
7105 | { | 7105 | { | ||
7106 | _layout_paragraph_render(o, found_par); | 7106 | _layout_paragraph_render(o, found_par); | ||
7107 | EINA_INLIST_FOREACH(found_par->lines, ln) | 7107 | EINA_INLIST_FOREACH(found_par->lines, ln) | ||
Show All 40 Lines | |||||
7148 | * @param line the line to find | 7148 | * @param line the line to find | ||
7149 | * @return the line of line number or NULL if no line found. | 7149 | * @return the line of line number or NULL if no line found. | ||
7150 | */ | 7150 | */ | ||
7151 | static Evas_Object_Textblock_Line * | 7151 | static Evas_Object_Textblock_Line * | ||
7152 | _find_layout_line_num(const Evas_Object *eo_obj, int line) | 7152 | _find_layout_line_num(const Evas_Object *eo_obj, int line) | ||
7153 | { | 7153 | { | ||
7154 | Evas_Object_Textblock_Paragraph *par; | 7154 | Evas_Object_Textblock_Paragraph *par; | ||
7155 | Evas_Object_Textblock_Line *ln; | 7155 | Evas_Object_Textblock_Line *ln; | ||
7156 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 7156 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
7157 | 7157 | | |||
7158 | par = _layout_find_paragraph_by_line_no(o, line); | 7158 | par = _layout_find_paragraph_by_line_no(o, line); | ||
7159 | if (par) | 7159 | if (par) | ||
7160 | { | 7160 | { | ||
7161 | _layout_paragraph_render(o, par); | 7161 | _layout_paragraph_render(o, par); | ||
7162 | EINA_INLIST_FOREACH(par->lines, ln) | 7162 | EINA_INLIST_FOREACH(par->lines, ln) | ||
7163 | { | 7163 | { | ||
7164 | if (par->line_no + ln->line_no == line) return ln; | 7164 | if (par->line_no + ln->line_no == line) return ln; | ||
7165 | } | 7165 | } | ||
7166 | } | 7166 | } | ||
7167 | return NULL; | 7167 | return NULL; | ||
7168 | } | 7168 | } | ||
7169 | 7169 | | |||
7170 | EAPI Evas_Object * | 7170 | EAPI Evas_Object * | ||
7171 | evas_object_textblock_add(Evas *e) | 7171 | evas_object_textblock_add(Evas *e) | ||
7172 | { | 7172 | { | ||
7173 | Efl_Canvas_Text_Data *o; | 7173 | Efl_Canvas_Text_Canvas_Data *o; | ||
7174 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | 7174 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
7175 | return NULL; | 7175 | return NULL; | ||
7176 | MAGIC_CHECK_END(); | 7176 | MAGIC_CHECK_END(); | ||
7177 | Evas_Object *eo_obj = efl_add(MY_CLASS, e, | 7177 | Evas_Object *eo_obj = efl_add(MY_CLASS, e, | ||
7178 | efl_text_multiline_set(efl_added, EINA_TRUE), | 7178 | efl_text_multiline_set(efl_added, EINA_TRUE), | ||
7179 | efl_canvas_object_legacy_ctor(efl_added)); | 7179 | efl_canvas_object_legacy_ctor(efl_added)); | ||
7180 | o = efl_data_scope_get(eo_obj, MY_CLASS); | 7180 | o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
7181 | o->legacy_newline = EINA_TRUE; | 7181 | o->legacy_newline = EINA_TRUE; | ||
7182 | o->auto_styles = EINA_FALSE; | 7182 | o->auto_styles = EINA_FALSE; | ||
7183 | return eo_obj; | 7183 | return eo_obj; | ||
7184 | } | 7184 | } | ||
7185 | 7185 | | |||
7186 | EOLIAN static Eo * | 7186 | EOLIAN static Eo * | ||
7187 | _efl_canvas_text_efl_object_constructor(Eo *eo_obj, Efl_Canvas_Text_Data *class_data EINA_UNUSED) | 7187 | _efl_canvas_text_canvas_efl_object_constructor(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *class_data EINA_UNUSED) | ||
7188 | { | 7188 | { | ||
7189 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 7189 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
7190 | Efl_Canvas_Text_Data *o; | 7190 | Efl_Canvas_Text_Canvas_Data *o; | ||
7191 | 7191 | | |||
7192 | eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); | 7192 | eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); | ||
7193 | 7193 | | |||
7194 | /* set up methods (compulsory) */ | 7194 | /* set up methods (compulsory) */ | ||
7195 | obj->func = &object_func; | 7195 | obj->func = &object_func; | ||
7196 | obj->private_data = efl_data_ref(eo_obj, MY_CLASS); | 7196 | obj->private_data = efl_data_ref(eo_obj, MY_CLASS); | ||
7197 | obj->type = o_type; | 7197 | obj->type = o_type; | ||
7198 | 7198 | | |||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 7243 | { | |||
7245 | return; | 7245 | return; | ||
7246 | } | 7246 | } | ||
7247 | _style_clear(ts); | 7247 | _style_clear(ts); | ||
7248 | // FIXME: free up user style entry | 7248 | // FIXME: free up user style entry | ||
7249 | free(ts); | 7249 | free(ts); | ||
7250 | } | 7250 | } | ||
7251 | 7251 | | |||
7252 | static void | 7252 | static void | ||
7253 | _evas_textblock_update_format_nodes_from_style_tag(Efl_Canvas_Text_Data *o) | 7253 | _evas_textblock_update_format_nodes_from_style_tag(Efl_Canvas_Text_Canvas_Data *o) | ||
7254 | { | 7254 | { | ||
7255 | if (!o) | 7255 | if (!o) | ||
7256 | { | 7256 | { | ||
7257 | ERR("The given address Efl_Canvas_Text_Data is NULL"); | 7257 | ERR("The given address Efl_Canvas_Text_Canvas_Data is NULL"); | ||
7258 | return; | 7258 | return; | ||
7259 | } | 7259 | } | ||
7260 | 7260 | | |||
7261 | Evas_Object_Textblock_Node_Format *fnode = o->format_nodes; | 7261 | Evas_Object_Textblock_Node_Format *fnode = o->format_nodes; | ||
7262 | 7262 | | |||
7263 | while (fnode) | 7263 | while (fnode) | ||
7264 | { | 7264 | { | ||
7265 | const char *match; | 7265 | const char *match; | ||
▲ Show 20 Lines • Show All 140 Lines • ▼ Show 20 Line(s) | 7346 | if ((key_start) && (key_stop) && (val_start)) | |||
7406 | } | 7406 | } | ||
7407 | p++; | 7407 | p++; | ||
7408 | } | 7408 | } | ||
7409 | eina_strbuf_free(tag_value_buf); | 7409 | eina_strbuf_free(tag_value_buf); | ||
7410 | } | 7410 | } | ||
7411 | 7411 | | |||
7412 | EINA_LIST_FOREACH(ts->objects, l, eo_obj) | 7412 | EINA_LIST_FOREACH(ts->objects, l, eo_obj) | ||
7413 | { | 7413 | { | ||
7414 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 7414 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
7415 | _evas_textblock_update_format_nodes_from_style_tag(o); | 7415 | _evas_textblock_update_format_nodes_from_style_tag(o); | ||
7416 | _evas_textblock_invalidate_all(o); | 7416 | _evas_textblock_invalidate_all(o); | ||
7417 | _evas_textblock_changed(o, eo_obj); | 7417 | _evas_textblock_changed(o, eo_obj); | ||
7418 | } | 7418 | } | ||
7419 | } | 7419 | } | ||
7420 | 7420 | | |||
7421 | EAPI const char * | 7421 | EAPI const char * | ||
7422 | evas_textblock_style_get(const Evas_Textblock_Style *ts) | 7422 | evas_textblock_style_get(const Evas_Textblock_Style *ts) | ||
7423 | { | 7423 | { | ||
7424 | if (!ts) return NULL; | 7424 | if (!ts) return NULL; | ||
7425 | return ts->style_text; | 7425 | return ts->style_text; | ||
7426 | } | 7426 | } | ||
7427 | 7427 | | |||
7428 | static const char * | 7428 | static const char * | ||
7429 | _textblock_format_node_from_style_tag(Efl_Canvas_Text_Data *o, Evas_Object_Textblock_Node_Format *fnode, const char *format, size_t format_len) | 7429 | _textblock_format_node_from_style_tag(Efl_Canvas_Text_Canvas_Data *o, Evas_Object_Textblock_Node_Format *fnode, const char *format, size_t format_len) | ||
7430 | { | 7430 | { | ||
7431 | Eina_List *itr; | 7431 | Eina_List *itr; | ||
7432 | const char *match = NULL; | 7432 | const char *match = NULL; | ||
7433 | User_Style_Entry *use; | 7433 | User_Style_Entry *use; | ||
7434 | EINA_LIST_REVERSE_FOREACH(o->styles, itr, use) | 7434 | EINA_LIST_REVERSE_FOREACH(o->styles, itr, use) | ||
7435 | { | 7435 | { | ||
7436 | match = _style_match_tag(use->st, format, format_len); | 7436 | match = _style_match_tag(use->st, format, format_len); | ||
7437 | if (match) | 7437 | if (match) | ||
▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Line(s) | |||||
7548 | { | 7548 | { | ||
7549 | EINA_SAFETY_ON_NULL_RETURN(eo_obj); | 7549 | EINA_SAFETY_ON_NULL_RETURN(eo_obj); | ||
7550 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 7550 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
7551 | evas_object_async_block(obj); | 7551 | evas_object_async_block(obj); | ||
7552 | _textblock_style_generic_set(eo_obj, (Evas_Textblock_Style *) ts, NULL); | 7552 | _textblock_style_generic_set(eo_obj, (Evas_Textblock_Style *) ts, NULL); | ||
7553 | } | 7553 | } | ||
7554 | 7554 | | |||
7555 | static Evas_Textblock_Style * | 7555 | static Evas_Textblock_Style * | ||
7556 | _style_by_key_find(Efl_Canvas_Text_Data *o, const char *key) | 7556 | _style_by_key_find(Efl_Canvas_Text_Canvas_Data *o, const char *key) | ||
7557 | { | 7557 | { | ||
7558 | Eina_List *itr; | 7558 | Eina_List *itr; | ||
7559 | User_Style_Entry *us; | 7559 | User_Style_Entry *us; | ||
7560 | 7560 | | |||
7561 | if (!key) | 7561 | if (!key) | ||
7562 | return o->style; | 7562 | return o->style; | ||
7563 | 7563 | | |||
7564 | EINA_LIST_FOREACH(o->styles, itr, us) | 7564 | EINA_LIST_FOREACH(o->styles, itr, us) | ||
Show All 24 Lines | 7587 | { | |||
7589 | ts->legacy = EINA_FALSE; | 7589 | ts->legacy = EINA_FALSE; | ||
7590 | evas_textblock_style_set(ts, style); | 7590 | evas_textblock_style_set(ts, style); | ||
7591 | _style_cache = eina_list_append(_style_cache, ts); | 7591 | _style_cache = eina_list_append(_style_cache, ts); | ||
7592 | } | 7592 | } | ||
7593 | return ts; | 7593 | return ts; | ||
7594 | } | 7594 | } | ||
7595 | 7595 | | |||
7596 | EOLIAN static void | 7596 | EOLIAN static void | ||
7597 | _efl_canvas_text_style_set(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, const char *key, const char *style) | 7597 | _efl_canvas_text_canvas_style_set(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, const char *key, const char *style) | ||
7598 | { | 7598 | { | ||
7599 | // FIXME: Make key value behaviour. | 7599 | // FIXME: Make key value behaviour. | ||
7600 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 7600 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
7601 | evas_object_async_block(obj); | 7601 | evas_object_async_block(obj); | ||
7602 | 7602 | | |||
7603 | Evas_Textblock_Style *ts; | 7603 | Evas_Textblock_Style *ts; | ||
7604 | 7604 | | |||
7605 | ts = _style_fetch(style); | 7605 | ts = _style_fetch(style); | ||
7606 | 7606 | | |||
7607 | _textblock_style_generic_set(eo_obj, ts, key); | 7607 | _textblock_style_generic_set(eo_obj, ts, key); | ||
7608 | } | 7608 | } | ||
7609 | 7609 | | |||
7610 | EAPI Evas_Textblock_Style * | 7610 | EAPI Evas_Textblock_Style * | ||
7611 | evas_object_textblock_style_get(const Eo *eo_obj) | 7611 | evas_object_textblock_style_get(const Eo *eo_obj) | ||
7612 | { | 7612 | { | ||
7613 | EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, NULL); | 7613 | EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, NULL); | ||
7614 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 7614 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
7615 | evas_object_async_block(obj); | 7615 | evas_object_async_block(obj); | ||
7616 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 7616 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
7617 | return o->style; | 7617 | return o->style; | ||
7618 | } | 7618 | } | ||
7619 | 7619 | | |||
7620 | EOLIAN static const char * | 7620 | EOLIAN static const char * | ||
7621 | _efl_canvas_text_style_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o, const char *key) | 7621 | _efl_canvas_text_canvas_style_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o, const char *key) | ||
7622 | { | 7622 | { | ||
7623 | Evas_Textblock_Style *ts = _style_by_key_find(o, key); | 7623 | Evas_Textblock_Style *ts = _style_by_key_find(o, key); | ||
7624 | 7624 | | |||
7625 | return ts ? ts->style_text : NULL; | 7625 | return ts ? ts->style_text : NULL; | ||
7626 | } | 7626 | } | ||
7627 | 7627 | | |||
7628 | #define _STYLE_USER "_style_user" | 7628 | #define _STYLE_USER "_style_user" | ||
7629 | EAPI void | 7629 | EAPI void | ||
7630 | evas_object_textblock_style_user_push(Eo *eo_obj, Evas_Textblock_Style *ts) | 7630 | evas_object_textblock_style_user_push(Eo *eo_obj, Evas_Textblock_Style *ts) | ||
7631 | { | 7631 | { | ||
7632 | EINA_SAFETY_ON_NULL_RETURN(eo_obj); | 7632 | EINA_SAFETY_ON_NULL_RETURN(eo_obj); | ||
7633 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 7633 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
7634 | evas_object_async_block(obj); | 7634 | evas_object_async_block(obj); | ||
7635 | 7635 | | |||
7636 | _textblock_style_generic_set(eo_obj, ts, _STYLE_USER); | 7636 | _textblock_style_generic_set(eo_obj, ts, _STYLE_USER); | ||
7637 | } | 7637 | } | ||
7638 | 7638 | | |||
7639 | EAPI const Evas_Textblock_Style* | 7639 | EAPI const Evas_Textblock_Style* | ||
7640 | evas_object_textblock_style_user_peek(const Eo *eo_obj) | 7640 | evas_object_textblock_style_user_peek(const Eo *eo_obj) | ||
7641 | { | 7641 | { | ||
7642 | EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, NULL); | 7642 | EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, NULL); | ||
7643 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 7643 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
7644 | evas_object_async_block(obj); | 7644 | evas_object_async_block(obj); | ||
7645 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 7645 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
7646 | Evas_Textblock_Style *ts = _style_by_key_find(o, _STYLE_USER); | 7646 | Evas_Textblock_Style *ts = _style_by_key_find(o, _STYLE_USER); | ||
7647 | 7647 | | |||
7648 | return ts; | 7648 | return ts; | ||
7649 | } | 7649 | } | ||
7650 | 7650 | | |||
7651 | EAPI void | 7651 | EAPI void | ||
7652 | evas_object_textblock_style_user_pop(Eo *eo_obj) | 7652 | evas_object_textblock_style_user_pop(Eo *eo_obj) | ||
7653 | { | 7653 | { | ||
7654 | EINA_SAFETY_ON_NULL_RETURN(eo_obj); | 7654 | EINA_SAFETY_ON_NULL_RETURN(eo_obj); | ||
7655 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 7655 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
7656 | evas_object_async_block(obj); | 7656 | evas_object_async_block(obj); | ||
7657 | _textblock_style_generic_set(eo_obj, NULL, _STYLE_USER); | 7657 | _textblock_style_generic_set(eo_obj, NULL, _STYLE_USER); | ||
7658 | } | 7658 | } | ||
7659 | 7659 | | |||
7660 | EAPI void | 7660 | EAPI void | ||
7661 | evas_object_textblock_replace_char_set(Efl_Canvas_Text *eo_obj, const char *ch) | 7661 | evas_object_textblock_replace_char_set(Efl_Canvas_Text_Canvas *eo_obj, const char *ch) | ||
7662 | { | 7662 | { | ||
7663 | EINA_SAFETY_ON_NULL_RETURN(eo_obj); | 7663 | EINA_SAFETY_ON_NULL_RETURN(eo_obj); | ||
7664 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 7664 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
7665 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 7665 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
7666 | evas_object_async_block(obj); | 7666 | evas_object_async_block(obj); | ||
7667 | if (o->repch) eina_stringshare_del(o->repch); | 7667 | if (o->repch) eina_stringshare_del(o->repch); | ||
7668 | if (ch) o->repch = eina_stringshare_add(ch); | 7668 | if (ch) o->repch = eina_stringshare_add(ch); | ||
7669 | else o->repch = NULL; | 7669 | else o->repch = NULL; | ||
7670 | _evas_textblock_invalidate_all(o); | 7670 | _evas_textblock_invalidate_all(o); | ||
7671 | _evas_textblock_changed(o, eo_obj); | 7671 | _evas_textblock_changed(o, eo_obj); | ||
7672 | } | 7672 | } | ||
7673 | 7673 | | |||
7674 | 7674 | | |||
7675 | EOLIAN static void | 7675 | EOLIAN static void | ||
7676 | _efl_canvas_text_legacy_newline_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o, Eina_Bool mode) | 7676 | _efl_canvas_text_canvas_legacy_newline_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o, Eina_Bool mode) | ||
7677 | { | 7677 | { | ||
7678 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 7678 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
7679 | evas_object_async_block(obj); | 7679 | evas_object_async_block(obj); | ||
7680 | if (o->legacy_newline == mode) | 7680 | if (o->legacy_newline == mode) | ||
7681 | return; | 7681 | return; | ||
7682 | 7682 | | |||
7683 | o->legacy_newline = mode; | 7683 | o->legacy_newline = mode; | ||
7684 | /* FIXME: Should recreate all the textnodes... For now, it's just | 7684 | /* FIXME: Should recreate all the textnodes... For now, it's just | ||
7685 | * for new text inserted. */ | 7685 | * for new text inserted. */ | ||
7686 | } | 7686 | } | ||
7687 | 7687 | | |||
7688 | EOLIAN static Eina_Bool | 7688 | EOLIAN static Eina_Bool | ||
7689 | _efl_canvas_text_legacy_newline_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o) | 7689 | _efl_canvas_text_canvas_legacy_newline_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o) | ||
7690 | { | 7690 | { | ||
7691 | return o->legacy_newline; | 7691 | return o->legacy_newline; | ||
7692 | } | 7692 | } | ||
7693 | 7693 | | |||
7694 | EOLIAN static Eina_Bool | 7694 | EOLIAN static Eina_Bool | ||
7695 | _efl_canvas_text_is_empty_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o) | 7695 | _efl_canvas_text_canvas_is_empty_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o) | ||
7696 | { | 7696 | { | ||
7697 | return !o->text_nodes || (eina_ustrbuf_length_get(o->text_nodes->unicode) == 0); | 7697 | return !o->text_nodes || (eina_ustrbuf_length_get(o->text_nodes->unicode) == 0); | ||
7698 | } | 7698 | } | ||
7699 | 7699 | | |||
7700 | EAPI void | 7700 | EAPI void | ||
7701 | evas_object_textblock_valign_set(Efl_Canvas_Text *eo_obj, double align) | 7701 | evas_object_textblock_valign_set(Efl_Canvas_Text_Canvas *eo_obj, double align) | ||
7702 | { | 7702 | { | ||
7703 | EINA_SAFETY_ON_NULL_RETURN(eo_obj); | 7703 | EINA_SAFETY_ON_NULL_RETURN(eo_obj); | ||
7704 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 7704 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
7705 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 7705 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
7706 | evas_object_async_block(obj); | 7706 | evas_object_async_block(obj); | ||
7707 | if (align < 0.0) align = 0.0; | 7707 | if (align < 0.0) align = 0.0; | ||
7708 | else if (align > 1.0) align = 1.0; | 7708 | else if (align > 1.0) align = 1.0; | ||
7709 | if (EINA_DBL_EQ(o->valign, align)) return; | 7709 | if (EINA_DBL_EQ(o->valign, align)) return; | ||
7710 | o->valign = align; | 7710 | o->valign = align; | ||
7711 | _evas_textblock_changed(o, eo_obj); | 7711 | _evas_textblock_changed(o, eo_obj); | ||
7712 | } | 7712 | } | ||
7713 | 7713 | | |||
7714 | EAPI double | 7714 | EAPI double | ||
7715 | evas_object_textblock_valign_get(const Efl_Canvas_Text *obj) | 7715 | evas_object_textblock_valign_get(const Efl_Canvas_Text_Canvas *obj) | ||
7716 | { | 7716 | { | ||
7717 | EINA_SAFETY_ON_NULL_RETURN_VAL(obj, 0.0); | 7717 | EINA_SAFETY_ON_NULL_RETURN_VAL(obj, 0.0); | ||
7718 | Efl_Canvas_Text_Data *o = efl_data_scope_get(obj, MY_CLASS); | 7718 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(obj, MY_CLASS); | ||
7719 | return o->valign; | 7719 | return o->valign; | ||
7720 | } | 7720 | } | ||
7721 | 7721 | | |||
7722 | EOLIAN static void | 7722 | EOLIAN static void | ||
7723 | _efl_canvas_text_bidi_delimiters_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o, const char *delim) | 7723 | _efl_canvas_text_canvas_bidi_delimiters_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o, const char *delim) | ||
7724 | { | 7724 | { | ||
7725 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 7725 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
7726 | evas_object_async_block(obj); | 7726 | evas_object_async_block(obj); | ||
7727 | eina_stringshare_replace(&o->bidi_delimiters, delim); | 7727 | eina_stringshare_replace(&o->bidi_delimiters, delim); | ||
7728 | } | 7728 | } | ||
7729 | 7729 | | |||
7730 | EOLIAN static const char* | 7730 | EOLIAN static const char* | ||
7731 | _efl_canvas_text_bidi_delimiters_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o) | 7731 | _efl_canvas_text_canvas_bidi_delimiters_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o) | ||
7732 | { | 7732 | { | ||
7733 | return o->bidi_delimiters; | 7733 | return o->bidi_delimiters; | ||
7734 | } | 7734 | } | ||
7735 | 7735 | | |||
7736 | EAPI const char * | 7736 | EAPI const char * | ||
7737 | evas_object_textblock_replace_char_get(const Efl_Canvas_Text *obj) | 7737 | evas_object_textblock_replace_char_get(const Efl_Canvas_Text_Canvas *obj) | ||
7738 | { | 7738 | { | ||
7739 | EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); | 7739 | EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); | ||
7740 | Efl_Canvas_Text_Data *o = efl_data_scope_get(obj, MY_CLASS); | 7740 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(obj, MY_CLASS); | ||
7741 | return o->repch; | 7741 | return o->repch; | ||
7742 | } | 7742 | } | ||
7743 | 7743 | | |||
7744 | /** | 7744 | /** | ||
7745 | * @internal | 7745 | * @internal | ||
7746 | * Advance p_buff to point after the end of the string. It's used with the | 7746 | * Advance p_buff to point after the end of the string. It's used with the | ||
7747 | * @ref escaped_strings[] variable. | 7747 | * @ref escaped_strings[] variable. | ||
7748 | * | 7748 | * | ||
▲ Show 20 Lines • Show All 218 Lines • ▼ Show 20 Line(s) | |||||
7967 | } | 7967 | } | ||
7968 | 7968 | | |||
7969 | static void | 7969 | static void | ||
7970 | _cursor_emit_if_changed(Efl_Text_Cursor_Cursor *cur) | 7970 | _cursor_emit_if_changed(Efl_Text_Cursor_Cursor *cur) | ||
7971 | { | 7971 | { | ||
7972 | if (cur->changed) | 7972 | if (cur->changed) | ||
7973 | { | 7973 | { | ||
7974 | cur->changed = EINA_FALSE; | 7974 | cur->changed = EINA_FALSE; | ||
7975 | efl_event_callback_legacy_call(cur->obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 7975 | efl_event_callback_legacy_call(cur->obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
7976 | } | 7976 | } | ||
7977 | } | 7977 | } | ||
7978 | 7978 | | |||
7979 | /** | 7979 | /** | ||
7980 | * @internal | 7980 | * @internal | ||
7981 | * prepends the escaped char beteewn s and s_end to the curosr | 7981 | * prepends the escaped char beteewn s and s_end to the curosr | ||
7982 | * | 7982 | * | ||
7983 | * | 7983 | * | ||
Show All 10 Lines | 7990 | { | |||
7994 | if (escape) | 7994 | if (escape) | ||
7995 | evas_textblock_cursor_text_prepend(cur_obj, escape); | 7995 | evas_textblock_cursor_text_prepend(cur_obj, escape); | ||
7996 | else /* Use same text input if no escape was found */ | 7996 | else /* Use same text input if no escape was found */ | ||
7997 | _prepend_text_run(cur_obj, s, s_end); | 7997 | _prepend_text_run(cur_obj, s, s_end); | ||
7998 | } | 7998 | } | ||
7999 | 7999 | | |||
8000 | 8000 | | |||
8001 | static void | 8001 | static void | ||
8002 | _evas_object_textblock_text_markup_set(Eo *eo_obj, Efl_Canvas_Text_Data *o, | 8002 | _evas_object_textblock_text_markup_set(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o, | ||
8003 | const char *text) | 8003 | const char *text) | ||
8004 | { | 8004 | { | ||
8005 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 8005 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
8006 | evas_object_async_block(obj); | 8006 | evas_object_async_block(obj); | ||
8007 | if (text == o->markup_text) | 8007 | if (text == o->markup_text) | ||
8008 | { | 8008 | { | ||
8009 | /* Text is the same and already stringshared, do nothing */ | 8009 | /* Text is the same and already stringshared, do nothing */ | ||
8010 | return; | 8010 | return; | ||
Show All 29 Lines | 8036 | { | |||
8040 | evas_textblock_cursor_paragraph_first(o->cursor); | 8040 | evas_textblock_cursor_paragraph_first(o->cursor); | ||
8041 | EINA_LIST_FOREACH(o->cursors, l, data) | 8041 | EINA_LIST_FOREACH(o->cursors, l, data) | ||
8042 | { | 8042 | { | ||
8043 | evas_textblock_cursor_paragraph_first(data); | 8043 | evas_textblock_cursor_paragraph_first(data); | ||
8044 | } | 8044 | } | ||
8045 | 8045 | | |||
8046 | } | 8046 | } | ||
8047 | efl_event_thaw(eo_obj); | 8047 | efl_event_thaw(eo_obj); | ||
8048 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 8048 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
8049 | 8049 | | |||
8050 | o->markup_text = text; | 8050 | o->markup_text = text; | ||
8051 | } | 8051 | } | ||
8052 | 8052 | | |||
8053 | EAPI void | 8053 | EAPI void | ||
8054 | evas_object_textblock_text_markup_set(Eo *eo_obj, const char *text) | 8054 | evas_object_textblock_text_markup_set(Eo *eo_obj, const char *text) | ||
8055 | { | 8055 | { | ||
8056 | EINA_SAFETY_ON_NULL_RETURN(eo_obj); | 8056 | EINA_SAFETY_ON_NULL_RETURN(eo_obj); | ||
8057 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 8057 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
8058 | _evas_object_textblock_text_markup_set(eo_obj, o, text); | 8058 | _evas_object_textblock_text_markup_set(eo_obj, o, text); | ||
8059 | } | 8059 | } | ||
8060 | 8060 | | |||
8061 | EOLIAN void | 8061 | EOLIAN void | ||
8062 | _efl_canvas_text_efl_text_markup_markup_set(Eo *eo_obj, Efl_Canvas_Text_Data *o, | 8062 | _efl_canvas_text_canvas_efl_text_markup_markup_set(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o, | ||
8063 | const char *text) | 8063 | const char *text) | ||
8064 | { | 8064 | { | ||
8065 | ASYNC_BLOCK; | 8065 | ASYNC_BLOCK; | ||
8066 | _evas_object_textblock_text_markup_set(eo_obj, o, text); | 8066 | _evas_object_textblock_text_markup_set(eo_obj, o, text); | ||
8067 | efl_event_callback_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CHANGED, NULL); | 8067 | efl_event_callback_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CHANGED, NULL); | ||
8068 | } | 8068 | } | ||
8069 | 8069 | | |||
8070 | static void | 8070 | static void | ||
8071 | _evas_object_textblock_text_markup_prepend(Eo *eo_obj, | 8071 | _evas_object_textblock_text_markup_prepend(Eo *eo_obj, | ||
8072 | Efl_Text_Cursor_Cursor *cur, const char *text) | 8072 | Efl_Text_Cursor_Cursor *cur, const char *text) | ||
8073 | { | 8073 | { | ||
8074 | if (!cur) return; | 8074 | if (!cur) return; | ||
8075 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 8075 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
▲ Show 20 Lines • Show All 119 Lines • ▼ Show 20 Line(s) | |||||
8195 | EAPI void | 8195 | EAPI void | ||
8196 | evas_object_textblock_text_markup_prepend(Efl_Text_Cursor_Cursor *cur, const char *text) | 8196 | evas_object_textblock_text_markup_prepend(Efl_Text_Cursor_Cursor *cur, const char *text) | ||
8197 | { | 8197 | { | ||
8198 | EINA_SAFETY_ON_NULL_RETURN(cur); | 8198 | EINA_SAFETY_ON_NULL_RETURN(cur); | ||
8199 | _evas_object_textblock_text_markup_prepend(cur->obj, cur, text); | 8199 | _evas_object_textblock_text_markup_prepend(cur->obj, cur, text); | ||
8200 | } | 8200 | } | ||
8201 | 8201 | | |||
8202 | EOLIAN static void | 8202 | EOLIAN static void | ||
8203 | _efl_canvas_text_efl_text_markup_interactive_cursor_markup_insert(Eo *eo_obj, | 8203 | _efl_canvas_text_canvas_efl_text_markup_interactive_cursor_markup_insert(Eo *eo_obj, | ||
8204 | Efl_Canvas_Text_Data *o EINA_UNUSED, | 8204 | Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, | ||
8205 | Efl_Text_Cursor_Cursor *cur, const char *markup) | 8205 | Efl_Text_Cursor_Cursor *cur, const char *markup) | ||
8206 | { | 8206 | { | ||
8207 | ASYNC_BLOCK; | 8207 | ASYNC_BLOCK; | ||
8208 | _evas_object_textblock_text_markup_prepend(eo_obj, cur, markup); | 8208 | _evas_object_textblock_text_markup_prepend(eo_obj, cur, markup); | ||
8209 | efl_event_callback_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CHANGED, NULL); | 8209 | efl_event_callback_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CHANGED, NULL); | ||
8210 | } | 8210 | } | ||
8211 | 8211 | | |||
8212 | /** | 8212 | /** | ||
8213 | * @internal | 8213 | * @internal | ||
8214 | * An helper function to markup get. Appends the format from fnode to the strbugf txt. | 8214 | * An helper function to markup get. Appends the format from fnode to the strbugf txt. | ||
8215 | * | 8215 | * | ||
8216 | * @param o the textblock object. | 8216 | * @param o the textblock object. | ||
8217 | * @param txt the strbuf to append to. | 8217 | * @param txt the strbuf to append to. | ||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 8284 | { | |||
8286 | 8286 | | |||
8287 | if (!base) return; | 8287 | if (!base) return; | ||
8288 | 8288 | | |||
8289 | _markup_get_text_utf8_append(txt, base); | 8289 | _markup_get_text_utf8_append(txt, base); | ||
8290 | 8290 | | |||
8291 | free(base); | 8291 | free(base); | ||
8292 | } | 8292 | } | ||
8293 | static const char* | 8293 | static const char* | ||
8294 | _evas_object_textblock_text_markup_get(const Eo *eo_obj, Efl_Canvas_Text_Data *o) | 8294 | _evas_object_textblock_text_markup_get(const Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o) | ||
8295 | { | 8295 | { | ||
8296 | Evas_Object_Textblock_Node_Text *n; | 8296 | Evas_Object_Textblock_Node_Text *n; | ||
8297 | Eina_Strbuf *txt = NULL; | 8297 | Eina_Strbuf *txt = NULL; | ||
8298 | 8298 | | |||
8299 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 8299 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
8300 | evas_object_async_block(obj); | 8300 | evas_object_async_block(obj); | ||
8301 | const char *markup; | 8301 | const char *markup; | ||
8302 | if (o->markup_text) | 8302 | if (o->markup_text) | ||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 8344 | else | |||
8347 | } | 8347 | } | ||
8348 | fnode = _NODE_FORMAT(EINA_INLIST_GET(fnode)->next); | 8348 | fnode = _NODE_FORMAT(EINA_INLIST_GET(fnode)->next); | ||
8349 | } | 8349 | } | ||
8350 | /* Add the rest, skip replacement */ | 8350 | /* Add the rest, skip replacement */ | ||
8351 | _markup_get_text_append(txt, text); | 8351 | _markup_get_text_append(txt, text); | ||
8352 | free(text_base); | 8352 | free(text_base); | ||
8353 | } | 8353 | } | ||
8354 | 8354 | | |||
8355 | (((Efl_Canvas_Text_Data *)o)->markup_text) = eina_stringshare_add(eina_strbuf_string_get(txt)); | 8355 | (((Efl_Canvas_Text_Canvas_Data *)o)->markup_text) = eina_stringshare_add(eina_strbuf_string_get(txt)); | ||
8356 | eina_strbuf_free(txt); | 8356 | eina_strbuf_free(txt); | ||
8357 | markup = (o->markup_text); | 8357 | markup = (o->markup_text); | ||
8358 | 8358 | | |||
8359 | return markup; | 8359 | return markup; | ||
8360 | } | 8360 | } | ||
8361 | 8361 | | |||
8362 | EAPI const char* | 8362 | EAPI const char* | ||
8363 | evas_object_textblock_text_markup_get(Eo *eo_obj) | 8363 | evas_object_textblock_text_markup_get(Eo *eo_obj) | ||
8364 | { | 8364 | { | ||
8365 | EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, NULL); | 8365 | EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, NULL); | ||
8366 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 8366 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
8367 | return _evas_object_textblock_text_markup_get(eo_obj, o); | 8367 | return _evas_object_textblock_text_markup_get(eo_obj, o); | ||
8368 | } | 8368 | } | ||
8369 | 8369 | | |||
8370 | EOLIAN const char* | 8370 | EOLIAN const char* | ||
8371 | _efl_canvas_text_efl_text_markup_markup_get(const Eo *eo_obj, Efl_Canvas_Text_Data *o) | 8371 | _efl_canvas_text_canvas_efl_text_markup_markup_get(const Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o) | ||
8372 | { | 8372 | { | ||
8373 | return _evas_object_textblock_text_markup_get(eo_obj, o); | 8373 | return _evas_object_textblock_text_markup_get(eo_obj, o); | ||
8374 | } | 8374 | } | ||
8375 | 8375 | | |||
8376 | EAPI char * | 8376 | EAPI char * | ||
8377 | evas_textblock_text_markup_to_utf8(const Evas_Object *eo_obj, const char *text) | 8377 | evas_textblock_text_markup_to_utf8(const Evas_Object *eo_obj, const char *text) | ||
8378 | { | 8378 | { | ||
8379 | /* FIXME: Redundant and awful, should be merged with markup_prepend */ | 8379 | /* FIXME: Redundant and awful, should be merged with markup_prepend */ | ||
▲ Show 20 Lines • Show All 195 Lines • ▼ Show 20 Line(s) | 8570 | { | |||
8575 | EINA_LIST_FOREACH(c->o->obstacles, i, obs) | 8575 | EINA_LIST_FOREACH(c->o->obstacles, i, obs) | ||
8576 | { | 8576 | { | ||
8577 | if (obstacle_changed) | 8577 | if (obstacle_changed) | ||
8578 | _obstacle_update(obs, c->obj); | 8578 | _obstacle_update(obs, c->obj); | ||
8579 | } | 8579 | } | ||
8580 | } | 8580 | } | ||
8581 | 8581 | | |||
8582 | static Evas_Textblock_Obstacle * | 8582 | static Evas_Textblock_Obstacle * | ||
8583 | _obstacle_find(Efl_Canvas_Text_Data *o, Eo *eo_obs) | 8583 | _obstacle_find(Efl_Canvas_Text_Canvas_Data *o, Eo *eo_obs) | ||
8584 | { | 8584 | { | ||
8585 | Evas_Textblock_Obstacle *obs; | 8585 | Evas_Textblock_Obstacle *obs; | ||
8586 | Eina_List *i; | 8586 | Eina_List *i; | ||
8587 | 8587 | | |||
8588 | EINA_LIST_FOREACH(o->obstacles, i, obs) | 8588 | EINA_LIST_FOREACH(o->obstacles, i, obs) | ||
8589 | { | 8589 | { | ||
8590 | if (eo_obs == obs->eo_obs) | 8590 | if (eo_obs == obs->eo_obs) | ||
8591 | return obs; | 8591 | return obs; | ||
8592 | } | 8592 | } | ||
8593 | return NULL; | 8593 | return NULL; | ||
8594 | } | 8594 | } | ||
8595 | 8595 | | |||
8596 | void | 8596 | void | ||
8597 | _obstacle_del_cb(void *data, const Efl_Event *event) | 8597 | _obstacle_del_cb(void *data, const Efl_Event *event) | ||
8598 | { | 8598 | { | ||
8599 | Eo *eo_obj = data; | 8599 | Eo *eo_obj = data; | ||
8600 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 8600 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
8601 | Eina_List *i; | 8601 | Eina_List *i; | ||
8602 | Evas_Textblock_Obstacle *obs; | 8602 | Evas_Textblock_Obstacle *obs; | ||
8603 | 8603 | | |||
8604 | EINA_LIST_FOREACH(o->obstacles, i, obs) | 8604 | EINA_LIST_FOREACH(o->obstacles, i, obs) | ||
8605 | { | 8605 | { | ||
8606 | if (event->object == obs->eo_obs) | 8606 | if (event->object == obs->eo_obs) | ||
8607 | break; | 8607 | break; | ||
8608 | } | 8608 | } | ||
Show All 12 Lines | |||||
8621 | static void | 8621 | static void | ||
8622 | _obstacle_free(Eo *eo_obj, Evas_Textblock_Obstacle *obs) | 8622 | _obstacle_free(Eo *eo_obj, Evas_Textblock_Obstacle *obs) | ||
8623 | { | 8623 | { | ||
8624 | _obstacle_clear(eo_obj, obs); | 8624 | _obstacle_clear(eo_obj, obs); | ||
8625 | free(obs); | 8625 | free(obs); | ||
8626 | } | 8626 | } | ||
8627 | 8627 | | |||
8628 | static void | 8628 | static void | ||
8629 | _obstacles_free(Eo *eo_obj, Efl_Canvas_Text_Data *o) | 8629 | _obstacles_free(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o) | ||
8630 | { | 8630 | { | ||
8631 | Evas_Textblock_Obstacle *obs; | 8631 | Evas_Textblock_Obstacle *obs; | ||
8632 | 8632 | | |||
8633 | EINA_LIST_FREE(o->obstacles, obs) | 8633 | EINA_LIST_FREE(o->obstacles, obs) | ||
8634 | { | 8634 | { | ||
8635 | _obstacle_free(eo_obj, obs); | 8635 | _obstacle_free(eo_obj, obs); | ||
8636 | } | 8636 | } | ||
8637 | } | 8637 | } | ||
8638 | 8638 | | |||
8639 | EOLIAN static Eina_Bool | 8639 | EOLIAN static Eina_Bool | ||
8640 | _efl_canvas_text_obstacle_add(Eo *eo_obj, | 8640 | _efl_canvas_text_canvas_obstacle_add(Eo *eo_obj, | ||
8641 | Efl_Canvas_Text_Data *o, Eo *eo_obs) | 8641 | Efl_Canvas_Text_Canvas_Data *o, Eo *eo_obs) | ||
8642 | { | 8642 | { | ||
8643 | Evas_Textblock_Obstacle *obs; | 8643 | Evas_Textblock_Obstacle *obs; | ||
8644 | 8644 | | |||
8645 | if (!efl_isa(eo_obs, EFL_CANVAS_OBJECT_CLASS)) | 8645 | if (!efl_isa(eo_obs, EFL_CANVAS_OBJECT_CLASS)) | ||
8646 | return EINA_FALSE; | 8646 | return EINA_FALSE; | ||
8647 | obs = _obstacle_find(o, eo_obs); | 8647 | obs = _obstacle_find(o, eo_obs); | ||
8648 | if (obs) return EINA_FALSE; | 8648 | if (obs) return EINA_FALSE; | ||
8649 | 8649 | | |||
8650 | obs = calloc(1, sizeof(Evas_Textblock_Obstacle)); | 8650 | obs = calloc(1, sizeof(Evas_Textblock_Obstacle)); | ||
8651 | if (!obs) return EINA_FALSE; | 8651 | if (!obs) return EINA_FALSE; | ||
8652 | 8652 | | |||
8653 | obs->eo_obs = eo_obs; | 8653 | obs->eo_obs = eo_obs; | ||
8654 | efl_event_callback_add(eo_obs, EFL_EVENT_DEL, _obstacle_del_cb, eo_obj); | 8654 | efl_event_callback_add(eo_obs, EFL_EVENT_DEL, _obstacle_del_cb, eo_obj); | ||
8655 | 8655 | | |||
8656 | o->obstacles = eina_list_append(o->obstacles, obs); | 8656 | o->obstacles = eina_list_append(o->obstacles, obs); | ||
8657 | _obstacle_update(obs, eo_obj); | 8657 | _obstacle_update(obs, eo_obj); | ||
8658 | _evas_textblock_changed(o, eo_obj); | 8658 | _evas_textblock_changed(o, eo_obj); | ||
8659 | o->obstacle_changed = EINA_TRUE; | 8659 | o->obstacle_changed = EINA_TRUE; | ||
8660 | return EINA_TRUE; | 8660 | return EINA_TRUE; | ||
8661 | } | 8661 | } | ||
8662 | 8662 | | |||
8663 | EOLIAN static Eina_Bool | 8663 | EOLIAN static Eina_Bool | ||
8664 | _efl_canvas_text_obstacle_del(Eo *eo_obj, Efl_Canvas_Text_Data *o, | 8664 | _efl_canvas_text_canvas_obstacle_del(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o, | ||
8665 | Eo *eo_obs EINA_UNUSED) | 8665 | Eo *eo_obs EINA_UNUSED) | ||
8666 | { | 8666 | { | ||
8667 | Evas_Textblock_Obstacle *obs; | 8667 | Evas_Textblock_Obstacle *obs; | ||
8668 | Eina_List *i; | 8668 | Eina_List *i; | ||
8669 | 8669 | | |||
8670 | if (!efl_isa(eo_obs, EFL_CANVAS_OBJECT_CLASS)) | 8670 | if (!efl_isa(eo_obs, EFL_CANVAS_OBJECT_CLASS)) | ||
8671 | return EINA_FALSE; | 8671 | return EINA_FALSE; | ||
8672 | 8672 | | |||
8673 | EINA_LIST_FOREACH(o->obstacles, i, obs) | 8673 | EINA_LIST_FOREACH(o->obstacles, i, obs) | ||
8674 | { | 8674 | { | ||
8675 | if (eo_obs == obs->eo_obs) | 8675 | if (eo_obs == obs->eo_obs) | ||
8676 | { | 8676 | { | ||
8677 | break; | 8677 | break; | ||
8678 | } | 8678 | } | ||
8679 | } | 8679 | } | ||
8680 | if (!i) return EINA_FALSE; | 8680 | if (!i) return EINA_FALSE; | ||
8681 | o->obstacles = eina_list_remove_list(o->obstacles, i); | 8681 | o->obstacles = eina_list_remove_list(o->obstacles, i); | ||
8682 | _obstacle_free(eo_obj, obs); | 8682 | _obstacle_free(eo_obj, obs); | ||
8683 | _evas_textblock_changed(o, eo_obj); | 8683 | _evas_textblock_changed(o, eo_obj); | ||
8684 | o->obstacle_changed = EINA_TRUE; | 8684 | o->obstacle_changed = EINA_TRUE; | ||
8685 | return EINA_TRUE; | 8685 | return EINA_TRUE; | ||
8686 | } | 8686 | } | ||
8687 | 8687 | | |||
8688 | EOLIAN static void | 8688 | EOLIAN static void | ||
8689 | _efl_canvas_text_obstacles_update(Eo *eo_obj, Efl_Canvas_Text_Data *obj) | 8689 | _efl_canvas_text_canvas_obstacles_update(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *obj) | ||
8690 | { | 8690 | { | ||
8691 | _evas_textblock_changed(obj, eo_obj); | 8691 | _evas_textblock_changed(obj, eo_obj); | ||
8692 | obj->obstacle_changed = EINA_TRUE; | 8692 | obj->obstacle_changed = EINA_TRUE; | ||
8693 | } | 8693 | } | ||
8694 | 8694 | | |||
8695 | static Evas_Textblock_Obstacle * | 8695 | static Evas_Textblock_Obstacle * | ||
8696 | _layout_item_obstacle_get(Ctxt *c, Evas_Object_Textblock_Item *it) | 8696 | _layout_item_obstacle_get(Ctxt *c, Evas_Object_Textblock_Item *it) | ||
8697 | { | 8697 | { | ||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Line(s) | |||||
8767 | * @internal | 8767 | * @internal | ||
8768 | * Merge the current node with the next, no need to remove PS, already | 8768 | * Merge the current node with the next, no need to remove PS, already | ||
8769 | * not there. | 8769 | * not there. | ||
8770 | * | 8770 | * | ||
8771 | * @param o the text block object. | 8771 | * @param o the text block object. | ||
8772 | * @param to merge into to. | 8772 | * @param to merge into to. | ||
8773 | */ | 8773 | */ | ||
8774 | static void | 8774 | static void | ||
8775 | _evas_textblock_nodes_merge(Efl_Canvas_Text_Data *o, Evas_Object_Textblock_Node_Text *to) | 8775 | _evas_textblock_nodes_merge(Efl_Canvas_Text_Canvas_Data *o, Evas_Object_Textblock_Node_Text *to) | ||
8776 | { | 8776 | { | ||
8777 | Evas_Object_Textblock_Node_Format *itr; | 8777 | Evas_Object_Textblock_Node_Format *itr; | ||
8778 | Evas_Object_Textblock_Node_Format *pnode; | 8778 | Evas_Object_Textblock_Node_Format *pnode; | ||
8779 | Evas_Object_Textblock_Node_Text *from; | 8779 | Evas_Object_Textblock_Node_Text *from; | ||
8780 | const Eina_Unicode *text; | 8780 | const Eina_Unicode *text; | ||
8781 | int to_len, len; | 8781 | int to_len, len; | ||
8782 | 8782 | | |||
8783 | if (!to) return; | 8783 | if (!to) return; | ||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | |||||
8835 | _evas_textblock_cursor_nodes_merge(Efl_Text_Cursor_Cursor *cur) | 8835 | _evas_textblock_cursor_nodes_merge(Efl_Text_Cursor_Cursor *cur) | ||
8836 | { | 8836 | { | ||
8837 | Evas_Object_Textblock_Node_Text *nnode; | 8837 | Evas_Object_Textblock_Node_Text *nnode; | ||
8838 | int len; | 8838 | int len; | ||
8839 | if (!cur) return; | 8839 | if (!cur) return; | ||
8840 | 8840 | | |||
8841 | len = eina_ustrbuf_length_get(cur->node->unicode); | 8841 | len = eina_ustrbuf_length_get(cur->node->unicode); | ||
8842 | 8842 | | |||
8843 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 8843 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
8844 | nnode = _NODE_TEXT(EINA_INLIST_GET(cur->node)->next); | 8844 | nnode = _NODE_TEXT(EINA_INLIST_GET(cur->node)->next); | ||
8845 | _evas_textblock_nodes_merge(o, cur->node); | 8845 | _evas_textblock_nodes_merge(o, cur->node); | ||
8846 | _evas_textblock_cursors_update_offset(cur, nnode, 0, len); | 8846 | _evas_textblock_cursors_update_offset(cur, nnode, 0, len); | ||
8847 | _evas_textblock_cursors_set_node(o, nnode, cur->node); | 8847 | _evas_textblock_cursors_set_node(o, nnode, cur->node); | ||
8848 | Efl_Text_Cursor_Cursor *co = o->cursor; | 8848 | Efl_Text_Cursor_Cursor *co = o->cursor; | ||
8849 | if (nnode == co->node) | 8849 | if (nnode == co->node) | ||
8850 | { | 8850 | { | ||
8851 | co->node = cur->node; | 8851 | co->node = cur->node; | ||
▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Line(s) | 9006 | { | |||
9027 | return previous_format; | 9027 | return previous_format; | ||
9028 | } | 9028 | } | ||
9029 | 9029 | | |||
9030 | static void | 9030 | static void | ||
9031 | _evas_textblock_cursor_init(Efl_Text_Cursor_Cursor *cur, const Evas_Object *tb) | 9031 | _evas_textblock_cursor_init(Efl_Text_Cursor_Cursor *cur, const Evas_Object *tb) | ||
9032 | { | 9032 | { | ||
9033 | cur->obj = (Eo *) tb; | 9033 | cur->obj = (Eo *) tb; | ||
9034 | 9034 | | |||
9035 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 9035 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
9036 | cur->node = o->text_nodes; | 9036 | cur->node = o->text_nodes; | ||
9037 | cur->pos = 0; | 9037 | cur->pos = 0; | ||
9038 | } | 9038 | } | ||
9039 | 9039 | | |||
9040 | EAPI Efl_Text_Cursor_Cursor * | 9040 | EAPI Efl_Text_Cursor_Cursor * | ||
9041 | evas_object_textblock_cursor_new(const Evas_Object *eo_obj) | 9041 | evas_object_textblock_cursor_new(const Evas_Object *eo_obj) | ||
9042 | { | 9042 | { | ||
9043 | EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, NULL); | 9043 | EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, NULL); | ||
9044 | return efl_text_cursor_new((Eo *) eo_obj); | 9044 | return efl_text_cursor_new((Eo *) eo_obj); | ||
9045 | } | 9045 | } | ||
9046 | 9046 | | |||
9047 | EAPI void | 9047 | EAPI void | ||
9048 | evas_textblock_cursor_free(Evas_Textblock_Cursor *cur) | 9048 | evas_textblock_cursor_free(Evas_Textblock_Cursor *cur) | ||
9049 | { | 9049 | { | ||
9050 | if (!cur) return; | 9050 | if (!cur) return; | ||
9051 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 9051 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
9052 | if (cur == o->cursor) return; | 9052 | if (cur == o->cursor) return; | ||
9053 | o->cursors = eina_list_remove(o->cursors, cur); | 9053 | o->cursors = eina_list_remove(o->cursors, cur); | ||
9054 | free(cur); | 9054 | free(cur); | ||
9055 | } | 9055 | } | ||
9056 | 9056 | | |||
9057 | EAPI Eina_Bool | 9057 | EAPI Eina_Bool | ||
9058 | _evas_textblock_cursor_is_format(const Efl_Text_Cursor_Cursor *cur) | 9058 | _evas_textblock_cursor_is_format(const Efl_Text_Cursor_Cursor *cur) | ||
9059 | { | 9059 | { | ||
Show All 11 Lines | |||||
9071 | } | 9071 | } | ||
9072 | 9072 | | |||
9073 | EAPI const Eina_List * | 9073 | EAPI const Eina_List * | ||
9074 | evas_textblock_node_format_list_get(const Eo *eo_obj, const char *anchor) | 9074 | evas_textblock_node_format_list_get(const Eo *eo_obj, const char *anchor) | ||
9075 | { | 9075 | { | ||
9076 | EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, NULL); | 9076 | EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, NULL); | ||
9077 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 9077 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
9078 | evas_object_async_block(obj); | 9078 | evas_object_async_block(obj); | ||
9079 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 9079 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
9080 | if (!strcmp(anchor, "a")) | 9080 | if (!strcmp(anchor, "a")) | ||
9081 | return o->anchors_a; | 9081 | return o->anchors_a; | ||
9082 | else if (!strcmp(anchor, "item")) | 9082 | else if (!strcmp(anchor, "item")) | ||
9083 | return o->anchors_item; | 9083 | return o->anchors_item; | ||
9084 | return NULL; | 9084 | return NULL; | ||
9085 | } | 9085 | } | ||
9086 | 9086 | | |||
9087 | EAPI const Evas_Object_Textblock_Node_Format* | 9087 | EAPI const Evas_Object_Textblock_Node_Format* | ||
9088 | evas_textblock_node_format_first_get(Evas_Object *eo_obj) | 9088 | evas_textblock_node_format_first_get(Evas_Object *eo_obj) | ||
9089 | { | 9089 | { | ||
9090 | EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, NULL); | 9090 | EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, NULL); | ||
9091 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 9091 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
9092 | evas_object_async_block(obj); | 9092 | evas_object_async_block(obj); | ||
9093 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 9093 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
9094 | return o->format_nodes; | 9094 | return o->format_nodes; | ||
9095 | } | 9095 | } | ||
9096 | 9096 | | |||
9097 | EAPI const Evas_Object_Textblock_Node_Format* | 9097 | EAPI const Evas_Object_Textblock_Node_Format* | ||
9098 | evas_textblock_node_format_last_get(Evas_Object *eo_obj) | 9098 | evas_textblock_node_format_last_get(Evas_Object *eo_obj) | ||
9099 | { | 9099 | { | ||
9100 | EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, NULL); | 9100 | EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, NULL); | ||
9101 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 9101 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
9102 | evas_object_async_block(obj); | 9102 | evas_object_async_block(obj); | ||
9103 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 9103 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
9104 | return o->format_nodes ? _NODE_FORMAT(EINA_INLIST_GET(o->format_nodes)->last) : NULL; | 9104 | return o->format_nodes ? _NODE_FORMAT(EINA_INLIST_GET(o->format_nodes)->last) : NULL; | ||
9105 | } | 9105 | } | ||
9106 | 9106 | | |||
9107 | EAPI const Evas_Object_Textblock_Node_Format * | 9107 | EAPI const Evas_Object_Textblock_Node_Format * | ||
9108 | evas_textblock_node_format_next_get(const Evas_Object_Textblock_Node_Format *n) | 9108 | evas_textblock_node_format_next_get(const Evas_Object_Textblock_Node_Format *n) | ||
9109 | { | 9109 | { | ||
9110 | if (!n) return NULL; | 9110 | if (!n) return NULL; | ||
9111 | return _NODE_FORMAT(EINA_INLIST_GET(n)->next); | 9111 | return _NODE_FORMAT(EINA_INLIST_GET(n)->next); | ||
Show All 15 Lines | 9123 | { | |||
9127 | Eina_List *fstack = NULL; | 9127 | Eina_List *fstack = NULL; | ||
9128 | 9128 | | |||
9129 | if (!n) return; | 9129 | if (!n) return; | ||
9130 | 9130 | | |||
9131 | fmt = n; | 9131 | fmt = n; | ||
9132 | 9132 | | |||
9133 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 9133 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
9134 | evas_object_async_block(obj); | 9134 | evas_object_async_block(obj); | ||
9135 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 9135 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
9136 | do | 9136 | do | ||
9137 | { | 9137 | { | ||
9138 | const char *fstr = fmt->orig_format; | 9138 | const char *fstr = fmt->orig_format; | ||
9139 | 9139 | | |||
9140 | if (fmt->opener && !fmt->own_closer) | 9140 | if (fmt->opener && !fmt->own_closer) | ||
9141 | { | 9141 | { | ||
9142 | fstack = eina_list_prepend(fstack, fmt); | 9142 | fstack = eina_list_prepend(fstack, fmt); | ||
9143 | } | 9143 | } | ||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Line(s) | |||||
9229 | } | 9229 | } | ||
9230 | 9230 | | |||
9231 | EAPI void | 9231 | EAPI void | ||
9232 | evas_textblock_cursor_paragraph_first(Efl_Text_Cursor_Cursor *cur) | 9232 | evas_textblock_cursor_paragraph_first(Efl_Text_Cursor_Cursor *cur) | ||
9233 | { | 9233 | { | ||
9234 | if (!cur) return; | 9234 | if (!cur) return; | ||
9235 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 9235 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
9236 | evas_object_async_block(obj); | 9236 | evas_object_async_block(obj); | ||
9237 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 9237 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
9238 | cur->node = o->text_nodes; | 9238 | cur->node = o->text_nodes; | ||
9239 | cur->pos = 0; | 9239 | cur->pos = 0; | ||
9240 | } | 9240 | } | ||
9241 | 9241 | | |||
9242 | EOLIAN static void | 9242 | EOLIAN static void | ||
9243 | _efl_canvas_text_efl_text_cursor_cursor_paragraph_first(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | 9243 | _efl_canvas_text_canvas_efl_text_cursor_cursor_paragraph_first(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | ||
9244 | { | 9244 | { | ||
9245 | ASYNC_BLOCK; | 9245 | ASYNC_BLOCK; | ||
9246 | evas_textblock_cursor_paragraph_first(cur); | 9246 | evas_textblock_cursor_paragraph_first(cur); | ||
9247 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 9247 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
9248 | } | 9248 | } | ||
9249 | 9249 | | |||
9250 | EAPI void | 9250 | EAPI void | ||
9251 | evas_textblock_cursor_paragraph_last(Efl_Text_Cursor_Cursor *cur) | 9251 | evas_textblock_cursor_paragraph_last(Efl_Text_Cursor_Cursor *cur) | ||
9252 | { | 9252 | { | ||
9253 | Evas_Object_Textblock_Node_Text *node; | 9253 | Evas_Object_Textblock_Node_Text *node; | ||
9254 | 9254 | | |||
9255 | if (!cur) return; | 9255 | if (!cur) return; | ||
9256 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 9256 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
9257 | evas_object_async_block(obj); | 9257 | evas_object_async_block(obj); | ||
9258 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 9258 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
9259 | node = o->text_nodes; | 9259 | node = o->text_nodes; | ||
9260 | if (node) | 9260 | if (node) | ||
9261 | { | 9261 | { | ||
9262 | node = _NODE_TEXT(EINA_INLIST_GET(node)->last); | 9262 | node = _NODE_TEXT(EINA_INLIST_GET(node)->last); | ||
9263 | cur->node = node; | 9263 | cur->node = node; | ||
9264 | cur->pos = 0; | 9264 | cur->pos = 0; | ||
9265 | evas_textblock_cursor_paragraph_char_last(cur); | 9265 | evas_textblock_cursor_paragraph_char_last(cur); | ||
9266 | } | 9266 | } | ||
9267 | else | 9267 | else | ||
9268 | { | 9268 | { | ||
9269 | cur->node = NULL; | 9269 | cur->node = NULL; | ||
9270 | cur->pos = 0; | 9270 | cur->pos = 0; | ||
9271 | } | 9271 | } | ||
9272 | } | 9272 | } | ||
9273 | 9273 | | |||
9274 | EOLIAN static void | 9274 | EOLIAN static void | ||
9275 | _efl_canvas_text_efl_text_cursor_cursor_paragraph_last(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | 9275 | _efl_canvas_text_canvas_efl_text_cursor_cursor_paragraph_last(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | ||
9276 | { | 9276 | { | ||
9277 | ASYNC_BLOCK; | 9277 | ASYNC_BLOCK; | ||
9278 | evas_textblock_cursor_paragraph_last(cur); | 9278 | evas_textblock_cursor_paragraph_last(cur); | ||
9279 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 9279 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
9280 | } | 9280 | } | ||
9281 | 9281 | | |||
9282 | static Eina_Bool | 9282 | static Eina_Bool | ||
9283 | _evas_textblock_cursor_paragraph_next(Efl_Text_Cursor_Cursor *cur) | 9283 | _evas_textblock_cursor_paragraph_next(Efl_Text_Cursor_Cursor *cur) | ||
9284 | { | 9284 | { | ||
9285 | if (!cur) return EINA_FALSE; | 9285 | if (!cur) return EINA_FALSE; | ||
9286 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 9286 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
9287 | evas_object_async_block(obj); | 9287 | evas_object_async_block(obj); | ||
Show All 18 Lines | |||||
9306 | EAPI Eina_Bool | 9306 | EAPI Eina_Bool | ||
9307 | evas_textblock_cursor_paragraph_next(Efl_Text_Cursor_Cursor *cur) | 9307 | evas_textblock_cursor_paragraph_next(Efl_Text_Cursor_Cursor *cur) | ||
9308 | { | 9308 | { | ||
9309 | if (!cur) return EINA_FALSE; | 9309 | if (!cur) return EINA_FALSE; | ||
9310 | return _evas_textblock_cursor_paragraph_next(cur); | 9310 | return _evas_textblock_cursor_paragraph_next(cur); | ||
9311 | } | 9311 | } | ||
9312 | 9312 | | |||
9313 | EOLIAN static void | 9313 | EOLIAN static void | ||
9314 | _efl_canvas_text_efl_text_cursor_cursor_paragraph_next(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Evas_Textblock_Cursor *cur) | 9314 | _efl_canvas_text_canvas_efl_text_cursor_cursor_paragraph_next(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Evas_Textblock_Cursor *cur) | ||
9315 | { | 9315 | { | ||
9316 | ASYNC_BLOCK; | 9316 | ASYNC_BLOCK; | ||
9317 | evas_textblock_cursor_paragraph_next(cur); | 9317 | evas_textblock_cursor_paragraph_next(cur); | ||
9318 | efl_event_callback_legacy_call(obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 9318 | efl_event_callback_legacy_call(obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
9319 | } | 9319 | } | ||
9320 | 9320 | | |||
9321 | static Eina_Bool | 9321 | static Eina_Bool | ||
9322 | _evas_textblock_cursor_paragraph_prev(Efl_Text_Cursor_Cursor *cur) | 9322 | _evas_textblock_cursor_paragraph_prev(Efl_Text_Cursor_Cursor *cur) | ||
9323 | { | 9323 | { | ||
9324 | Evas_Object_Textblock_Node_Text *node; | 9324 | Evas_Object_Textblock_Node_Text *node; | ||
9325 | if (!cur) return EINA_FALSE; | 9325 | if (!cur) return EINA_FALSE; | ||
9326 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 9326 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
Show All 23 Lines | |||||
9350 | EAPI Eina_Bool | 9350 | EAPI Eina_Bool | ||
9351 | evas_textblock_cursor_paragraph_prev(Efl_Text_Cursor_Cursor *cur) | 9351 | evas_textblock_cursor_paragraph_prev(Efl_Text_Cursor_Cursor *cur) | ||
9352 | { | 9352 | { | ||
9353 | if (!cur) return EINA_FALSE; | 9353 | if (!cur) return EINA_FALSE; | ||
9354 | return _evas_textblock_cursor_paragraph_prev(cur); | 9354 | return _evas_textblock_cursor_paragraph_prev(cur); | ||
9355 | } | 9355 | } | ||
9356 | 9356 | | |||
9357 | EOLIAN static void | 9357 | EOLIAN static void | ||
9358 | _efl_canvas_text_efl_text_cursor_cursor_paragraph_prev(Eo *obj EINA_UNUSED, | 9358 | _efl_canvas_text_canvas_efl_text_cursor_cursor_paragraph_prev(Eo *obj EINA_UNUSED, | ||
9359 | Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | 9359 | Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | ||
9360 | { | 9360 | { | ||
9361 | ASYNC_BLOCK; | 9361 | ASYNC_BLOCK; | ||
9362 | _evas_textblock_cursor_paragraph_prev(cur); | 9362 | _evas_textblock_cursor_paragraph_prev(cur); | ||
9363 | efl_event_callback_legacy_call(obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 9363 | efl_event_callback_legacy_call(obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
9364 | } | 9364 | } | ||
9365 | 9365 | | |||
9366 | EAPI void | 9366 | EAPI void | ||
9367 | evas_textblock_cursor_set_at_format(Evas_Textblock_Cursor *cur, const Evas_Object_Textblock_Node_Format *n) | 9367 | evas_textblock_cursor_set_at_format(Evas_Textblock_Cursor *cur, const Evas_Object_Textblock_Node_Format *n) | ||
9368 | { | 9368 | { | ||
9369 | evas_textblock_cursor_at_format_set(cur, n); | 9369 | evas_textblock_cursor_at_format_set(cur, n); | ||
9370 | } | 9370 | } | ||
9371 | 9371 | | |||
▲ Show 20 Lines • Show All 134 Lines • ▼ Show 20 Line(s) | 9455 | { | |||
9506 | 9506 | | |||
9507 | cur->pos = i; | 9507 | cur->pos = i; | ||
9508 | 9508 | | |||
9509 | free(breaks); | 9509 | free(breaks); | ||
9510 | return EINA_TRUE; | 9510 | return EINA_TRUE; | ||
9511 | } | 9511 | } | ||
9512 | 9512 | | |||
9513 | EOLIAN static void | 9513 | EOLIAN static void | ||
9514 | _efl_canvas_text_efl_text_cursor_cursor_word_start(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur EINA_UNUSED) | 9514 | _efl_canvas_text_canvas_efl_text_cursor_cursor_word_start(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur EINA_UNUSED) | ||
9515 | { | 9515 | { | ||
9516 | ASYNC_BLOCK; | 9516 | ASYNC_BLOCK; | ||
9517 | evas_textblock_cursor_word_start(cur); | 9517 | evas_textblock_cursor_word_start(cur); | ||
9518 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 9518 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
9519 | } | 9519 | } | ||
9520 | 9520 | | |||
9521 | EAPI Eina_Bool | 9521 | EAPI Eina_Bool | ||
9522 | evas_textblock_cursor_word_end(Efl_Text_Cursor_Cursor *cur) | 9522 | evas_textblock_cursor_word_end(Efl_Text_Cursor_Cursor *cur) | ||
9523 | { | 9523 | { | ||
9524 | if (!cur) return EINA_FALSE; | 9524 | if (!cur) return EINA_FALSE; | ||
9525 | const Eina_Unicode *text; | 9525 | const Eina_Unicode *text; | ||
9526 | size_t i; | 9526 | size_t i; | ||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | |||||
9568 | 9568 | | |||
9569 | cur->pos = i; | 9569 | cur->pos = i; | ||
9570 | 9570 | | |||
9571 | free(breaks); | 9571 | free(breaks); | ||
9572 | return EINA_TRUE; | 9572 | return EINA_TRUE; | ||
9573 | } | 9573 | } | ||
9574 | 9574 | | |||
9575 | EOLIAN static void | 9575 | EOLIAN static void | ||
9576 | _efl_canvas_text_efl_text_cursor_cursor_word_end(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur EINA_UNUSED) | 9576 | _efl_canvas_text_canvas_efl_text_cursor_cursor_word_end(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur EINA_UNUSED) | ||
9577 | { | 9577 | { | ||
9578 | ASYNC_BLOCK; | 9578 | ASYNC_BLOCK; | ||
9579 | evas_textblock_cursor_word_end(cur); | 9579 | evas_textblock_cursor_word_end(cur); | ||
9580 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 9580 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
9581 | } | 9581 | } | ||
9582 | 9582 | | |||
9583 | static char * | 9583 | static char * | ||
9584 | _evas_textblock_grapheme_breaks_new(Evas_Object_Textblock_Item *it, size_t len) | 9584 | _evas_textblock_grapheme_breaks_new(Evas_Object_Textblock_Item *it, size_t len) | ||
9585 | { | 9585 | { | ||
9586 | char *grapheme_breaks = NULL; | 9586 | char *grapheme_breaks = NULL; | ||
9587 | const char *lang = (it->format->font.fdesc) ? it->format->font.fdesc->lang : ""; | 9587 | const char *lang = (it->format->font.fdesc) ? it->format->font.fdesc->lang : ""; | ||
9588 | 9588 | | |||
9589 | grapheme_breaks = malloc(len); | 9589 | grapheme_breaks = malloc(len); | ||
9590 | if (!grapheme_breaks) return NULL; | 9590 | if (!grapheme_breaks) return NULL; | ||
9591 | 9591 | | |||
9592 | set_graphemebreaks_utf32((const utf32_t *) | 9592 | set_graphemebreaks_utf32((const utf32_t *) | ||
9593 | eina_ustrbuf_string_get( | 9593 | eina_ustrbuf_string_get( | ||
9594 | it->text_node->unicode), | 9594 | it->text_node->unicode), | ||
9595 | len, lang, grapheme_breaks); | 9595 | len, lang, grapheme_breaks); | ||
9596 | 9596 | | |||
9597 | return grapheme_breaks; | 9597 | return grapheme_breaks; | ||
9598 | } | 9598 | } | ||
9599 | 9599 | | |||
9600 | static size_t | 9600 | static size_t | ||
9601 | _evas_textblock_cursor_cluster_pos_get(Evas_Textblock_Cursor *cur, Eina_Bool inc) | 9601 | _evas_textblock_cursor_cluster_pos_get(Evas_Textblock_Cursor *cur, Eina_Bool inc) | ||
9602 | { | 9602 | { | ||
9603 | Evas_Object_Textblock_Paragraph *par; | 9603 | Evas_Object_Textblock_Paragraph *par; | ||
9604 | Efl_Canvas_Text_Data *o; | 9604 | Efl_Canvas_Text_Canvas_Data *o; | ||
9605 | size_t cur_pos = cur->pos; | 9605 | size_t cur_pos = cur->pos; | ||
9606 | size_t ret = cur->pos; | 9606 | size_t ret = cur->pos; | ||
9607 | 9607 | | |||
9608 | if (!inc) cur_pos--; | 9608 | if (!inc) cur_pos--; | ||
9609 | 9609 | | |||
9610 | if (!cur->node->par) | 9610 | if (!cur->node->par) | ||
9611 | { | 9611 | { | ||
9612 | o = efl_data_scope_get(cur->obj, MY_CLASS); | 9612 | o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
▲ Show 20 Lines • Show All 141 Lines • ▼ Show 20 Line(s) | |||||
9754 | 9754 | | |||
9755 | EAPI Eina_Bool | 9755 | EAPI Eina_Bool | ||
9756 | evas_textblock_cursor_char_next(Efl_Text_Cursor_Cursor *cur) | 9756 | evas_textblock_cursor_char_next(Efl_Text_Cursor_Cursor *cur) | ||
9757 | { | 9757 | { | ||
9758 | return _evas_textblock_cursor_next(cur, EINA_FALSE); | 9758 | return _evas_textblock_cursor_next(cur, EINA_FALSE); | ||
9759 | } | 9759 | } | ||
9760 | 9760 | | |||
9761 | EOLIAN static void | 9761 | EOLIAN static void | ||
9762 | _efl_canvas_text_efl_text_cursor_cursor_char_next(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | 9762 | _efl_canvas_text_canvas_efl_text_cursor_cursor_char_next(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | ||
9763 | { | 9763 | { | ||
9764 | ASYNC_BLOCK; | 9764 | ASYNC_BLOCK; | ||
9765 | if (_evas_textblock_cursor_next(cur, EINA_FALSE)) | 9765 | if (_evas_textblock_cursor_next(cur, EINA_FALSE)) | ||
9766 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 9766 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
9767 | } | 9767 | } | ||
9768 | 9768 | | |||
9769 | EAPI Eina_Bool | 9769 | EAPI Eina_Bool | ||
9770 | evas_textblock_cursor_char_prev(Efl_Text_Cursor_Cursor *cur) | 9770 | evas_textblock_cursor_char_prev(Efl_Text_Cursor_Cursor *cur) | ||
9771 | { | 9771 | { | ||
9772 | return _evas_textblock_cursor_prev(cur, EINA_FALSE); | 9772 | return _evas_textblock_cursor_prev(cur, EINA_FALSE); | ||
9773 | } | 9773 | } | ||
9774 | 9774 | | |||
9775 | EOLIAN static void | 9775 | EOLIAN static void | ||
9776 | _efl_canvas_text_efl_text_cursor_cursor_char_prev(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | 9776 | _efl_canvas_text_canvas_efl_text_cursor_cursor_char_prev(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | ||
9777 | { | 9777 | { | ||
9778 | ASYNC_BLOCK; | 9778 | ASYNC_BLOCK; | ||
9779 | if (_evas_textblock_cursor_prev(cur, EINA_FALSE)) | 9779 | if (_evas_textblock_cursor_prev(cur, EINA_FALSE)) | ||
9780 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 9780 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
9781 | } | 9781 | } | ||
9782 | 9782 | | |||
9783 | EAPI Eina_Bool | 9783 | EAPI Eina_Bool | ||
9784 | evas_textblock_cursor_cluster_next(Efl_Text_Cursor_Cursor *cur) | 9784 | evas_textblock_cursor_cluster_next(Efl_Text_Cursor_Cursor *cur) | ||
9785 | { | 9785 | { | ||
9786 | return _evas_textblock_cursor_next(cur, EINA_TRUE); | 9786 | return _evas_textblock_cursor_next(cur, EINA_TRUE); | ||
9787 | } | 9787 | } | ||
9788 | 9788 | | |||
9789 | EOLIAN static void | 9789 | EOLIAN static void | ||
9790 | _efl_canvas_text_efl_text_cursor_cursor_cluster_next(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | 9790 | _efl_canvas_text_canvas_efl_text_cursor_cursor_cluster_next(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | ||
9791 | { | 9791 | { | ||
9792 | ASYNC_BLOCK; | 9792 | ASYNC_BLOCK; | ||
9793 | if (_evas_textblock_cursor_next(cur, EINA_TRUE)) | 9793 | if (_evas_textblock_cursor_next(cur, EINA_TRUE)) | ||
9794 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 9794 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
9795 | } | 9795 | } | ||
9796 | 9796 | | |||
9797 | EAPI Eina_Bool | 9797 | EAPI Eina_Bool | ||
9798 | evas_textblock_cursor_cluster_prev(Efl_Text_Cursor_Cursor *cur) | 9798 | evas_textblock_cursor_cluster_prev(Efl_Text_Cursor_Cursor *cur) | ||
9799 | { | 9799 | { | ||
9800 | return _evas_textblock_cursor_prev(cur, EINA_TRUE); | 9800 | return _evas_textblock_cursor_prev(cur, EINA_TRUE); | ||
9801 | } | 9801 | } | ||
9802 | 9802 | | |||
9803 | EOLIAN static void | 9803 | EOLIAN static void | ||
9804 | _efl_canvas_text_efl_text_cursor_cursor_cluster_prev(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | 9804 | _efl_canvas_text_canvas_efl_text_cursor_cursor_cluster_prev(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | ||
9805 | { | 9805 | { | ||
9806 | ASYNC_BLOCK; | 9806 | ASYNC_BLOCK; | ||
9807 | if (_evas_textblock_cursor_prev(cur, EINA_TRUE)) | 9807 | if (_evas_textblock_cursor_prev(cur, EINA_TRUE)) | ||
9808 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 9808 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
9809 | } | 9809 | } | ||
9810 | 9810 | | |||
9811 | EAPI void | 9811 | EAPI void | ||
9812 | evas_textblock_cursor_paragraph_char_first(Efl_Text_Cursor_Cursor *cur) | 9812 | evas_textblock_cursor_paragraph_char_first(Efl_Text_Cursor_Cursor *cur) | ||
9813 | { | 9813 | { | ||
9814 | if (!cur) return; | 9814 | if (!cur) return; | ||
9815 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 9815 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
9816 | evas_object_async_block(obj); | 9816 | evas_object_async_block(obj); | ||
9817 | cur->pos = 0; | 9817 | cur->pos = 0; | ||
9818 | } | 9818 | } | ||
9819 | 9819 | | |||
9820 | EOLIAN static void | 9820 | EOLIAN static void | ||
9821 | _efl_canvas_text_efl_text_cursor_cursor_paragraph_char_first(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | 9821 | _efl_canvas_text_canvas_efl_text_cursor_cursor_paragraph_char_first(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | ||
9822 | { | 9822 | { | ||
9823 | ASYNC_BLOCK; | 9823 | ASYNC_BLOCK; | ||
9824 | evas_textblock_cursor_paragraph_char_first(cur); | 9824 | evas_textblock_cursor_paragraph_char_first(cur); | ||
9825 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 9825 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
9826 | } | 9826 | } | ||
9827 | 9827 | | |||
9828 | EAPI void | 9828 | EAPI void | ||
9829 | evas_textblock_cursor_paragraph_char_last(Efl_Text_Cursor_Cursor *cur) | 9829 | evas_textblock_cursor_paragraph_char_last(Efl_Text_Cursor_Cursor *cur) | ||
9830 | { | 9830 | { | ||
9831 | int ind; | 9831 | int ind; | ||
9832 | 9832 | | |||
9833 | if (!cur) return; | 9833 | if (!cur) return; | ||
9834 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 9834 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
9835 | evas_object_async_block(obj); | 9835 | evas_object_async_block(obj); | ||
9836 | TB_NULL_CHECK(cur->node); | 9836 | TB_NULL_CHECK(cur->node); | ||
9837 | ind = eina_ustrbuf_length_get(cur->node->unicode); | 9837 | ind = eina_ustrbuf_length_get(cur->node->unicode); | ||
9838 | /* If it's not the last paragraph, go back one, because we want to point | 9838 | /* If it's not the last paragraph, go back one, because we want to point | ||
9839 | * to the PS, not the NULL */ | 9839 | * to the PS, not the NULL */ | ||
9840 | if (EINA_INLIST_GET(cur->node)->next) | 9840 | if (EINA_INLIST_GET(cur->node)->next) | ||
9841 | ind--; | 9841 | ind--; | ||
9842 | 9842 | | |||
9843 | if (ind >= 0) | 9843 | if (ind >= 0) | ||
9844 | cur->pos = ind; | 9844 | cur->pos = ind; | ||
9845 | else | 9845 | else | ||
9846 | cur->pos = 0; | 9846 | cur->pos = 0; | ||
9847 | } | 9847 | } | ||
9848 | 9848 | | |||
9849 | EOLIAN static void | 9849 | EOLIAN static void | ||
9850 | _efl_canvas_text_efl_text_cursor_cursor_paragraph_char_last(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | 9850 | _efl_canvas_text_canvas_efl_text_cursor_cursor_paragraph_char_last(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | ||
9851 | { | 9851 | { | ||
9852 | ASYNC_BLOCK; | 9852 | ASYNC_BLOCK; | ||
9853 | evas_textblock_cursor_paragraph_char_last(cur); | 9853 | evas_textblock_cursor_paragraph_char_last(cur); | ||
9854 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 9854 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
9855 | } | 9855 | } | ||
9856 | 9856 | | |||
9857 | static void | 9857 | static void | ||
9858 | _cursor_line_first_char_get(Evas_Object_Textblock_Line *ln, | 9858 | _cursor_line_first_char_get(Evas_Object_Textblock_Line *ln, | ||
9859 | Efl_Text_Cursor_Cursor *cur, | 9859 | Efl_Text_Cursor_Cursor *cur, | ||
9860 | Efl_Canvas_Text_Data *o) | 9860 | Efl_Canvas_Text_Canvas_Data *o) | ||
9861 | { | 9861 | { | ||
9862 | if (ln->items) | 9862 | if (ln->items) | ||
9863 | { | 9863 | { | ||
9864 | Evas_Object_Textblock_Item *it; | 9864 | Evas_Object_Textblock_Item *it; | ||
9865 | size_t pos; | 9865 | size_t pos; | ||
9866 | pos = ln->items->text_pos; | 9866 | pos = ln->items->text_pos; | ||
9867 | EINA_INLIST_FOREACH(EINA_INLIST_GET(ln->items)->next, it) | 9867 | EINA_INLIST_FOREACH(EINA_INLIST_GET(ln->items)->next, it) | ||
9868 | { | 9868 | { | ||
Show All 18 Lines | 9886 | { | |||
9887 | Evas_Object_Textblock_Line *ln = NULL; | 9887 | Evas_Object_Textblock_Line *ln = NULL; | ||
9888 | Evas_Object_Textblock_Item *it = NULL; | 9888 | Evas_Object_Textblock_Item *it = NULL; | ||
9889 | if (!cur) return; | 9889 | if (!cur) return; | ||
9890 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 9890 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
9891 | evas_object_async_block(obj); | 9891 | evas_object_async_block(obj); | ||
9892 | 9892 | | |||
9893 | evas_object_async_block(obj); | 9893 | evas_object_async_block(obj); | ||
9894 | TB_NULL_CHECK(cur->node); | 9894 | TB_NULL_CHECK(cur->node); | ||
9895 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 9895 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
9896 | 9896 | | |||
9897 | _relayout_if_needed(cur->obj, o); | 9897 | _relayout_if_needed(cur->obj, o); | ||
9898 | 9898 | | |||
9899 | /* We don't actually need 'it', but it needs to be non NULL */ | 9899 | /* We don't actually need 'it', but it needs to be non NULL */ | ||
9900 | _find_layout_item_match(cur, &ln, &it); | 9900 | _find_layout_item_match(cur, &ln, &it); | ||
9901 | 9901 | | |||
9902 | if (!ln) return; | 9902 | if (!ln) return; | ||
9903 | 9903 | | |||
9904 | _cursor_line_first_char_get(ln, cur, o); | 9904 | _cursor_line_first_char_get(ln, cur, o); | ||
9905 | } | 9905 | } | ||
9906 | 9906 | | |||
9907 | EAPI void | 9907 | EAPI void | ||
9908 | evas_textblock_cursor_line_char_last(Efl_Text_Cursor_Cursor *cur) | 9908 | evas_textblock_cursor_line_char_last(Efl_Text_Cursor_Cursor *cur) | ||
9909 | { | 9909 | { | ||
9910 | Evas_Object_Textblock_Line *ln = NULL; | 9910 | Evas_Object_Textblock_Line *ln = NULL; | ||
9911 | Evas_Object_Textblock_Item *it = NULL; | 9911 | Evas_Object_Textblock_Item *it = NULL; | ||
9912 | 9912 | | |||
9913 | if (!cur) return; | 9913 | if (!cur) return; | ||
9914 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 9914 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
9915 | evas_object_async_block(obj); | 9915 | evas_object_async_block(obj); | ||
9916 | TB_NULL_CHECK(cur->node); | 9916 | TB_NULL_CHECK(cur->node); | ||
9917 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 9917 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
9918 | 9918 | | |||
9919 | _relayout_if_needed(cur->obj, o); | 9919 | _relayout_if_needed(cur->obj, o); | ||
9920 | 9920 | | |||
9921 | _find_layout_item_match(cur, &ln, &it); | 9921 | _find_layout_item_match(cur, &ln, &it); | ||
9922 | 9922 | | |||
9923 | if (!ln) return; | 9923 | if (!ln) return; | ||
9924 | if (ln->items) | 9924 | if (ln->items) | ||
9925 | { | 9925 | { | ||
Show All 22 Lines | 9937 | { | |||
9948 | else if (!EINA_INLIST_GET(ln)->next && !EINA_INLIST_GET(ln->par)->next) | 9948 | else if (!EINA_INLIST_GET(ln)->next && !EINA_INLIST_GET(ln->par)->next) | ||
9949 | { | 9949 | { | ||
9950 | cur->pos++; | 9950 | cur->pos++; | ||
9951 | } | 9951 | } | ||
9952 | } | 9952 | } | ||
9953 | } | 9953 | } | ||
9954 | 9954 | | |||
9955 | EOLIAN static void | 9955 | EOLIAN static void | ||
9956 | _efl_canvas_text_efl_text_cursor_cursor_line_char_last(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | 9956 | _efl_canvas_text_canvas_efl_text_cursor_cursor_line_char_last(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | ||
9957 | { | 9957 | { | ||
9958 | ASYNC_BLOCK; | 9958 | ASYNC_BLOCK; | ||
9959 | evas_textblock_cursor_line_char_last(cur); | 9959 | evas_textblock_cursor_line_char_last(cur); | ||
9960 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 9960 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
9961 | } | 9961 | } | ||
9962 | 9962 | | |||
9963 | EOLIAN static void | 9963 | EOLIAN static void | ||
9964 | _efl_canvas_text_efl_text_cursor_cursor_line_char_first(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | 9964 | _efl_canvas_text_canvas_efl_text_cursor_cursor_line_char_first(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | ||
9965 | { | 9965 | { | ||
9966 | ASYNC_BLOCK; | 9966 | ASYNC_BLOCK; | ||
9967 | evas_textblock_cursor_line_char_first(cur); | 9967 | evas_textblock_cursor_line_char_first(cur); | ||
9968 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 9968 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
9969 | } | 9969 | } | ||
9970 | 9970 | | |||
9971 | /** | 9971 | /** | ||
9972 | * @internal | 9972 | * @internal | ||
9973 | * checks if a format (as a string) is visible/changes format and sets the | 9973 | * checks if a format (as a string) is visible/changes format and sets the | ||
9974 | * fnode properties accordingly. | 9974 | * fnode properties accordingly. | ||
9975 | * | 9975 | * | ||
9976 | * @param fnode the format node | 9976 | * @param fnode the format node | ||
▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Line(s) | |||||
10064 | * i.e formats that pair to themselves. Only removes invisible formats | 10064 | * i.e formats that pair to themselves. Only removes invisible formats | ||
10065 | * that pair themselves, if you want to remove invisible formats that pair | 10065 | * that pair themselves, if you want to remove invisible formats that pair | ||
10066 | * themselves, please first change fmt->visible to EINA_FALSE. | 10066 | * themselves, please first change fmt->visible to EINA_FALSE. | ||
10067 | * | 10067 | * | ||
10068 | * @param o the textblock object. | 10068 | * @param o the textblock object. | ||
10069 | * @param fmt the current format. | 10069 | * @param fmt the current format. | ||
10070 | */ | 10070 | */ | ||
10071 | static void | 10071 | static void | ||
10072 | _evas_textblock_node_format_remove_matching(Efl_Canvas_Text_Data *o, | 10072 | _evas_textblock_node_format_remove_matching(Efl_Canvas_Text_Canvas_Data *o, | ||
10073 | Evas_Object_Textblock_Node_Format *fmt) | 10073 | Evas_Object_Textblock_Node_Format *fmt) | ||
10074 | { | 10074 | { | ||
10075 | Evas_Object_Textblock_Node_Text *tnode; | 10075 | Evas_Object_Textblock_Node_Text *tnode; | ||
10076 | Eina_List *formats = NULL; | 10076 | Eina_List *formats = NULL; | ||
10077 | size_t offset = 0; | 10077 | size_t offset = 0; | ||
10078 | 10078 | | |||
10079 | if (!fmt) return; | 10079 | if (!fmt) return; | ||
10080 | 10080 | | |||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Line(s) | |||||
10153 | * and it points to tnode. | 10153 | * and it points to tnode. | ||
10154 | * | 10154 | * | ||
10155 | * @param o the textblock object. | 10155 | * @param o the textblock object. | ||
10156 | * @param tnode the text node the format should point to. | 10156 | * @param tnode the text node the format should point to. | ||
10157 | * @param fmt the current format. | 10157 | * @param fmt the current format. | ||
10158 | * @param offset the offset to add (may be negative). | 10158 | * @param offset the offset to add (may be negative). | ||
10159 | */ | 10159 | */ | ||
10160 | static void | 10160 | static void | ||
10161 | _evas_textblock_node_format_adjust_offset(Efl_Canvas_Text_Data *o, | 10161 | _evas_textblock_node_format_adjust_offset(Efl_Canvas_Text_Canvas_Data *o, | ||
10162 | Evas_Object_Textblock_Node_Text *tnode, | 10162 | Evas_Object_Textblock_Node_Text *tnode, | ||
10163 | Evas_Object_Textblock_Node_Format *fmt, int offset) | 10163 | Evas_Object_Textblock_Node_Format *fmt, int offset) | ||
10164 | { | 10164 | { | ||
10165 | if (fmt) | 10165 | if (fmt) | ||
10166 | { | 10166 | { | ||
10167 | fmt = _NODE_FORMAT(EINA_INLIST_GET(fmt)->next); | 10167 | fmt = _NODE_FORMAT(EINA_INLIST_GET(fmt)->next); | ||
10168 | } | 10168 | } | ||
10169 | else | 10169 | else | ||
Show All 10 Lines | |||||
10180 | * @internal | 10180 | * @internal | ||
10181 | * Removes a format node updating the offset of the next format node and the | 10181 | * Removes a format node updating the offset of the next format node and the | ||
10182 | * text nodes pointing to this node. | 10182 | * text nodes pointing to this node. | ||
10183 | * | 10183 | * | ||
10184 | * @param o the textblock object. | 10184 | * @param o the textblock object. | ||
10185 | * @param n the fromat node to remove | 10185 | * @param n the fromat node to remove | ||
10186 | */ | 10186 | */ | ||
10187 | static void | 10187 | static void | ||
10188 | _evas_textblock_node_format_remove(Efl_Canvas_Text_Data *o, Evas_Object_Textblock_Node_Format *n, int visible_adjustment) | 10188 | _evas_textblock_node_format_remove(Efl_Canvas_Text_Canvas_Data *o, Evas_Object_Textblock_Node_Format *n, int visible_adjustment) | ||
10189 | { | 10189 | { | ||
10190 | /* Update the text nodes about the change */ | 10190 | /* Update the text nodes about the change */ | ||
10191 | { | 10191 | { | ||
10192 | Evas_Object_Textblock_Node_Format *nnode; | 10192 | Evas_Object_Textblock_Node_Format *nnode; | ||
10193 | nnode = _NODE_FORMAT(EINA_INLIST_GET(n)->next); | 10193 | nnode = _NODE_FORMAT(EINA_INLIST_GET(n)->next); | ||
10194 | /* If there's a next node that belongs to the same text node | 10194 | /* If there's a next node that belongs to the same text node | ||
10195 | * and the curret node was the main one, advance the format node */ | 10195 | * and the curret node was the main one, advance the format node */ | ||
10196 | if (nnode && (nnode->text_node == n->text_node)) | 10196 | if (nnode && (nnode->text_node == n->text_node)) | ||
Show All 38 Lines | |||||
10235 | * Assumes there is a prev node or the current node will be preserved. | 10235 | * Assumes there is a prev node or the current node will be preserved. | ||
10236 | * | 10236 | * | ||
10237 | * @param n the text node the positions refer to. | 10237 | * @param n the text node the positions refer to. | ||
10238 | * @param start the start of where to delete from. | 10238 | * @param start the start of where to delete from. | ||
10239 | * @param end the end of the section to delete, if end == -1 it means the end of the string. | 10239 | * @param end the end of the section to delete, if end == -1 it means the end of the string. | ||
10240 | * @returns @c EINA_TRUE if removed a PS, @c EINA_FALSE otherwise. | 10240 | * @returns @c EINA_TRUE if removed a PS, @c EINA_FALSE otherwise. | ||
10241 | */ | 10241 | */ | ||
10242 | static Eina_Bool | 10242 | static Eina_Bool | ||
10243 | _evas_textblock_node_text_adjust_offsets_to_start(Efl_Canvas_Text_Data *o, | 10243 | _evas_textblock_node_text_adjust_offsets_to_start(Efl_Canvas_Text_Canvas_Data *o, | ||
10244 | Evas_Object_Textblock_Node_Text *n, size_t start, int end) | 10244 | Evas_Object_Textblock_Node_Text *n, size_t start, int end) | ||
10245 | { | 10245 | { | ||
10246 | Evas_Object_Textblock_Node_Format *last_node, *itr; | 10246 | Evas_Object_Textblock_Node_Format *last_node, *itr; | ||
10247 | int use_end = 1; | 10247 | int use_end = 1; | ||
10248 | int delta = 0; | 10248 | int delta = 0; | ||
10249 | int first = 1; | 10249 | int first = 1; | ||
10250 | size_t pos = 0; | 10250 | size_t pos = 0; | ||
10251 | int orig_end; | 10251 | int orig_end; | ||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Line(s) | |||||
10363 | 10363 | | |||
10364 | /** | 10364 | /** | ||
10365 | * Removes a text node and the corresponding format nodes. | 10365 | * Removes a text node and the corresponding format nodes. | ||
10366 | * | 10366 | * | ||
10367 | * @param o the textblock objec.t | 10367 | * @param o the textblock objec.t | ||
10368 | * @param n the node to remove. | 10368 | * @param n the node to remove. | ||
10369 | */ | 10369 | */ | ||
10370 | static void | 10370 | static void | ||
10371 | _evas_textblock_node_text_remove(Efl_Canvas_Text_Data *o, Evas_Object_Textblock_Node_Text *n) | 10371 | _evas_textblock_node_text_remove(Efl_Canvas_Text_Canvas_Data *o, Evas_Object_Textblock_Node_Text *n) | ||
10372 | { | 10372 | { | ||
10373 | _evas_textblock_node_text_adjust_offsets_to_start(o, n, 0, -1); | 10373 | _evas_textblock_node_text_adjust_offsets_to_start(o, n, 0, -1); | ||
10374 | 10374 | | |||
10375 | o->text_nodes = _NODE_TEXT(eina_inlist_remove( | 10375 | o->text_nodes = _NODE_TEXT(eina_inlist_remove( | ||
10376 | EINA_INLIST_GET(o->text_nodes), EINA_INLIST_GET(n))); | 10376 | EINA_INLIST_GET(o->text_nodes), EINA_INLIST_GET(n))); | ||
10377 | _evas_textblock_node_text_free(n); | 10377 | _evas_textblock_node_text_free(n); | ||
10378 | } | 10378 | } | ||
10379 | 10379 | | |||
Show All 23 Lines | 10402 | { | |||
10403 | break; | 10403 | break; | ||
10404 | } | 10404 | } | ||
10405 | position += itr->offset; | 10405 | position += itr->offset; | ||
10406 | } | 10406 | } | ||
10407 | return position + fmt->offset; | 10407 | return position + fmt->offset; | ||
10408 | } | 10408 | } | ||
10409 | 10409 | | |||
10410 | EOLIAN static int | 10410 | EOLIAN static int | ||
10411 | _efl_canvas_text_efl_text_cursor_cursor_position_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | 10411 | _efl_canvas_text_canvas_efl_text_cursor_cursor_position_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | ||
10412 | { | 10412 | { | ||
10413 | ASYNC_BLOCK; | 10413 | ASYNC_BLOCK; | ||
10414 | Evas_Object_Textblock_Node_Text *n; | 10414 | Evas_Object_Textblock_Node_Text *n; | ||
10415 | size_t npos = 0; | 10415 | size_t npos = 0; | ||
10416 | 10416 | | |||
10417 | if (!cur) return -1; | 10417 | if (!cur) return -1; | ||
10418 | if (cur->obj != eo_obj) return -1; | 10418 | if (cur->obj != eo_obj) return -1; | ||
10419 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 10419 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
Show All 19 Lines | |||||
10439 | EAPI void | 10439 | EAPI void | ||
10440 | evas_textblock_cursor_pos_set(Efl_Text_Cursor_Cursor *cur, int _pos) | 10440 | evas_textblock_cursor_pos_set(Efl_Text_Cursor_Cursor *cur, int _pos) | ||
10441 | { | 10441 | { | ||
10442 | Evas_Object_Textblock_Node_Text *n; | 10442 | Evas_Object_Textblock_Node_Text *n; | ||
10443 | size_t pos; | 10443 | size_t pos; | ||
10444 | if (!cur) return; | 10444 | if (!cur) return; | ||
10445 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 10445 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
10446 | evas_object_async_block(obj); | 10446 | evas_object_async_block(obj); | ||
10447 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 10447 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
10448 | 10448 | | |||
10449 | 10449 | | |||
10450 | if (_pos < 0) | 10450 | if (_pos < 0) | ||
10451 | { | 10451 | { | ||
10452 | pos = 0; | 10452 | pos = 0; | ||
10453 | } | 10453 | } | ||
10454 | else | 10454 | else | ||
10455 | { | 10455 | { | ||
Show All 22 Lines | 10472 | { | |||
10478 | pos = eina_ustrbuf_length_get(last_n->unicode); | 10478 | pos = eina_ustrbuf_length_get(last_n->unicode); | ||
10479 | 10479 | | |||
10480 | cur->node = last_n; | 10480 | cur->node = last_n; | ||
10481 | cur->pos = pos; | 10481 | cur->pos = pos; | ||
10482 | } | 10482 | } | ||
10483 | } | 10483 | } | ||
10484 | 10484 | | |||
10485 | EOLIAN static void | 10485 | EOLIAN static void | ||
10486 | _efl_canvas_text_efl_text_cursor_cursor_position_set(Eo *cur_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur, int _pos) | 10486 | _efl_canvas_text_canvas_efl_text_cursor_cursor_position_set(Eo *cur_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur, int _pos) | ||
10487 | { | 10487 | { | ||
10488 | ASYNC_BLOCK; | 10488 | ASYNC_BLOCK; | ||
10489 | evas_textblock_cursor_pos_set(cur, _pos); | 10489 | evas_textblock_cursor_pos_set(cur, _pos); | ||
10490 | efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 10490 | efl_event_callback_legacy_call(cur_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
10491 | } | 10491 | } | ||
10492 | 10492 | | |||
10493 | EAPI Eina_Bool | 10493 | EAPI Eina_Bool | ||
10494 | evas_textblock_cursor_line_set(Evas_Textblock_Cursor *cur, int line) | 10494 | evas_textblock_cursor_line_set(Evas_Textblock_Cursor *cur, int line) | ||
10495 | { | 10495 | { | ||
10496 | Evas_Object_Textblock_Line *ln; | 10496 | Evas_Object_Textblock_Line *ln; | ||
10497 | 10497 | | |||
10498 | if (!cur) return EINA_FALSE; | 10498 | if (!cur) return EINA_FALSE; | ||
10499 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 10499 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
10500 | evas_object_async_block(obj); | 10500 | evas_object_async_block(obj); | ||
10501 | 10501 | | |||
10502 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 10502 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
10503 | 10503 | | |||
10504 | _relayout_if_needed(cur->obj, o); | 10504 | _relayout_if_needed(cur->obj, o); | ||
10505 | 10505 | | |||
10506 | ln = _find_layout_line_num(cur->obj, line); | 10506 | ln = _find_layout_line_num(cur->obj, line); | ||
10507 | if (!ln) return EINA_FALSE; | 10507 | if (!ln) return EINA_FALSE; | ||
10508 | 10508 | | |||
10509 | _cursor_line_first_char_get(ln, cur, o); | 10509 | _cursor_line_first_char_get(ln, cur, o); | ||
10510 | 10510 | | |||
10511 | return EINA_TRUE; | 10511 | return EINA_TRUE; | ||
10512 | } | 10512 | } | ||
10513 | 10513 | | |||
10514 | EOLIAN static void | 10514 | EOLIAN static void | ||
10515 | _efl_canvas_text_efl_text_cursor_cursor_line_jump_by(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur EINA_UNUSED, int by) | 10515 | _efl_canvas_text_canvas_efl_text_cursor_cursor_line_jump_by(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur EINA_UNUSED, int by) | ||
10516 | { | 10516 | { | ||
10517 | ASYNC_BLOCK; | 10517 | ASYNC_BLOCK; | ||
10518 | int ln; | 10518 | int ln; | ||
10519 | Evas_Coord cx, cw; | 10519 | Evas_Coord cx, cw; | ||
10520 | Evas_Coord lx, ly, lw, lh; | 10520 | Evas_Coord lx, ly, lw, lh; | ||
10521 | int last; | 10521 | int last; | ||
10522 | Evas_Object_Textblock_Node_Text *pnode; | 10522 | Evas_Object_Textblock_Node_Text *pnode; | ||
10523 | size_t ppos; | 10523 | size_t ppos; | ||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | 10564 | else | |||
10565 | evas_textblock_cursor_line_char_last(cur); | 10565 | evas_textblock_cursor_line_char_last(cur); | ||
10566 | } | 10566 | } | ||
10567 | } | 10567 | } | ||
10568 | } | 10568 | } | ||
10569 | 10569 | | |||
10570 | if ((pnode != cur->node) || (ppos != cur->pos)) | 10570 | if ((pnode != cur->node) || (ppos != cur->pos)) | ||
10571 | { | 10571 | { | ||
10572 | efl_event_callback_legacy_call(eo_obj, | 10572 | efl_event_callback_legacy_call(eo_obj, | ||
10573 | EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 10573 | EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
10574 | } | 10574 | } | ||
10575 | } | 10575 | } | ||
10576 | 10576 | | |||
10577 | EAPI int | 10577 | EAPI int | ||
10578 | evas_textblock_cursor_compare(const Efl_Text_Cursor_Cursor *cur1, | 10578 | evas_textblock_cursor_compare(const Efl_Text_Cursor_Cursor *cur1, | ||
10579 | const Efl_Text_Cursor_Cursor *cur2) | 10579 | const Efl_Text_Cursor_Cursor *cur2) | ||
10580 | { | 10580 | { | ||
10581 | Eina_Inlist *l1, *l2; | 10581 | Eina_Inlist *l1, *l2; | ||
Show All 17 Lines | 10595 | { | |||
10599 | else if (!l2) return 1; /* cur2 < cur 1 */ | 10599 | else if (!l2) return 1; /* cur2 < cur 1 */ | ||
10600 | l1 = l1->prev; | 10600 | l1 = l1->prev; | ||
10601 | l2 = l2->next; | 10601 | l2 = l2->next; | ||
10602 | } | 10602 | } | ||
10603 | return 0; | 10603 | return 0; | ||
10604 | } | 10604 | } | ||
10605 | 10605 | | |||
10606 | EOLIAN static int | 10606 | EOLIAN static int | ||
10607 | _efl_canvas_text_efl_text_cursor_cursor_compare(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, | 10607 | _efl_canvas_text_canvas_efl_text_cursor_cursor_compare(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, | ||
10608 | const Efl_Text_Cursor_Cursor *cur1, const Efl_Text_Cursor_Cursor *cur2) | 10608 | const Efl_Text_Cursor_Cursor *cur1, const Efl_Text_Cursor_Cursor *cur2) | ||
10609 | { | 10609 | { | ||
10610 | ASYNC_BLOCK; | 10610 | ASYNC_BLOCK; | ||
10611 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur1->obj, EFL_CANVAS_OBJECT_CLASS); | 10611 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur1->obj, EFL_CANVAS_OBJECT_CLASS); | ||
10612 | evas_object_async_block(obj); | 10612 | evas_object_async_block(obj); | ||
10613 | return evas_textblock_cursor_compare(cur1, cur2); | 10613 | return evas_textblock_cursor_compare(cur1, cur2); | ||
10614 | } | 10614 | } | ||
10615 | 10615 | | |||
10616 | EAPI Eina_Bool | 10616 | EAPI Eina_Bool | ||
10617 | evas_textblock_cursor_equal(const Evas_Textblock_Cursor *cur1, | 10617 | evas_textblock_cursor_equal(const Evas_Textblock_Cursor *cur1, | ||
10618 | const Evas_Textblock_Cursor *cur2) | 10618 | const Evas_Textblock_Cursor *cur2) | ||
10619 | { | 10619 | { | ||
10620 | if (!cur1->obj) return EINA_FALSE; | 10620 | if (!cur1->obj) return EINA_FALSE; | ||
10621 | return efl_text_cursor_equal(cur1->obj, cur1, cur2); | 10621 | return efl_text_cursor_equal(cur1->obj, cur1, cur2); | ||
10622 | } | 10622 | } | ||
10623 | 10623 | | |||
10624 | EOLIAN static Eina_Bool | 10624 | EOLIAN static Eina_Bool | ||
10625 | _efl_canvas_text_efl_text_cursor_cursor_equal(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, const Efl_Text_Cursor_Cursor *cur, const Efl_Text_Cursor_Cursor *cur2) | 10625 | _efl_canvas_text_canvas_efl_text_cursor_cursor_equal(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, const Efl_Text_Cursor_Cursor *cur, const Efl_Text_Cursor_Cursor *cur2) | ||
10626 | { | 10626 | { | ||
10627 | ASYNC_BLOCK; | 10627 | ASYNC_BLOCK; | ||
10628 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 10628 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
10629 | evas_object_async_block(obj); | 10629 | evas_object_async_block(obj); | ||
10630 | return ((cur->node == cur2->node) && (cur->pos == cur2->pos)); | 10630 | return ((cur->node == cur2->node) && (cur->pos == cur2->pos)); | ||
10631 | } | 10631 | } | ||
10632 | 10632 | | |||
10633 | EAPI void | 10633 | EAPI void | ||
Show All 16 Lines | 10649 | { | |||
10650 | ERR("Tried copying a cursor from the wrong object"); | 10650 | ERR("Tried copying a cursor from the wrong object"); | ||
10651 | return; | 10651 | return; | ||
10652 | } | 10652 | } | ||
10653 | dst->pos = src->pos; | 10653 | dst->pos = src->pos; | ||
10654 | dst->node = src->node; | 10654 | dst->node = src->node; | ||
10655 | } | 10655 | } | ||
10656 | 10656 | | |||
10657 | EOLIAN static void | 10657 | EOLIAN static void | ||
10658 | _efl_canvas_text_efl_text_cursor_cursor_copy(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, | 10658 | _efl_canvas_text_canvas_efl_text_cursor_cursor_copy(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, | ||
10659 | Efl_Text_Cursor_Cursor *dst, const Efl_Text_Cursor_Cursor *src) | 10659 | Efl_Text_Cursor_Cursor *dst, const Efl_Text_Cursor_Cursor *src) | ||
10660 | { | 10660 | { | ||
10661 | ASYNC_BLOCK; | 10661 | ASYNC_BLOCK; | ||
10662 | if (!efl_text_cursor_equal(obj, dst, src)) | 10662 | if (!efl_text_cursor_equal(obj, dst, src)) | ||
10663 | { | 10663 | { | ||
10664 | _evas_textblock_cursor_copy(dst, src); | 10664 | _evas_textblock_cursor_copy(dst, src); | ||
10665 | efl_event_callback_legacy_call(obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 10665 | efl_event_callback_legacy_call(obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
10666 | } | 10666 | } | ||
10667 | } | 10667 | } | ||
10668 | 10668 | | |||
10669 | /* text controls */ | 10669 | /* text controls */ | ||
10670 | /** | 10670 | /** | ||
10671 | * @internal | 10671 | * @internal | ||
10672 | * Free a text node. Shouldn't be used usually, it's better to use | 10672 | * Free a text node. Shouldn't be used usually, it's better to use | ||
10673 | * @ref _evas_textblock_node_text_remove for most cases . | 10673 | * @ref _evas_textblock_node_text_remove for most cases . | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
10719 | static void | 10719 | static void | ||
10720 | _evas_textblock_cursor_break_paragraph(Efl_Text_Cursor_Cursor *cur, | 10720 | _evas_textblock_cursor_break_paragraph(Efl_Text_Cursor_Cursor *cur, | ||
10721 | Evas_Object_Textblock_Node_Format *fnode, | 10721 | Evas_Object_Textblock_Node_Format *fnode, | ||
10722 | Eina_Bool legacy) | 10722 | Eina_Bool legacy) | ||
10723 | { | 10723 | { | ||
10724 | Evas_Object_Textblock_Node_Text *n; | 10724 | Evas_Object_Textblock_Node_Text *n; | ||
10725 | 10725 | | |||
10726 | if (!cur) return; | 10726 | if (!cur) return; | ||
10727 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 10727 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
10728 | 10728 | | |||
10729 | n = _evas_textblock_node_text_new(); | 10729 | n = _evas_textblock_node_text_new(); | ||
10730 | o->text_nodes = _NODE_TEXT(eina_inlist_append_relative( | 10730 | o->text_nodes = _NODE_TEXT(eina_inlist_append_relative( | ||
10731 | EINA_INLIST_GET(o->text_nodes), | 10731 | EINA_INLIST_GET(o->text_nodes), | ||
10732 | EINA_INLIST_GET(n), | 10732 | EINA_INLIST_GET(n), | ||
10733 | cur->node ? EINA_INLIST_GET(cur->node) : NULL)); | 10733 | cur->node ? EINA_INLIST_GET(cur->node) : NULL)); | ||
10734 | /* Handle text and format changes. */ | 10734 | /* Handle text and format changes. */ | ||
10735 | if (cur->node) | 10735 | if (cur->node) | ||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | |||||
10796 | * @internal | 10796 | * @internal | ||
10797 | * Set the node and offset of all the curs after cur. | 10797 | * Set the node and offset of all the curs after cur. | ||
10798 | * | 10798 | * | ||
10799 | * @param cur the cursor. | 10799 | * @param cur the cursor. | ||
10800 | * @param n the current textblock node. | 10800 | * @param n the current textblock node. | ||
10801 | * @param new_node the new node to set. | 10801 | * @param new_node the new node to set. | ||
10802 | */ | 10802 | */ | ||
10803 | static void | 10803 | static void | ||
10804 | _evas_textblock_cursors_set_node(Efl_Canvas_Text_Data *o, | 10804 | _evas_textblock_cursors_set_node(Efl_Canvas_Text_Canvas_Data *o, | ||
10805 | const Evas_Object_Textblock_Node_Text *n, | 10805 | const Evas_Object_Textblock_Node_Text *n, | ||
10806 | Evas_Object_Textblock_Node_Text *new_node) | 10806 | Evas_Object_Textblock_Node_Text *new_node) | ||
10807 | { | 10807 | { | ||
10808 | Eina_List *l; | 10808 | Eina_List *l; | ||
10809 | Efl_Text_Cursor_Cursor *cur = o->cursor; | 10809 | Efl_Text_Cursor_Cursor *cur = o->cursor; | ||
10810 | Efl_Text_Cursor_Cursor *data; | 10810 | Efl_Text_Cursor_Cursor *data; | ||
10811 | 10811 | | |||
10812 | if (n == cur->node) | 10812 | if (n == cur->node) | ||
Show All 9 Lines | 10821 | { | |||
10822 | data->pos = 0; | 10822 | data->pos = 0; | ||
10823 | data->node = new_node; | 10823 | data->node = new_node; | ||
10824 | data->changed = EINA_TRUE; | 10824 | data->changed = EINA_TRUE; | ||
10825 | } | 10825 | } | ||
10826 | } | 10826 | } | ||
10827 | } | 10827 | } | ||
10828 | 10828 | | |||
10829 | static inline void | 10829 | static inline void | ||
10830 | _cursor_update_offset(Efl_Text_Cursor_Cursor *cur, Efl_Canvas_Text_Data *o, | 10830 | _cursor_update_offset(Efl_Text_Cursor_Cursor *cur, Efl_Canvas_Text_Canvas_Data *o, | ||
10831 | const Evas_Object_Textblock_Node_Text *n, size_t start, int offset) | 10831 | const Evas_Object_Textblock_Node_Text *n, size_t start, int offset) | ||
10832 | { | 10832 | { | ||
10833 | if ((n == cur->node) && | 10833 | if ((n == cur->node) && | ||
10834 | (cur->pos > start)) | 10834 | (cur->pos > start)) | ||
10835 | { | 10835 | { | ||
10836 | if ((offset < 0) && (cur->pos <= (size_t) (-1 * offset))) | 10836 | if ((offset < 0) && (cur->pos <= (size_t) (-1 * offset))) | ||
10837 | { | 10837 | { | ||
10838 | cur->pos = 0; | 10838 | cur->pos = 0; | ||
Show All 23 Lines | |||||
10862 | */ | 10862 | */ | ||
10863 | static void | 10863 | static void | ||
10864 | _evas_textblock_cursors_update_offset(const Efl_Text_Cursor_Cursor *cur, | 10864 | _evas_textblock_cursors_update_offset(const Efl_Text_Cursor_Cursor *cur, | ||
10865 | const Evas_Object_Textblock_Node_Text *n, | 10865 | const Evas_Object_Textblock_Node_Text *n, | ||
10866 | size_t start, int offset) | 10866 | size_t start, int offset) | ||
10867 | { | 10867 | { | ||
10868 | Eina_List *l; | 10868 | Eina_List *l; | ||
10869 | Efl_Text_Cursor_Cursor *ocur; | 10869 | Efl_Text_Cursor_Cursor *ocur; | ||
10870 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 10870 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
10871 | 10871 | | |||
10872 | ocur = o->cursor; | 10872 | ocur = o->cursor; | ||
10873 | if (cur != ocur) | 10873 | if (cur != ocur) | ||
10874 | { | 10874 | { | ||
10875 | _cursor_update_offset(ocur, o, n, start, offset); | 10875 | _cursor_update_offset(ocur, o, n, start, offset); | ||
10876 | } | 10876 | } | ||
10877 | 10877 | | |||
10878 | EINA_LIST_FOREACH(o->cursors, l, ocur) | 10878 | EINA_LIST_FOREACH(o->cursors, l, ocur) | ||
10879 | { | 10879 | { | ||
10880 | if (ocur != cur) | 10880 | if (ocur != cur) | ||
10881 | { | 10881 | { | ||
10882 | _cursor_update_offset(ocur, o, n, start, offset); | 10882 | _cursor_update_offset(ocur, o, n, start, offset); | ||
10883 | } | 10883 | } | ||
10884 | } | 10884 | } | ||
10885 | } | 10885 | } | ||
10886 | 10886 | | |||
10887 | /** | 10887 | /** | ||
10888 | * @internal | 10888 | * @internal | ||
10889 | * Mark that the textblock has changed. | 10889 | * Mark that the textblock has changed. | ||
10890 | * | 10890 | * | ||
10891 | * @param o the textblock object. | 10891 | * @param o the textblock object. | ||
10892 | * @param obj the evas object. | 10892 | * @param obj the evas object. | ||
10893 | */ | 10893 | */ | ||
10894 | static void | 10894 | static void | ||
10895 | _evas_textblock_changed(Efl_Canvas_Text_Data *o, Evas_Object *eo_obj) | 10895 | _evas_textblock_changed(Efl_Canvas_Text_Canvas_Data *o, Evas_Object *eo_obj) | ||
10896 | { | 10896 | { | ||
10897 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 10897 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
10898 | Eina_List *l; | 10898 | Eina_List *l; | ||
10899 | Efl_Text_Cursor_Cursor *data_obj; | 10899 | Efl_Text_Cursor_Cursor *data_obj; | ||
10900 | LYDBG("ZZ: invalidate 1 %p\n", eo_obj); | 10900 | LYDBG("ZZ: invalidate 1 %p\n", eo_obj); | ||
10901 | o->formatted.valid = 0; | 10901 | o->formatted.valid = 0; | ||
10902 | o->native.valid = 0; | 10902 | o->native.valid = 0; | ||
10903 | o->content_changed = 1; | 10903 | o->content_changed = 1; | ||
Show All 9 Lines | 10912 | EINA_LIST_FOREACH(o->cursors, l, data_obj) | |||
10913 | { | 10913 | { | ||
10914 | _cursor_emit_if_changed(data_obj); | 10914 | _cursor_emit_if_changed(data_obj); | ||
10915 | } | 10915 | } | ||
10916 | 10916 | | |||
10917 | evas_object_change(eo_obj, obj); | 10917 | evas_object_change(eo_obj, obj); | ||
10918 | } | 10918 | } | ||
10919 | 10919 | | |||
10920 | static void | 10920 | static void | ||
10921 | _evas_textblock_invalidate_all(Efl_Canvas_Text_Data *o) | 10921 | _evas_textblock_invalidate_all(Efl_Canvas_Text_Canvas_Data *o) | ||
10922 | { | 10922 | { | ||
10923 | Evas_Object_Textblock_Node_Text *n; | 10923 | Evas_Object_Textblock_Node_Text *n; | ||
10924 | 10924 | | |||
10925 | EINA_INLIST_FOREACH(o->text_nodes, n) | 10925 | EINA_INLIST_FOREACH(o->text_nodes, n) | ||
10926 | { | 10926 | { | ||
10927 | n->dirty = EINA_TRUE; | 10927 | n->dirty = EINA_TRUE; | ||
10928 | } | 10928 | } | ||
10929 | } | 10929 | } | ||
10930 | 10930 | | |||
10931 | static int | 10931 | static int | ||
10932 | _evas_textblock_cursor_text_append(Efl_Text_Cursor_Cursor *cur, const char *_text) | 10932 | _evas_textblock_cursor_text_append(Efl_Text_Cursor_Cursor *cur, const char *_text) | ||
10933 | { | 10933 | { | ||
10934 | Evas_Object_Textblock_Node_Text *n; | 10934 | Evas_Object_Textblock_Node_Text *n; | ||
10935 | Evas_Object_Textblock_Node_Format *fnode = NULL; | 10935 | Evas_Object_Textblock_Node_Format *fnode = NULL; | ||
10936 | Eina_Unicode *text; | 10936 | Eina_Unicode *text; | ||
10937 | Efl_Text_Cursor_Cursor *main_cur; | 10937 | Efl_Text_Cursor_Cursor *main_cur; | ||
10938 | int len = 0; | 10938 | int len = 0; | ||
10939 | 10939 | | |||
10940 | if (!cur) return 0; | 10940 | if (!cur) return 0; | ||
10941 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 10941 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
10942 | evas_object_async_block(obj); | 10942 | evas_object_async_block(obj); | ||
10943 | text = eina_unicode_utf8_to_unicode(_text, &len); | 10943 | text = eina_unicode_utf8_to_unicode(_text, &len); | ||
10944 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 10944 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
10945 | 10945 | | |||
10946 | n = cur->node; | 10946 | n = cur->node; | ||
10947 | if (n) | 10947 | if (n) | ||
10948 | { | 10948 | { | ||
10949 | Evas_Object_Textblock_Node_Format *nnode; | 10949 | Evas_Object_Textblock_Node_Format *nnode; | ||
10950 | fnode = _evas_textblock_cursor_node_format_before_or_at_pos_get(cur); | 10950 | fnode = _evas_textblock_cursor_node_format_before_or_at_pos_get(cur); | ||
10951 | fnode = _evas_textblock_node_format_last_at_off(fnode); | 10951 | fnode = _evas_textblock_node_format_last_at_off(fnode); | ||
10952 | /* find the node after the current in the same paragraph | 10952 | /* find the node after the current in the same paragraph | ||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | |||||
11028 | 11028 | | |||
11029 | EAPI int | 11029 | EAPI int | ||
11030 | evas_textblock_cursor_text_prepend(Efl_Text_Cursor_Cursor *cur, const char *_text) | 11030 | evas_textblock_cursor_text_prepend(Efl_Text_Cursor_Cursor *cur, const char *_text) | ||
11031 | { | 11031 | { | ||
11032 | return _evas_textblock_cursor_text_prepend(cur, _text); | 11032 | return _evas_textblock_cursor_text_prepend(cur, _text); | ||
11033 | } | 11033 | } | ||
11034 | 11034 | | |||
11035 | EOLIAN static int | 11035 | EOLIAN static int | ||
11036 | _efl_canvas_text_efl_text_cursor_cursor_text_insert(Eo *eo_obj, | 11036 | _efl_canvas_text_canvas_efl_text_cursor_cursor_text_insert(Eo *eo_obj, | ||
11037 | Efl_Canvas_Text_Data *o, | 11037 | Efl_Canvas_Text_Canvas_Data *o, | ||
11038 | Efl_Text_Cursor_Cursor *cur, const char *_text) | 11038 | Efl_Text_Cursor_Cursor *cur, const char *_text) | ||
11039 | { | 11039 | { | ||
11040 | ASYNC_BLOCK; | 11040 | ASYNC_BLOCK; | ||
11041 | int len = _efl_canvas_text_cursor_text_append(cur, _text); | 11041 | int len = _efl_canvas_text_canvas_cursor_text_append(cur, _text); | ||
11042 | _evas_textblock_changed(o, eo_obj); | 11042 | _evas_textblock_changed(o, eo_obj); | ||
11043 | efl_event_callback_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CHANGED, NULL); | 11043 | efl_event_callback_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CHANGED, NULL); | ||
11044 | return len; | 11044 | return len; | ||
11045 | } | 11045 | } | ||
11046 | 11046 | | |||
11047 | /** | 11047 | /** | ||
11048 | * @internal | 11048 | * @internal | ||
11049 | * Free a format node | 11049 | * Free a format node | ||
11050 | * | 11050 | * | ||
11051 | * @param o the textblock object | 11051 | * @param o the textblock object | ||
11052 | * @param n the format node to free | 11052 | * @param n the format node to free | ||
11053 | */ | 11053 | */ | ||
11054 | static void | 11054 | static void | ||
11055 | _evas_textblock_node_format_free(Efl_Canvas_Text_Data *o, | 11055 | _evas_textblock_node_format_free(Efl_Canvas_Text_Canvas_Data *o, | ||
11056 | Evas_Object_Textblock_Node_Format *n) | 11056 | Evas_Object_Textblock_Node_Format *n) | ||
11057 | { | 11057 | { | ||
11058 | if (!n) return; | 11058 | if (!n) return; | ||
11059 | eina_stringshare_del(n->format); | 11059 | eina_stringshare_del(n->format); | ||
11060 | eina_stringshare_del(n->orig_format); | 11060 | eina_stringshare_del(n->orig_format); | ||
11061 | if (n->anchor == ANCHOR_ITEM) | 11061 | if (n->anchor == ANCHOR_ITEM) | ||
11062 | o->anchors_item = eina_list_remove(o->anchors_item, n); | 11062 | o->anchors_item = eina_list_remove(o->anchors_item, n); | ||
11063 | else if (n->anchor == ANCHOR_A) | 11063 | else if (n->anchor == ANCHOR_A) | ||
11064 | o->anchors_a = eina_list_remove(o->anchors_a, n); | 11064 | o->anchors_a = eina_list_remove(o->anchors_a, n); | ||
11065 | free(n); | 11065 | free(n); | ||
11066 | } | 11066 | } | ||
11067 | 11067 | | |||
11068 | /** | 11068 | /** | ||
11069 | * @internal | 11069 | * @internal | ||
11070 | * Create a new format node. | 11070 | * Create a new format node. | ||
11071 | * | 11071 | * | ||
11072 | * @param format the text to create the format node from. | 11072 | * @param format the text to create the format node from. | ||
11073 | * @param o the textblock object. | 11073 | * @param o the textblock object. | ||
11074 | * @return Returns the new format node | 11074 | * @return Returns the new format node | ||
11075 | */ | 11075 | */ | ||
11076 | static Evas_Object_Textblock_Node_Format * | 11076 | static Evas_Object_Textblock_Node_Format * | ||
11077 | _evas_textblock_node_format_new(Efl_Canvas_Text_Data *o, const char *_format, | 11077 | _evas_textblock_node_format_new(Efl_Canvas_Text_Canvas_Data *o, const char *_format, | ||
11078 | Eina_Bool is_item) | 11078 | Eina_Bool is_item) | ||
11079 | { | 11079 | { | ||
11080 | Evas_Object_Textblock_Node_Format *n; | 11080 | Evas_Object_Textblock_Node_Format *n; | ||
11081 | const char *format = _format; | 11081 | const char *format = _format; | ||
11082 | const char *pre_stripped_format = NULL; | 11082 | const char *pre_stripped_format = NULL; | ||
11083 | 11083 | | |||
11084 | n = calloc(1, sizeof(Evas_Object_Textblock_Node_Format)); | 11084 | n = calloc(1, sizeof(Evas_Object_Textblock_Node_Format)); | ||
11085 | /* Create orig_format and format */ | 11085 | /* Create orig_format and format */ | ||
▲ Show 20 Lines • Show All 132 Lines • ▼ Show 20 Line(s) | |||||
11218 | { | 11218 | { | ||
11219 | Evas_Object_Textblock_Node_Format *n; | 11219 | Evas_Object_Textblock_Node_Format *n; | ||
11220 | Eina_Bool is_visible; | 11220 | Eina_Bool is_visible; | ||
11221 | 11221 | | |||
11222 | if (!cur) return EINA_FALSE; | 11222 | if (!cur) return EINA_FALSE; | ||
11223 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 11223 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
11224 | evas_object_async_block(obj); | 11224 | evas_object_async_block(obj); | ||
11225 | if ((!format) || (format[0] == 0)) return EINA_FALSE; | 11225 | if ((!format) || (format[0] == 0)) return EINA_FALSE; | ||
11226 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 11226 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
11227 | /* We should always have at least one text node */ | 11227 | /* We should always have at least one text node */ | ||
11228 | if (!o->text_nodes) | 11228 | if (!o->text_nodes) | ||
11229 | { | 11229 | { | ||
11230 | _evas_textblock_cursor_text_prepend(cur, ""); | 11230 | _evas_textblock_cursor_text_prepend(cur, ""); | ||
11231 | } | 11231 | } | ||
11232 | 11232 | | |||
11233 | n = _evas_textblock_node_format_new(o, format, is_item); | 11233 | n = _evas_textblock_node_format_new(o, format, is_item); | ||
11234 | is_visible = n->visible; | 11234 | is_visible = n->visible; | ||
▲ Show 20 Lines • Show All 153 Lines • ▼ Show 20 Line(s) | |||||
11388 | { | 11388 | { | ||
11389 | Evas_Object_Textblock_Node_Text *n, *n2; | 11389 | Evas_Object_Textblock_Node_Text *n, *n2; | ||
11390 | const Eina_Unicode *text; | 11390 | const Eina_Unicode *text; | ||
11391 | int chr, ind, ppos; | 11391 | int chr, ind, ppos; | ||
11392 | 11392 | | |||
11393 | if (!cur || !cur->node) return; | 11393 | if (!cur || !cur->node) return; | ||
11394 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 11394 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
11395 | evas_object_async_block(obj); | 11395 | evas_object_async_block(obj); | ||
11396 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 11396 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
11397 | n = cur->node; | 11397 | n = cur->node; | ||
11398 | 11398 | | |||
11399 | text = eina_ustrbuf_string_get(n->unicode); | 11399 | text = eina_ustrbuf_string_get(n->unicode); | ||
11400 | ind = cur->pos; | 11400 | ind = cur->pos; | ||
11401 | if (text[ind]) | 11401 | if (text[ind]) | ||
11402 | chr = text[ind++]; | 11402 | chr = text[ind++]; | ||
11403 | else | 11403 | else | ||
11404 | chr = 0; | 11404 | chr = 0; | ||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | 11448 | if (cur->pos == eina_ustrbuf_length_get(n->unicode)) | |||
11457 | } | 11457 | } | ||
11458 | 11458 | | |||
11459 | _evas_textblock_cursors_update_offset(cur, n, ppos, -(ind - ppos)); | 11459 | _evas_textblock_cursors_update_offset(cur, n, ppos, -(ind - ppos)); | ||
11460 | _evas_textblock_changed(o, cur->obj); | 11460 | _evas_textblock_changed(o, cur->obj); | ||
11461 | cur->node->dirty = EINA_TRUE; | 11461 | cur->node->dirty = EINA_TRUE; | ||
11462 | } | 11462 | } | ||
11463 | 11463 | | |||
11464 | EOLIAN static void | 11464 | EOLIAN static void | ||
11465 | _efl_canvas_text_efl_text_cursor_cursor_char_delete(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | 11465 | _efl_canvas_text_canvas_efl_text_cursor_cursor_char_delete(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | ||
11466 | { | 11466 | { | ||
11467 | ASYNC_BLOCK; | 11467 | ASYNC_BLOCK; | ||
11468 | evas_textblock_cursor_char_delete(cur); | 11468 | evas_textblock_cursor_char_delete(cur); | ||
11469 | efl_event_callback_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CHANGED, NULL); | 11469 | efl_event_callback_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CHANGED, NULL); | ||
11470 | } | 11470 | } | ||
11471 | 11471 | | |||
11472 | EAPI void | 11472 | EAPI void | ||
11473 | evas_textblock_cursor_range_delete(Efl_Text_Cursor_Cursor *cur1, Efl_Text_Cursor_Cursor *cur2) | 11473 | evas_textblock_cursor_range_delete(Efl_Text_Cursor_Cursor *cur1, Efl_Text_Cursor_Cursor *cur2) | ||
11474 | { | 11474 | { | ||
11475 | if (!cur1) return; | 11475 | if (!cur1) return; | ||
11476 | efl_canvas_text_range_delete(cur1->obj, cur1, cur2); | 11476 | efl_canvas_text_canvas_range_delete(cur1->obj, cur1, cur2); | ||
11477 | } | 11477 | } | ||
11478 | 11478 | | |||
11479 | EOLIAN static void | 11479 | EOLIAN static void | ||
11480 | _efl_canvas_text_range_delete(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *pd EINA_UNUSED, | 11480 | _efl_canvas_text_canvas_range_delete(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *pd EINA_UNUSED, | ||
11481 | Efl_Text_Cursor_Cursor *cur1, Evas_Textblock_Cursor *cur2) | 11481 | Efl_Text_Cursor_Cursor *cur1, Evas_Textblock_Cursor *cur2) | ||
11482 | { | 11482 | { | ||
11483 | Evas_Object_Textblock_Node_Format *fnode = NULL; | 11483 | Evas_Object_Textblock_Node_Format *fnode = NULL; | ||
11484 | Evas_Object_Textblock_Node_Text *n1, *n2; | 11484 | Evas_Object_Textblock_Node_Text *n1, *n2; | ||
11485 | Eina_Bool should_merge = EINA_FALSE, reset_cursor = EINA_FALSE; | 11485 | Eina_Bool should_merge = EINA_FALSE, reset_cursor = EINA_FALSE; | ||
11486 | 11486 | | |||
11487 | if (!cur1 || !cur1->node) return; | 11487 | if (!cur1 || !cur1->node) return; | ||
11488 | if (!cur2 || !cur2->node) return; | 11488 | if (!cur2 || !cur2->node) return; | ||
11489 | if (cur1->obj != cur2->obj) return; | 11489 | if (cur1->obj != cur2->obj) return; | ||
11490 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur1->obj, EFL_CANVAS_OBJECT_CLASS); | 11490 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur1->obj, EFL_CANVAS_OBJECT_CLASS); | ||
11491 | evas_object_async_block(obj); | 11491 | evas_object_async_block(obj); | ||
11492 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur1->obj, MY_CLASS); | 11492 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur1->obj, MY_CLASS); | ||
11493 | if (evas_textblock_cursor_compare(cur1, cur2) > 0) | 11493 | if (evas_textblock_cursor_compare(cur1, cur2) > 0) | ||
11494 | { | 11494 | { | ||
11495 | Efl_Text_Cursor_Cursor *tc; | 11495 | Efl_Text_Cursor_Cursor *tc; | ||
11496 | 11496 | | |||
11497 | tc = cur1; | 11497 | tc = cur1; | ||
11498 | cur1 = cur2; | 11498 | cur1 = cur2; | ||
11499 | cur2 = tc; | 11499 | cur2 = tc; | ||
11500 | } | 11500 | } | ||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | 11570 | if (should_merge) | |||
11575 | } | 11575 | } | ||
11576 | _evas_textblock_node_format_remove_matching(o, fnode); | 11576 | _evas_textblock_node_format_remove_matching(o, fnode); | ||
11577 | 11577 | | |||
11578 | evas_textblock_cursor_copy(cur1, cur2); | 11578 | evas_textblock_cursor_copy(cur1, cur2); | ||
11579 | if (reset_cursor) | 11579 | if (reset_cursor) | ||
11580 | evas_textblock_cursor_copy(cur1, o->cursor); | 11580 | evas_textblock_cursor_copy(cur1, o->cursor); | ||
11581 | 11581 | | |||
11582 | _evas_textblock_changed(o, cur1->obj); | 11582 | _evas_textblock_changed(o, cur1->obj); | ||
11583 | efl_event_callback_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CHANGED, NULL); | 11583 | efl_event_callback_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CHANGED, NULL); | ||
11584 | } | 11584 | } | ||
11585 | 11585 | | |||
11586 | EOLIAN static Eina_Unicode | 11586 | EOLIAN static Eina_Unicode | ||
11587 | _efl_canvas_text_efl_text_cursor_cursor_content_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, | 11587 | _efl_canvas_text_canvas_efl_text_cursor_cursor_content_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, | ||
11588 | const Efl_Text_Cursor_Cursor *cur) | 11588 | const Efl_Text_Cursor_Cursor *cur) | ||
11589 | { | 11589 | { | ||
11590 | ASYNC_BLOCK; | 11590 | ASYNC_BLOCK; | ||
11591 | return eina_ustrbuf_string_get(cur->node->unicode)[cur->pos]; | 11591 | return eina_ustrbuf_string_get(cur->node->unicode)[cur->pos]; | ||
11592 | } | 11592 | } | ||
11593 | 11593 | | |||
11594 | EAPI char * | 11594 | EAPI char * | ||
11595 | evas_textblock_cursor_content_get(const Evas_Textblock_Cursor *cur) | 11595 | evas_textblock_cursor_content_get(const Evas_Textblock_Cursor *cur) | ||
▲ Show 20 Lines • Show All 133 Lines • ▼ Show 20 Line(s) | 11728 | { | |||
11729 | char *ret; | 11729 | char *ret; | ||
11730 | ret = eina_strbuf_string_steal(buf); | 11730 | ret = eina_strbuf_string_steal(buf); | ||
11731 | eina_strbuf_free(buf); | 11731 | eina_strbuf_free(buf); | ||
11732 | return ret; | 11732 | return ret; | ||
11733 | } | 11733 | } | ||
11734 | } | 11734 | } | ||
11735 | 11735 | | |||
11736 | EOLIAN char * | 11736 | EOLIAN char * | ||
11737 | _efl_canvas_text_efl_text_markup_interactive_markup_range_get(const Eo *eo_obj, | 11737 | _efl_canvas_text_canvas_efl_text_markup_interactive_markup_range_get(const Eo *eo_obj, | ||
11738 | Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *start, | 11738 | Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *start, | ||
11739 | Efl_Text_Cursor_Cursor *end) | 11739 | Efl_Text_Cursor_Cursor *end) | ||
11740 | { | 11740 | { | ||
11741 | if (!start || !start->node) return NULL; | 11741 | if (!start || !start->node) return NULL; | ||
11742 | if (!end || !end->node) return NULL; | 11742 | if (!end || !end->node) return NULL; | ||
11743 | if ((start->obj != eo_obj) || (start->obj != end->obj)) return NULL; | 11743 | if ((start->obj != eo_obj) || (start->obj != end->obj)) return NULL; | ||
11744 | return _evas_textblock_cursor_range_text_markup_get(start, end); | 11744 | return _evas_textblock_cursor_range_text_markup_get(start, end); | ||
11745 | } | 11745 | } | ||
11746 | 11746 | | |||
▲ Show 20 Lines • Show All 147 Lines • ▼ Show 20 Line(s) | |||||
11894 | // Add to legacy api | 11894 | // Add to legacy api | ||
11895 | EAPI char * | 11895 | EAPI char * | ||
11896 | evas_textblock_cursor_range_text_get(const Efl_Text_Cursor_Cursor *cur1, const Evas_Textblock_Cursor *cur2, Evas_Textblock_Text_Type format) | 11896 | evas_textblock_cursor_range_text_get(const Efl_Text_Cursor_Cursor *cur1, const Evas_Textblock_Cursor *cur2, Evas_Textblock_Text_Type format) | ||
11897 | { | 11897 | { | ||
11898 | return _evas_textblock_cursor_range_text_get(cur1, cur2, format); | 11898 | return _evas_textblock_cursor_range_text_get(cur1, cur2, format); | ||
11899 | } | 11899 | } | ||
11900 | 11900 | | |||
11901 | EOLIAN static char * | 11901 | EOLIAN static char * | ||
11902 | _efl_canvas_text_range_text_get(const Eo *eo_obj EINA_UNUSED, | 11902 | _efl_canvas_text_canvas_range_text_get(const Eo *eo_obj EINA_UNUSED, | ||
11903 | Efl_Canvas_Text_Data *pd EINA_UNUSED, | 11903 | Efl_Canvas_Text_Canvas_Data *pd EINA_UNUSED, | ||
11904 | const Efl_Text_Cursor_Cursor *cur1, | 11904 | const Efl_Text_Cursor_Cursor *cur1, | ||
11905 | const Evas_Textblock_Cursor *cur2) | 11905 | const Evas_Textblock_Cursor *cur2) | ||
11906 | { | 11906 | { | ||
11907 | return _evas_textblock_cursor_range_text_get(cur1, cur2, EVAS_TEXTBLOCK_TEXT_PLAIN); | 11907 | return _evas_textblock_cursor_range_text_get(cur1, cur2, EVAS_TEXTBLOCK_TEXT_PLAIN); | ||
11908 | } | 11908 | } | ||
11909 | 11909 | | |||
11910 | EAPI const char * | 11910 | EAPI const char * | ||
11911 | evas_textblock_cursor_paragraph_text_get(const Evas_Textblock_Cursor *cur) | 11911 | evas_textblock_cursor_paragraph_text_get(const Evas_Textblock_Cursor *cur) | ||
▲ Show 20 Lines • Show All 147 Lines • ▼ Show 20 Line(s) | 12058 | { | |||
12059 | if (!cur) return EINA_FALSE; | 12059 | if (!cur) return EINA_FALSE; | ||
12060 | return efl_text_cursor_geometry_get(cur->obj, cur, | 12060 | return efl_text_cursor_geometry_get(cur->obj, cur, | ||
12061 | (ctype == EVAS_TEXTBLOCK_CURSOR_BEFORE) ? | 12061 | (ctype == EVAS_TEXTBLOCK_CURSOR_BEFORE) ? | ||
12062 | EFL_TEXT_CURSOR_TYPE_BEFORE : EFL_TEXT_CURSOR_TYPE_UNDER, | 12062 | EFL_TEXT_CURSOR_TYPE_BEFORE : EFL_TEXT_CURSOR_TYPE_UNDER, | ||
12063 | cx, cy, cw, ch, cx2, cy2, cw2, ch2); | 12063 | cx, cy, cw, ch, cx2, cy2, cw2, ch2); | ||
12064 | } | 12064 | } | ||
12065 | 12065 | | |||
12066 | EOLIAN static Eina_Bool | 12066 | EOLIAN static Eina_Bool | ||
12067 | _efl_canvas_text_efl_text_cursor_cursor_geometry_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, const Efl_Text_Cursor_Cursor *cur, Efl_Text_Cursor_Type ctype, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_Coord *cx2, Evas_Coord *cy2, Evas_Coord *cw2, Evas_Coord *ch2) | 12067 | _efl_canvas_text_canvas_efl_text_cursor_cursor_geometry_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, const Efl_Text_Cursor_Cursor *cur, Efl_Text_Cursor_Type ctype, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_Coord *cx2, Evas_Coord *cy2, Evas_Coord *cw2, Evas_Coord *ch2) | ||
12068 | { | 12068 | { | ||
12069 | ASYNC_BLOCK; | 12069 | ASYNC_BLOCK; | ||
12070 | if (!cur) return EINA_FALSE; | 12070 | if (!cur) return EINA_FALSE; | ||
12071 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 12071 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
12072 | evas_object_async_block(obj); | 12072 | evas_object_async_block(obj); | ||
12073 | 12073 | | |||
12074 | if (!_relayout_if_needed(cur->obj, o)) return EINA_FALSE; | 12074 | if (!_relayout_if_needed(cur->obj, o)) return EINA_FALSE; | ||
12075 | 12075 | | |||
▲ Show 20 Lines • Show All 174 Lines • ▼ Show 20 Line(s) | |||||
12250 | 12250 | | |||
12251 | EAPI int | 12251 | EAPI int | ||
12252 | evas_textblock_cursor_geometry_get(const Efl_Text_Cursor_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_BiDi_Direction *dir, Evas_Textblock_Cursor_Type ctype) | 12252 | evas_textblock_cursor_geometry_get(const Efl_Text_Cursor_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_BiDi_Direction *dir, Evas_Textblock_Cursor_Type ctype) | ||
12253 | { | 12253 | { | ||
12254 | int ret = -1; | 12254 | int ret = -1; | ||
12255 | if (!cur) return -1; | 12255 | if (!cur) return -1; | ||
12256 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 12256 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
12257 | evas_object_async_block(obj); | 12257 | evas_object_async_block(obj); | ||
12258 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 12258 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
12259 | 12259 | | |||
12260 | _relayout_if_needed(cur->obj, o); | 12260 | _relayout_if_needed(cur->obj, o); | ||
12261 | 12261 | | |||
12262 | if (ctype == EVAS_TEXTBLOCK_CURSOR_UNDER) | 12262 | if (ctype == EVAS_TEXTBLOCK_CURSOR_UNDER) | ||
12263 | { | 12263 | { | ||
12264 | Evas_Object_Textblock_Line *ln; | 12264 | Evas_Object_Textblock_Line *ln; | ||
12265 | Evas_Object_Textblock_Item *it; | 12265 | Evas_Object_Textblock_Item *it; | ||
12266 | 12266 | | |||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 12327 | { | |||
12329 | Evas_Object_Textblock_Item *it = NULL; | 12329 | Evas_Object_Textblock_Item *it = NULL; | ||
12330 | Evas_Object_Textblock_Text_Item *ti = NULL; | 12330 | Evas_Object_Textblock_Text_Item *ti = NULL; | ||
12331 | Evas_Object_Textblock_Format_Item *fi = NULL; | 12331 | Evas_Object_Textblock_Format_Item *fi = NULL; | ||
12332 | int x = 0, y = 0, w = 0, h = 0; | 12332 | int x = 0, y = 0, w = 0, h = 0; | ||
12333 | int pos; | 12333 | int pos; | ||
12334 | Eina_Bool previous_format; | 12334 | Eina_Bool previous_format; | ||
12335 | 12335 | | |||
12336 | if (!cur) return -1; | 12336 | if (!cur) return -1; | ||
12337 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 12337 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
12338 | 12338 | | |||
12339 | _relayout_if_needed(cur->obj, o); | 12339 | _relayout_if_needed(cur->obj, o); | ||
12340 | 12340 | | |||
12341 | if (!cur->node) | 12341 | if (!cur->node) | ||
12342 | { | 12342 | { | ||
12343 | if (!o->text_nodes) | 12343 | if (!o->text_nodes) | ||
12344 | { | 12344 | { | ||
12345 | if (!o->paragraphs) return -1; | 12345 | if (!o->paragraphs) return -1; | ||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Line(s) | |||||
12463 | { | 12463 | { | ||
12464 | Evas_Object_Textblock_Line *ln = NULL; | 12464 | Evas_Object_Textblock_Line *ln = NULL; | ||
12465 | Evas_Object_Textblock_Item *it = NULL; | 12465 | Evas_Object_Textblock_Item *it = NULL; | ||
12466 | int x, y, w, h; | 12466 | int x, y, w, h; | ||
12467 | 12467 | | |||
12468 | if (!cur) return -1; | 12468 | if (!cur) return -1; | ||
12469 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 12469 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
12470 | evas_object_async_block(obj); | 12470 | evas_object_async_block(obj); | ||
12471 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 12471 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
12472 | 12472 | | |||
12473 | _relayout_if_needed(cur->obj, o); | 12473 | _relayout_if_needed(cur->obj, o); | ||
12474 | 12474 | | |||
12475 | if (!cur->node) | 12475 | if (!cur->node) | ||
12476 | { | 12476 | { | ||
12477 | ln = o->paragraphs->lines; | 12477 | ln = o->paragraphs->lines; | ||
12478 | } | 12478 | } | ||
12479 | else | 12479 | else | ||
Show All 10 Lines | |||||
12490 | if (cw) *cw = w; | 12490 | if (cw) *cw = w; | ||
12491 | if (ch) *ch = h; | 12491 | if (ch) *ch = h; | ||
12492 | return ln->par->line_no + ln->line_no; | 12492 | return ln->par->line_no + ln->line_no; | ||
12493 | } | 12493 | } | ||
12494 | 12494 | | |||
12495 | EAPI Eina_Bool | 12495 | EAPI Eina_Bool | ||
12496 | evas_textblock_cursor_visible_range_get(Efl_Text_Cursor_Cursor *start, Evas_Textblock_Cursor *end) | 12496 | evas_textblock_cursor_visible_range_get(Efl_Text_Cursor_Cursor *start, Evas_Textblock_Cursor *end) | ||
12497 | { | 12497 | { | ||
12498 | return efl_canvas_text_visible_range_get(start->obj, start, end); | 12498 | return efl_canvas_text_canvas_visible_range_get(start->obj, start, end); | ||
12499 | } | 12499 | } | ||
12500 | 12500 | | |||
12501 | EOLIAN static Eina_Bool | 12501 | EOLIAN static Eina_Bool | ||
12502 | _efl_canvas_text_visible_range_get(Eo *eo_obj EINA_UNUSED, | 12502 | _efl_canvas_text_canvas_visible_range_get(Eo *eo_obj EINA_UNUSED, | ||
12503 | Efl_Canvas_Text_Data *pd EINA_UNUSED, | 12503 | Efl_Canvas_Text_Canvas_Data *pd EINA_UNUSED, | ||
12504 | Efl_Text_Cursor_Cursor *start, Evas_Textblock_Cursor *end) | 12504 | Efl_Text_Cursor_Cursor *start, Evas_Textblock_Cursor *end) | ||
12505 | { | 12505 | { | ||
12506 | Evas *eo_e; | 12506 | Evas *eo_e; | ||
12507 | Evas_Coord cy, ch; | 12507 | Evas_Coord cy, ch; | ||
12508 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 12508 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
12509 | evas_object_async_block(obj); | 12509 | evas_object_async_block(obj); | ||
12510 | TB_HEAD_RETURN(EINA_FALSE); | 12510 | TB_HEAD_RETURN(EINA_FALSE); | ||
12511 | eo_e = evas_object_evas_get(eo_obj); | 12511 | eo_e = evas_object_evas_get(eo_obj); | ||
Show All 14 Lines | 12524 | { | |||
12526 | Evas_Object_Textblock_Line *ln; | 12526 | Evas_Object_Textblock_Line *ln; | ||
12527 | Evas_Object_Textblock_Item *it = NULL; | 12527 | Evas_Object_Textblock_Item *it = NULL; | ||
12528 | Eina_Bool ret = EINA_FALSE; | 12528 | Eina_Bool ret = EINA_FALSE; | ||
12529 | 12529 | | |||
12530 | if (!cur) return ret; | 12530 | if (!cur) return ret; | ||
12531 | 12531 | | |||
12532 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 12532 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
12533 | evas_object_async_block(obj); | 12533 | evas_object_async_block(obj); | ||
12534 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 12534 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
12535 | 12535 | | |||
12536 | _relayout_if_needed(cur->obj, o); | 12536 | _relayout_if_needed(cur->obj, o); | ||
12537 | 12537 | | |||
12538 | x += o->style_pad.l; | 12538 | x += o->style_pad.l; | ||
12539 | y += o->style_pad.t; | 12539 | y += o->style_pad.t; | ||
12540 | 12540 | | |||
12541 | found_par = _layout_find_paragraph_by_y(o, y); | 12541 | found_par = _layout_find_paragraph_by_y(o, y); | ||
12542 | if (found_par) | 12542 | if (found_par) | ||
▲ Show 20 Lines • Show All 160 Lines • ▼ Show 20 Line(s) | 12701 | { | |||
12703 | ret = EINA_TRUE; | 12703 | ret = EINA_TRUE; | ||
12704 | goto end; | 12704 | goto end; | ||
12705 | } | 12705 | } | ||
12706 | } | 12706 | } | ||
12707 | 12707 | | |||
12708 | end: | 12708 | end: | ||
12709 | if (ret) | 12709 | if (ret) | ||
12710 | { | 12710 | { | ||
12711 | efl_event_callback_legacy_call(cur->obj, EFL_CANVAS_TEXT_EVENT_CURSOR_CHANGED, NULL); | 12711 | efl_event_callback_legacy_call(cur->obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CURSOR_CHANGED, NULL); | ||
12712 | } | 12712 | } | ||
12713 | return ret; | 12713 | return ret; | ||
12714 | } | 12714 | } | ||
12715 | 12715 | | |||
12716 | EAPI Eina_Bool | 12716 | EAPI Eina_Bool | ||
12717 | evas_textblock_cursor_char_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord x, Evas_Coord y) | 12717 | evas_textblock_cursor_char_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord x, Evas_Coord y) | ||
12718 | { | 12718 | { | ||
12719 | return _evas_textblock_cursor_coord_set(cur, x, y, EINA_FALSE); | 12719 | return _evas_textblock_cursor_coord_set(cur, x, y, EINA_FALSE); | ||
12720 | } | 12720 | } | ||
12721 | 12721 | | |||
12722 | EAPI Eina_Bool | 12722 | EAPI Eina_Bool | ||
12723 | evas_textblock_cursor_cluster_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord x, Evas_Coord y) | 12723 | evas_textblock_cursor_cluster_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord x, Evas_Coord y) | ||
12724 | { | 12724 | { | ||
12725 | return _evas_textblock_cursor_coord_set(cur, x, y, EINA_TRUE); | 12725 | return _evas_textblock_cursor_coord_set(cur, x, y, EINA_TRUE); | ||
12726 | } | 12726 | } | ||
12727 | 12727 | | |||
12728 | EOLIAN static void | 12728 | EOLIAN static void | ||
12729 | _efl_canvas_text_efl_text_cursor_cursor_coord_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur EINA_UNUSED, | 12729 | _efl_canvas_text_canvas_efl_text_cursor_cursor_coord_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur EINA_UNUSED, | ||
12730 | Evas_Coord x, Evas_Coord y) | 12730 | Evas_Coord x, Evas_Coord y) | ||
12731 | { | 12731 | { | ||
12732 | ASYNC_BLOCK; | 12732 | ASYNC_BLOCK; | ||
12733 | evas_textblock_cursor_char_coord_set(cur, x, y); | 12733 | evas_textblock_cursor_char_coord_set(cur, x, y); | ||
12734 | } | 12734 | } | ||
12735 | 12735 | | |||
12736 | EOLIAN static void | 12736 | EOLIAN static void | ||
12737 | _efl_canvas_text_efl_text_cursor_cursor_cluster_coord_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur EINA_UNUSED, | 12737 | _efl_canvas_text_canvas_efl_text_cursor_cursor_cluster_coord_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur EINA_UNUSED, | ||
12738 | Evas_Coord x, Evas_Coord y) | 12738 | Evas_Coord x, Evas_Coord y) | ||
12739 | { | 12739 | { | ||
12740 | ASYNC_BLOCK; | 12740 | ASYNC_BLOCK; | ||
12741 | evas_textblock_cursor_cluster_coord_set(cur, x, y); | 12741 | evas_textblock_cursor_cluster_coord_set(cur, x, y); | ||
12742 | } | 12742 | } | ||
12743 | 12743 | | |||
12744 | EAPI int | 12744 | EAPI int | ||
12745 | evas_textblock_cursor_line_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord y) | 12745 | evas_textblock_cursor_line_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord y) | ||
12746 | { | 12746 | { | ||
12747 | Evas_Object_Textblock_Paragraph *found_par; | 12747 | Evas_Object_Textblock_Paragraph *found_par; | ||
12748 | Evas_Object_Textblock_Line *ln; | 12748 | Evas_Object_Textblock_Line *ln; | ||
12749 | 12749 | | |||
12750 | if (!cur) return -1; | 12750 | if (!cur) return -1; | ||
12751 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 12751 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
12752 | evas_object_async_block(obj); | 12752 | evas_object_async_block(obj); | ||
12753 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 12753 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
12754 | 12754 | | |||
12755 | _relayout_if_needed(cur->obj, o); | 12755 | _relayout_if_needed(cur->obj, o); | ||
12756 | 12756 | | |||
12757 | y += o->style_pad.t; | 12757 | y += o->style_pad.t; | ||
12758 | 12758 | | |||
12759 | found_par = _layout_find_paragraph_by_y(o, y); | 12759 | found_par = _layout_find_paragraph_by_y(o, y); | ||
12760 | 12760 | | |||
12761 | if (found_par) | 12761 | if (found_par) | ||
▲ Show 20 Lines • Show All 402 Lines • ▼ Show 20 Line(s) | 13160 | if (tr->w == 0) | |||
13164 | } | 13164 | } | ||
13165 | return tr; | 13165 | return tr; | ||
13166 | } | 13166 | } | ||
13167 | 13167 | | |||
13168 | EAPI Eina_Iterator * | 13168 | EAPI Eina_Iterator * | ||
13169 | evas_textblock_cursor_range_simple_geometry_get(const Efl_Text_Cursor_Cursor *cur1, const Evas_Textblock_Cursor *cur2) | 13169 | evas_textblock_cursor_range_simple_geometry_get(const Efl_Text_Cursor_Cursor *cur1, const Evas_Textblock_Cursor *cur2) | ||
13170 | { | 13170 | { | ||
13171 | if (!cur1) return NULL; | 13171 | if (!cur1) return NULL; | ||
13172 | return efl_canvas_text_range_simple_geometry_get(cur1->obj, cur1, cur2); | 13172 | return efl_canvas_text_canvas_range_simple_geometry_get(cur1->obj, cur1, cur2); | ||
13173 | } | 13173 | } | ||
13174 | 13174 | | |||
13175 | EOLIAN static Eina_Iterator * | 13175 | EOLIAN static Eina_Iterator * | ||
13176 | _efl_canvas_text_range_simple_geometry_get(Eo *eo_obj EINA_UNUSED, | 13176 | _efl_canvas_text_canvas_range_simple_geometry_get(Eo *eo_obj EINA_UNUSED, | ||
13177 | Efl_Canvas_Text_Data *o, const Efl_Text_Cursor_Cursor *cur1, const | 13177 | Efl_Canvas_Text_Canvas_Data *o, const Efl_Text_Cursor_Cursor *cur1, const | ||
13178 | Evas_Textblock_Cursor *cur2) | 13178 | Evas_Textblock_Cursor *cur2) | ||
13179 | { | 13179 | { | ||
13180 | Evas_Object_Textblock_Line *ln1, *ln2; | 13180 | Evas_Object_Textblock_Line *ln1, *ln2; | ||
13181 | Evas_Object_Textblock_Item *it1, *it2; | 13181 | Evas_Object_Textblock_Item *it1, *it2; | ||
13182 | Eina_List *rects = NULL; | 13182 | Eina_List *rects = NULL; | ||
13183 | Eina_Iterator *itr = NULL; | 13183 | Eina_Iterator *itr = NULL; | ||
13184 | 13184 | | |||
13185 | if (!cur1 || !cur1->node) return NULL; | 13185 | if (!cur1 || !cur1->node) return NULL; | ||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | 13214 | { | |||
13275 | rects = eina_list_merge(rects, rects2); | 13275 | rects = eina_list_merge(rects, rects2); | ||
13276 | } | 13276 | } | ||
13277 | itr = _evas_textblock_selection_iterator_new(rects); | 13277 | itr = _evas_textblock_selection_iterator_new(rects); | ||
13278 | 13278 | | |||
13279 | return itr; | 13279 | return itr; | ||
13280 | } | 13280 | } | ||
13281 | 13281 | | |||
13282 | static Eina_List * | 13282 | static Eina_List * | ||
13283 | _efl_canvas_text_range_geometry_list_get(Eo *eo_obj EINA_UNUSED, | 13283 | _efl_canvas_text_canvas_range_geometry_list_get(Eo *eo_obj EINA_UNUSED, | ||
13284 | Efl_Canvas_Text_Data *o, const Efl_Text_Cursor_Cursor *cur1, const | 13284 | Efl_Canvas_Text_Canvas_Data *o, const Efl_Text_Cursor_Cursor *cur1, const | ||
13285 | Evas_Textblock_Cursor *cur2) | 13285 | Evas_Textblock_Cursor *cur2) | ||
13286 | { | 13286 | { | ||
13287 | Evas_Object_Textblock_Line *ln1, *ln2; | 13287 | Evas_Object_Textblock_Line *ln1, *ln2; | ||
13288 | Evas_Object_Textblock_Item *it1, *it2; | 13288 | Evas_Object_Textblock_Item *it1, *it2; | ||
13289 | Eina_List *rects = NULL; | 13289 | Eina_List *rects = NULL; | ||
13290 | Evas_Textblock_Rectangle *tr; | 13290 | Evas_Textblock_Rectangle *tr; | ||
13291 | 13291 | | |||
13292 | if (!cur1 || !cur1->node) return NULL; | 13292 | if (!cur1 || !cur1->node) return NULL; | ||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | 13322 | { | |||
13354 | rects = eina_list_merge(rects, rects2); | 13354 | rects = eina_list_merge(rects, rects2); | ||
13355 | } | 13355 | } | ||
13356 | return rects; | 13356 | return rects; | ||
13357 | } | 13357 | } | ||
13358 | 13358 | | |||
13359 | EAPI Eina_List * | 13359 | EAPI Eina_List * | ||
13360 | evas_textblock_cursor_range_geometry_get(const Efl_Text_Cursor_Cursor *cur1, const Evas_Textblock_Cursor *cur2_obj) | 13360 | evas_textblock_cursor_range_geometry_get(const Efl_Text_Cursor_Cursor *cur1, const Evas_Textblock_Cursor *cur2_obj) | ||
13361 | { | 13361 | { | ||
13362 | Efl_Canvas_Text_Data *o; | 13362 | Efl_Canvas_Text_Canvas_Data *o; | ||
13363 | 13363 | | |||
13364 | if (!cur1) return NULL; | 13364 | if (!cur1) return NULL; | ||
13365 | 13365 | | |||
13366 | o = efl_data_scope_get(cur1->obj, MY_CLASS); | 13366 | o = efl_data_scope_get(cur1->obj, MY_CLASS); | ||
13367 | 13367 | | |||
13368 | return _efl_canvas_text_range_geometry_list_get(cur1->obj, o, cur1, cur2_obj); | 13368 | return _efl_canvas_text_canvas_range_geometry_list_get(cur1->obj, o, cur1, cur2_obj); | ||
13369 | } | 13369 | } | ||
13370 | 13370 | | |||
13371 | EOLIAN static Eina_Iterator * | 13371 | EOLIAN static Eina_Iterator * | ||
13372 | _efl_canvas_text_range_geometry_get(Eo *eo_obj EINA_UNUSED, | 13372 | _efl_canvas_text_canvas_range_geometry_get(Eo *eo_obj EINA_UNUSED, | ||
13373 | Efl_Canvas_Text_Data *o, const Efl_Text_Cursor_Cursor *cur1, const | 13373 | Efl_Canvas_Text_Canvas_Data *o, const Efl_Text_Cursor_Cursor *cur1, const | ||
13374 | Evas_Textblock_Cursor *cur2) | 13374 | Evas_Textblock_Cursor *cur2) | ||
13375 | { | 13375 | { | ||
13376 | Eina_List *rects = _efl_canvas_text_range_geometry_list_get(eo_obj, | 13376 | Eina_List *rects = _efl_canvas_text_canvas_range_geometry_list_get(eo_obj, | ||
13377 | o, cur1, cur2); | 13377 | o, cur1, cur2); | ||
13378 | return _evas_textblock_selection_iterator_new(rects); | 13378 | return _evas_textblock_selection_iterator_new(rects); | ||
13379 | } | 13379 | } | ||
13380 | 13380 | | |||
13381 | static Eina_Bool | 13381 | static Eina_Bool | ||
13382 | _evas_textblock_cursor_format_item_geometry_get(const Efl_Text_Cursor_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) | 13382 | _evas_textblock_cursor_format_item_geometry_get(const Efl_Text_Cursor_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) | ||
13383 | { | 13383 | { | ||
13384 | Evas_Object_Textblock_Line *ln = NULL; | 13384 | Evas_Object_Textblock_Line *ln = NULL; | ||
13385 | Evas_Object_Textblock_Format_Item *fi; | 13385 | Evas_Object_Textblock_Format_Item *fi; | ||
13386 | Evas_Object_Textblock_Item *it = NULL; | 13386 | Evas_Object_Textblock_Item *it = NULL; | ||
13387 | Evas_Coord x, y, w, h; | 13387 | Evas_Coord x, y, w, h; | ||
13388 | 13388 | | |||
13389 | if (!cur) return EINA_FALSE; | 13389 | if (!cur) return EINA_FALSE; | ||
13390 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 13390 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
13391 | evas_object_async_block(obj); | 13391 | evas_object_async_block(obj); | ||
13392 | Efl_Canvas_Text_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | 13392 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(cur->obj, MY_CLASS); | ||
13393 | 13393 | | |||
13394 | _relayout_if_needed(cur->obj, o); | 13394 | _relayout_if_needed(cur->obj, o); | ||
13395 | 13395 | | |||
13396 | if (!_evas_textblock_cursor_format_is_visible_get(cur)) return EINA_FALSE; | 13396 | if (!_evas_textblock_cursor_format_is_visible_get(cur)) return EINA_FALSE; | ||
13397 | _find_layout_item_line_match(cur->obj, cur->node, cur->pos, &ln, &it); | 13397 | _find_layout_item_line_match(cur->obj, cur->node, cur->pos, &ln, &it); | ||
13398 | if (it && (it->type != EVAS_TEXTBLOCK_ITEM_FORMAT)) return EINA_FALSE; | 13398 | if (it && (it->type != EVAS_TEXTBLOCK_ITEM_FORMAT)) return EINA_FALSE; | ||
13399 | fi = _ITEM_FORMAT(it); | 13399 | fi = _ITEM_FORMAT(it); | ||
13400 | if ((!ln) || (!fi)) return EINA_FALSE; | 13400 | if ((!ln) || (!fi)) return EINA_FALSE; | ||
Show All 36 Lines | |||||
13437 | /* general controls */ | 13437 | /* general controls */ | ||
13438 | EAPI Eina_Bool | 13438 | EAPI Eina_Bool | ||
13439 | evas_object_textblock_line_number_geometry_get(const Eo *eo_obj, int line, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) | 13439 | evas_object_textblock_line_number_geometry_get(const Eo *eo_obj, int line, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) | ||
13440 | { | 13440 | { | ||
13441 | EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, EINA_FALSE); | 13441 | EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, EINA_FALSE); | ||
13442 | Evas_Object_Textblock_Line *ln; | 13442 | Evas_Object_Textblock_Line *ln; | ||
13443 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 13443 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
13444 | evas_object_async_block(obj); | 13444 | evas_object_async_block(obj); | ||
13445 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 13445 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
13446 | 13446 | | |||
13447 | _relayout_if_needed((Evas_Object *)eo_obj, o); | 13447 | _relayout_if_needed((Evas_Object *)eo_obj, o); | ||
13448 | 13448 | | |||
13449 | ln = _find_layout_line_num(eo_obj, line); | 13449 | ln = _find_layout_line_num(eo_obj, line); | ||
13450 | if (!ln) return EINA_FALSE; | 13450 | if (!ln) return EINA_FALSE; | ||
13451 | if (cx) *cx = ln->x; | 13451 | if (cx) *cx = ln->x; | ||
13452 | if (cy) *cy = ln->par->y + ln->y; | 13452 | if (cy) *cy = ln->par->y + ln->y; | ||
13453 | if (cw) *cw = ln->w; | 13453 | if (cw) *cw = ln->w; | ||
Show All 9 Lines | 13460 | { | |||
13463 | Efl_Text_Cursor_Cursor *co; | 13463 | Efl_Text_Cursor_Cursor *co; | ||
13464 | Evas *eo_e; | 13464 | Evas *eo_e; | ||
13465 | Evas_Public_Data *evas; | 13465 | Evas_Public_Data *evas; | ||
13466 | 13466 | | |||
13467 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 13467 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
13468 | eo_e = evas_object_evas_get(eo_obj); | 13468 | eo_e = evas_object_evas_get(eo_obj); | ||
13469 | evas = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS); | 13469 | evas = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS); | ||
13470 | evas_object_async_block(obj); | 13470 | evas_object_async_block(obj); | ||
13471 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 13471 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
13472 | if (o->paragraphs) | 13472 | if (o->paragraphs) | ||
13473 | { | 13473 | { | ||
13474 | _paragraphs_free(evas, o, obj, o->paragraphs); | 13474 | _paragraphs_free(evas, o, obj, o->paragraphs); | ||
13475 | o->paragraphs = NULL; | 13475 | o->paragraphs = NULL; | ||
13476 | } | 13476 | } | ||
13477 | 13477 | | |||
13478 | _nodes_clear(eo_obj); | 13478 | _nodes_clear(eo_obj); | ||
13479 | co = o->cursor; | 13479 | co = o->cursor; | ||
Show All 18 Lines | 13495 | { | |||
13498 | 13498 | | |||
13499 | /* Force recreation of everything for textblock. | 13499 | /* Force recreation of everything for textblock. | ||
13500 | * FIXME: We have the same thing in other places, merge it... */ | 13500 | * FIXME: We have the same thing in other places, merge it... */ | ||
13501 | evas_textblock_cursor_paragraph_first(o->cursor); | 13501 | evas_textblock_cursor_paragraph_first(o->cursor); | ||
13502 | evas_textblock_cursor_text_append(o->cursor, ""); | 13502 | evas_textblock_cursor_text_append(o->cursor, ""); | ||
13503 | } | 13503 | } | ||
13504 | 13504 | | |||
13505 | EOLIAN static void | 13505 | EOLIAN static void | ||
13506 | _efl_canvas_text_size_formatted_get(const Eo *eo_obj, Efl_Canvas_Text_Data *o, Evas_Coord *w, Evas_Coord *h) | 13506 | _efl_canvas_text_canvas_size_formatted_get(const Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o, Evas_Coord *w, Evas_Coord *h) | ||
13507 | { | 13507 | { | ||
13508 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 13508 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
13509 | evas_object_async_block(obj); | 13509 | evas_object_async_block(obj); | ||
13510 | _relayout_if_needed(eo_obj, o); | 13510 | _relayout_if_needed(eo_obj, o); | ||
13511 | 13511 | | |||
13512 | if (w) *w = o->formatted.w; | 13512 | if (w) *w = o->formatted.w; | ||
13513 | if (h) *h = o->formatted.h; | 13513 | if (h) *h = o->formatted.h; | ||
13514 | } | 13514 | } | ||
▲ Show 20 Lines • Show All 135 Lines • ▼ Show 20 Line(s) | 13642 | loop_advance: | |||
13650 | /* rectify width of line using the last item */ | 13650 | /* rectify width of line using the last item */ | ||
13651 | if (last_it) | 13651 | if (last_it) | ||
13652 | *w += last_it->w - last_it->adv; | 13652 | *w += last_it->w - last_it->adv; | ||
13653 | } | 13653 | } | ||
13654 | 13654 | | |||
13655 | /* FIXME: doc */ | 13655 | /* FIXME: doc */ | ||
13656 | static void | 13656 | static void | ||
13657 | _size_native_calc_paragraph_size(const Evas_Object *eo_obj, | 13657 | _size_native_calc_paragraph_size(const Evas_Object *eo_obj, | ||
13658 | const Efl_Canvas_Text_Data *o, | 13658 | const Efl_Canvas_Text_Canvas_Data *o, | ||
13659 | Evas_Object_Textblock_Paragraph *par, | 13659 | Evas_Object_Textblock_Paragraph *par, | ||
13660 | Textblock_Position *position, | 13660 | Textblock_Position *position, | ||
13661 | Evas_Coord *_w, Evas_Coord *_h) | 13661 | Evas_Coord *_w, Evas_Coord *_h) | ||
13662 | { | 13662 | { | ||
13663 | Eina_List *i; | 13663 | Eina_List *i; | ||
13664 | Evas_Object_Textblock_Item *it; | 13664 | Evas_Object_Textblock_Item *it; | ||
13665 | Eina_List *line_items = NULL; | 13665 | Eina_List *line_items = NULL; | ||
13666 | Evas_Coord w = 0, y = 0, wmax = 0, h = 0, ascent = 0, descent = 0; | 13666 | Evas_Coord w = 0, y = 0, wmax = 0, h = 0, ascent = 0, descent = 0; | ||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | 13730 | #endif | |||
13741 | if (w > wmax) | 13741 | if (w > wmax) | ||
13742 | wmax = w; | 13742 | wmax = w; | ||
13743 | 13743 | | |||
13744 | *_h = y + h; | 13744 | *_h = y + h; | ||
13745 | *_w = wmax; | 13745 | *_w = wmax; | ||
13746 | } | 13746 | } | ||
13747 | 13747 | | |||
13748 | EOLIAN static void | 13748 | EOLIAN static void | ||
13749 | _efl_canvas_text_size_native_get(const Eo *eo_obj, Efl_Canvas_Text_Data *o, Evas_Coord *w, Evas_Coord *h) | 13749 | _efl_canvas_text_canvas_size_native_get(const Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o, Evas_Coord *w, Evas_Coord *h) | ||
13750 | { | 13750 | { | ||
13751 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 13751 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
13752 | evas_object_async_block(obj); | 13752 | evas_object_async_block(obj); | ||
13753 | if (!o->native.valid) | 13753 | if (!o->native.valid) | ||
13754 | { | 13754 | { | ||
13755 | Evas_Coord wmax = 0, hmax = 0; | 13755 | Evas_Coord wmax = 0, hmax = 0; | ||
13756 | Evas_Object_Textblock_Paragraph *par; | 13756 | Evas_Object_Textblock_Paragraph *par; | ||
13757 | Textblock_Position position = TEXTBLOCK_POSITION_START; | 13757 | Textblock_Position position = TEXTBLOCK_POSITION_START; | ||
Show All 17 Lines | |||||
13775 | o->content_changed = 0; | 13775 | o->content_changed = 0; | ||
13776 | o->format_changed = EINA_FALSE; | 13776 | o->format_changed = EINA_FALSE; | ||
13777 | } | 13777 | } | ||
13778 | if (w) *w = o->native.w; | 13778 | if (w) *w = o->native.w; | ||
13779 | if (h) *h = o->native.h; | 13779 | if (h) *h = o->native.h; | ||
13780 | } | 13780 | } | ||
13781 | 13781 | | |||
13782 | EOLIAN static void | 13782 | EOLIAN static void | ||
13783 | _efl_canvas_text_style_insets_get(const Eo *eo_obj, Efl_Canvas_Text_Data *o, Evas_Coord *l, Evas_Coord *r, Evas_Coord *t, Evas_Coord *b) | 13783 | _efl_canvas_text_canvas_style_insets_get(const Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o, Evas_Coord *l, Evas_Coord *r, Evas_Coord *t, Evas_Coord *b) | ||
13784 | { | 13784 | { | ||
13785 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 13785 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
13786 | evas_object_async_block(obj); | 13786 | evas_object_async_block(obj); | ||
13787 | _relayout_if_needed(eo_obj, o); | 13787 | _relayout_if_needed(eo_obj, o); | ||
13788 | 13788 | | |||
13789 | if (l) *l = o->style_pad.l; | 13789 | if (l) *l = o->style_pad.l; | ||
13790 | if (r) *r = o->style_pad.r; | 13790 | if (r) *r = o->style_pad.r; | ||
13791 | if (t) *t = o->style_pad.t; | 13791 | if (t) *t = o->style_pad.t; | ||
13792 | if (b) *b = o->style_pad.b; | 13792 | if (b) *b = o->style_pad.b; | ||
13793 | } | 13793 | } | ||
13794 | 13794 | | |||
13795 | EOLIAN static void | 13795 | EOLIAN static void | ||
13796 | _efl_canvas_text_efl_object_dbg_info_get(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Dbg_Info *root) | 13796 | _efl_canvas_text_canvas_efl_object_dbg_info_get(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Dbg_Info *root) | ||
13797 | { | 13797 | { | ||
13798 | efl_dbg_info_get(efl_super(eo_obj, MY_CLASS), root); | 13798 | efl_dbg_info_get(efl_super(eo_obj, MY_CLASS), root); | ||
13799 | if (!root) return; | 13799 | if (!root) return; | ||
13800 | Efl_Dbg_Info *group = EFL_DBG_INFO_LIST_APPEND(root, MY_CLASS_NAME); | 13800 | Efl_Dbg_Info *group = EFL_DBG_INFO_LIST_APPEND(root, MY_CLASS_NAME); | ||
13801 | Efl_Dbg_Info *node; | 13801 | Efl_Dbg_Info *node; | ||
13802 | 13802 | | |||
13803 | const char *style; | 13803 | const char *style; | ||
13804 | const char *text = NULL; | 13804 | const char *text = NULL; | ||
13805 | char shorttext[48]; | 13805 | char shorttext[48]; | ||
13806 | const Evas_Textblock_Style *ts = NULL; | 13806 | const Evas_Textblock_Style *ts = NULL; | ||
13807 | 13807 | | |||
13808 | ts = evas_object_textblock_style_get(eo_obj); | 13808 | ts = evas_object_textblock_style_get(eo_obj); | ||
13809 | style = evas_textblock_style_get(ts); | 13809 | style = evas_textblock_style_get(ts); | ||
13810 | text = evas_object_textblock_text_markup_get(eo_obj); | 13810 | text = evas_object_textblock_text_markup_get(eo_obj); | ||
13811 | strncpy(shorttext, text, 38); | 13811 | strncpy(shorttext, text, 38); | ||
13812 | if (shorttext[37]) | 13812 | if (shorttext[37]) | ||
13813 | strcpy(shorttext + 37, "\xe2\x80\xa6"); /* HORIZONTAL ELLIPSIS */ | 13813 | strcpy(shorttext + 37, "\xe2\x80\xa6"); /* HORIZONTAL ELLIPSIS */ | ||
13814 | 13814 | | |||
13815 | EFL_DBG_INFO_APPEND(group, "Style", EINA_VALUE_TYPE_STRING, style); | 13815 | EFL_DBG_INFO_APPEND(group, "Style", EINA_VALUE_TYPE_STRING, style); | ||
13816 | EFL_DBG_INFO_APPEND(group, "Text", EINA_VALUE_TYPE_STRING, shorttext); | 13816 | EFL_DBG_INFO_APPEND(group, "Text", EINA_VALUE_TYPE_STRING, shorttext); | ||
13817 | 13817 | | |||
13818 | { | 13818 | { | ||
13819 | int w, h; | 13819 | int w, h; | ||
13820 | efl_canvas_text_size_formatted_get(eo_obj, &w, &h); | 13820 | efl_canvas_text_canvas_size_formatted_get(eo_obj, &w, &h); | ||
13821 | node = EFL_DBG_INFO_LIST_APPEND(group, "Formatted size"); | 13821 | node = EFL_DBG_INFO_LIST_APPEND(group, "Formatted size"); | ||
13822 | EFL_DBG_INFO_APPEND(node, "w", EINA_VALUE_TYPE_INT, w); | 13822 | EFL_DBG_INFO_APPEND(node, "w", EINA_VALUE_TYPE_INT, w); | ||
13823 | EFL_DBG_INFO_APPEND(node, "h", EINA_VALUE_TYPE_INT, h); | 13823 | EFL_DBG_INFO_APPEND(node, "h", EINA_VALUE_TYPE_INT, h); | ||
13824 | } | 13824 | } | ||
13825 | 13825 | | |||
13826 | { | 13826 | { | ||
13827 | int w, h; | 13827 | int w, h; | ||
13828 | efl_canvas_text_size_native_get(eo_obj, &w, &h); | 13828 | efl_canvas_text_canvas_size_native_get(eo_obj, &w, &h); | ||
13829 | node = EFL_DBG_INFO_LIST_APPEND(group, "Native size"); | 13829 | node = EFL_DBG_INFO_LIST_APPEND(group, "Native size"); | ||
13830 | EFL_DBG_INFO_APPEND(node, "w", EINA_VALUE_TYPE_INT, w); | 13830 | EFL_DBG_INFO_APPEND(node, "w", EINA_VALUE_TYPE_INT, w); | ||
13831 | EFL_DBG_INFO_APPEND(node, "h", EINA_VALUE_TYPE_INT, h); | 13831 | EFL_DBG_INFO_APPEND(node, "h", EINA_VALUE_TYPE_INT, h); | ||
13832 | } | 13832 | } | ||
13833 | } | 13833 | } | ||
13834 | 13834 | | |||
13835 | /* all nice and private */ | 13835 | /* all nice and private */ | ||
13836 | static void | 13836 | static void | ||
13837 | evas_object_textblock_init(Evas_Object *eo_obj) | 13837 | evas_object_textblock_init(Evas_Object *eo_obj) | ||
13838 | { | 13838 | { | ||
13839 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 13839 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
13840 | Efl_Canvas_Text_Data *o; | 13840 | Efl_Canvas_Text_Canvas_Data *o; | ||
13841 | static Eina_Bool linebreak_init = EINA_FALSE; | 13841 | static Eina_Bool linebreak_init = EINA_FALSE; | ||
13842 | 13842 | | |||
13843 | if (!linebreak_init) | 13843 | if (!linebreak_init) | ||
13844 | { | 13844 | { | ||
13845 | linebreak_init = EINA_TRUE; | 13845 | linebreak_init = EINA_TRUE; | ||
13846 | init_linebreak(); | 13846 | init_linebreak(); | ||
13847 | init_wordbreak(); | 13847 | init_wordbreak(); | ||
13848 | init_graphemebreak(); | 13848 | init_graphemebreak(); | ||
13849 | } | 13849 | } | ||
13850 | 13850 | | |||
13851 | o = obj->private_data; | 13851 | o = obj->private_data; | ||
13852 | Efl_Text_Cursor_Cursor *co = o->cursor; | 13852 | Efl_Text_Cursor_Cursor *co = o->cursor; | ||
13853 | co->obj = eo_obj; | 13853 | co->obj = eo_obj; | ||
13854 | evas_object_textblock_text_markup_set(eo_obj, ""); | 13854 | evas_object_textblock_text_markup_set(eo_obj, ""); | ||
13855 | 13855 | | |||
13856 | o->multiline = EINA_FALSE; | 13856 | o->multiline = EINA_FALSE; | ||
13857 | #ifdef BIDI_SUPPORT | 13857 | #ifdef BIDI_SUPPORT | ||
13858 | o->inherit_paragraph_direction = EINA_TRUE; | 13858 | o->inherit_paragraph_direction = EINA_TRUE; | ||
13859 | #endif | 13859 | #endif | ||
13860 | } | 13860 | } | ||
13861 | 13861 | | |||
13862 | EOLIAN static void | 13862 | EOLIAN static void | ||
13863 | _efl_canvas_text_efl_object_destructor(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED) | 13863 | _efl_canvas_text_canvas_efl_object_destructor(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED) | ||
13864 | { | 13864 | { | ||
13865 | evas_object_textblock_free(eo_obj); | 13865 | evas_object_textblock_free(eo_obj); | ||
13866 | efl_destructor(efl_super(eo_obj, MY_CLASS)); | 13866 | efl_destructor(efl_super(eo_obj, MY_CLASS)); | ||
13867 | } | 13867 | } | ||
13868 | 13868 | | |||
13869 | static void | 13869 | static void | ||
13870 | evas_object_textblock_free(Evas_Object *eo_obj) | 13870 | evas_object_textblock_free(Evas_Object *eo_obj) | ||
13871 | { | 13871 | { | ||
13872 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 13872 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
13873 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 13873 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
13874 | Efl_Canvas_Text_Filter_Program *prg; | 13874 | Efl_Canvas_Text_Canvas_Filter_Program *prg; | ||
13875 | Evas_Filter_Data_Binding *db; | 13875 | Evas_Filter_Data_Binding *db; | ||
13876 | User_Style_Entry *use; | 13876 | User_Style_Entry *use; | ||
13877 | 13877 | | |||
13878 | _evas_object_textblock_clear(eo_obj); | 13878 | _evas_object_textblock_clear(eo_obj); | ||
13879 | evas_object_textblock_style_set(eo_obj, NULL); | 13879 | evas_object_textblock_style_set(eo_obj, NULL); | ||
13880 | 13880 | | |||
13881 | EINA_LIST_FREE(o->styles, use) | 13881 | EINA_LIST_FREE(o->styles, use) | ||
13882 | { | 13882 | { | ||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 13957 | { | |||
13985 | 13985 | | |||
13986 | // release run ref | 13986 | // release run ref | ||
13987 | evas_filter_context_unref(ctx); | 13987 | evas_filter_context_unref(ctx); | ||
13988 | } | 13988 | } | ||
13989 | 13989 | | |||
13990 | static void | 13990 | static void | ||
13991 | _filter_post_render_cb(void *data) | 13991 | _filter_post_render_cb(void *data) | ||
13992 | { | 13992 | { | ||
13993 | Efl_Canvas_Text_Filter_Post_Render *post_data = data; | 13993 | Efl_Canvas_Text_Canvas_Filter_Post_Render *post_data = data; | ||
13994 | 13994 | | |||
13995 | _filter_sync_end(post_data->ctx, post_data->success); | 13995 | _filter_sync_end(post_data->ctx, post_data->success); | ||
13996 | free(post_data); | 13996 | free(post_data); | ||
13997 | } | 13997 | } | ||
13998 | 13998 | | |||
13999 | static void | 13999 | static void | ||
14000 | _filter_cb(Evas_Filter_Context *ctx, void *data, Eina_Bool success) | 14000 | _filter_cb(Evas_Filter_Context *ctx, void *data, Eina_Bool success) | ||
14001 | { | 14001 | { | ||
14002 | Efl_Canvas_Text_Filter_Post_Render *post_data; | 14002 | Efl_Canvas_Text_Canvas_Filter_Post_Render *post_data; | ||
14003 | Evas_Public_Data *evas = data; | 14003 | Evas_Public_Data *evas = data; | ||
14004 | 14004 | | |||
14005 | if (!evas_filter_context_async_get(ctx)) | 14005 | if (!evas_filter_context_async_get(ctx)) | ||
14006 | { | 14006 | { | ||
14007 | _filter_sync_end(ctx, success); | 14007 | _filter_sync_end(ctx, success); | ||
14008 | return; | 14008 | return; | ||
14009 | } | 14009 | } | ||
14010 | 14010 | | |||
Show All 19 Lines | 14019 | { | |||
14030 | rect.x = x_offset - l; | 14030 | rect.x = x_offset - l; | ||
14031 | rect.y = y_offset - t; | 14031 | rect.y = y_offset - t; | ||
14032 | rect.w = tif->ti->parent.w; | 14032 | rect.w = tif->ti->parent.w; | ||
14033 | rect.h = tif->ti->parent.h + t + b; | 14033 | rect.h = tif->ti->parent.h + t + b; | ||
14034 | return rect; | 14034 | return rect; | ||
14035 | } | 14035 | } | ||
14036 | 14036 | | |||
14037 | static void | 14037 | static void | ||
14038 | _filter_output_cache_prune(Evas_Object_Protected_Data *obj, Efl_Canvas_Text_Data *o) | 14038 | _filter_output_cache_prune(Evas_Object_Protected_Data *obj, Efl_Canvas_Text_Canvas_Data *o) | ||
14039 | { | 14039 | { | ||
14040 | Text_Item_Filter *tif; | 14040 | Text_Item_Filter *tif; | ||
14041 | Eina_Inlist *il; | 14041 | Eina_Inlist *il; | ||
14042 | Eina_Rectangle obj_rect; | 14042 | Eina_Rectangle obj_rect; | ||
14043 | 14043 | | |||
14044 | // proxy surfaces contain the entire object, nothing to prune | 14044 | // proxy surfaces contain the entire object, nothing to prune | ||
14045 | if (obj->proxy->proxies) | 14045 | if (obj->proxy->proxies) | ||
14046 | return; | 14046 | return; | ||
Show All 26 Lines | 14053 | EINA_INLIST_FOREACH_SAFE(o->gfx_filter.text_items, il, tif) | |||
14073 | 14073 | | |||
14074 | } | 14074 | } | ||
14075 | } | 14075 | } | ||
14076 | 14076 | | |||
14077 | static inline Evas_Coord_Point | 14077 | static inline Evas_Coord_Point | ||
14078 | _filter_target_position_calc(Evas_Object_Protected_Data *obj, | 14078 | _filter_target_position_calc(Evas_Object_Protected_Data *obj, | ||
14079 | Evas_Object_Textblock_Text_Item *ti, int x, int y) | 14079 | Evas_Object_Textblock_Text_Item *ti, int x, int y) | ||
14080 | { | 14080 | { | ||
14081 | Efl_Canvas_Text_Filter *filter = ti->parent.format->gfx_filter; | 14081 | Efl_Canvas_Text_Canvas_Filter *filter = ti->parent.format->gfx_filter; | ||
14082 | Evas_Object_Textblock_Line *ln = ti->parent.ln; | 14082 | Evas_Object_Textblock_Line *ln = ti->parent.ln; | ||
14083 | Evas_Coord_Point pt; | 14083 | Evas_Coord_Point pt; | ||
14084 | 14084 | | |||
14085 | pt.x = obj->cur->geometry.x + ln->x + ti->parent.x + x - filter->pad.l; | 14085 | pt.x = obj->cur->geometry.x + ln->x + ti->parent.x + x - filter->pad.l; | ||
14086 | pt.y = obj->cur->geometry.y + ln->par->y + ln->y + y - filter->pad.t - ti->parent.h + ln->h; | 14086 | pt.y = obj->cur->geometry.y + ln->par->y + ln->y + y - filter->pad.t - ti->parent.h + ln->h; | ||
14087 | return pt; | 14087 | return pt; | ||
14088 | } | 14088 | } | ||
14089 | 14089 | | |||
14090 | static void | 14090 | static void | ||
14091 | evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED, | 14091 | evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED, | ||
14092 | Evas_Object_Protected_Data *obj, | 14092 | Evas_Object_Protected_Data *obj, | ||
14093 | void *type_private_data, | 14093 | void *type_private_data, | ||
14094 | void *engine, void *output, void *context, void *surface, | 14094 | void *engine, void *output, void *context, void *surface, | ||
14095 | int x, int y, Eina_Bool do_async) | 14095 | int x, int y, Eina_Bool do_async) | ||
14096 | { | 14096 | { | ||
14097 | Evas_Object_Textblock_Paragraph *par, *start = NULL; | 14097 | Evas_Object_Textblock_Paragraph *par, *start = NULL; | ||
14098 | Evas_Object_Textblock_Item *itr; | 14098 | Evas_Object_Textblock_Item *itr; | ||
14099 | Evas_Object_Textblock_Line *ln, *cur_ln = NULL; | 14099 | Evas_Object_Textblock_Line *ln, *cur_ln = NULL; | ||
14100 | Efl_Canvas_Text_Data *o = type_private_data; | 14100 | Efl_Canvas_Text_Canvas_Data *o = type_private_data; | ||
14101 | ASYNC_BLOCK; | 14101 | ASYNC_BLOCK; | ||
14102 | 14102 | | |||
14103 | Eina_List *shadows = NULL; | 14103 | Eina_List *shadows = NULL; | ||
14104 | Eina_List *glows = NULL; | 14104 | Eina_List *glows = NULL; | ||
14105 | Eina_List *outlines = NULL; | 14105 | Eina_List *outlines = NULL; | ||
14106 | Eina_List *gfx_filters = NULL; | 14106 | Eina_List *gfx_filters = NULL; | ||
14107 | void *context_save = context; | 14107 | void *context_save = context; | ||
14108 | int strikethrough_thickness, underline_thickness, underline_position; | 14108 | int strikethrough_thickness, underline_thickness, underline_position; | ||
▲ Show 20 Lines • Show All 288 Lines • ▼ Show 20 Line(s) | 14326 | #define DRAW_FORMAT(oname, oy, oh) \ | |||
14397 | /* There are size adjustments that depend on the styles drawn here back | 14397 | /* There are size adjustments that depend on the styles drawn here back | ||
14398 | * in "_text_item_update_sizes" should not modify one without the other. */ | 14398 | * in "_text_item_update_sizes" should not modify one without the other. */ | ||
14399 | 14399 | | |||
14400 | /* gfx filters preparation */ | 14400 | /* gfx filters preparation */ | ||
14401 | EINA_LIST_FREE(gfx_filters, itr) | 14401 | EINA_LIST_FREE(gfx_filters, itr) | ||
14402 | { | 14402 | { | ||
14403 | Efl_Canvas_Filter_State state = EFL_CANVAS_FILTER_STATE_DEFAULT; | 14403 | Efl_Canvas_Filter_State state = EFL_CANVAS_FILTER_STATE_DEFAULT; | ||
14404 | Evas_Object_Textblock_Text_Item *ti = _ITEM_TEXT(itr); | 14404 | Evas_Object_Textblock_Text_Item *ti = _ITEM_TEXT(itr); | ||
14405 | Efl_Canvas_Text_Filter *filter; | 14405 | Efl_Canvas_Text_Canvas_Filter *filter; | ||
14406 | Evas_Filter_Program *pgm; | 14406 | Evas_Filter_Program *pgm; | ||
14407 | Evas_Filter_Context *ctx; | 14407 | Evas_Filter_Context *ctx; | ||
14408 | Evas_Coord_Point target; | 14408 | Evas_Coord_Point target; | ||
14409 | Eina_Bool ok; | 14409 | Eina_Bool ok; | ||
14410 | 14410 | | |||
14411 | ln = ti->parent.ln; | 14411 | ln = ti->parent.ln; | ||
14412 | filter = ti->parent.format->gfx_filter; | 14412 | filter = ti->parent.format->gfx_filter; | ||
14413 | pgm = _format_filter_program_get(o, ti->parent.format); | 14413 | pgm = _format_filter_program_get(o, ti->parent.format); | ||
▲ Show 20 Lines • Show All 380 Lines • ▼ Show 20 Line(s) | 14705 | { | |||
14794 | DRAW_FORMAT(underline2, ln->baseline + underline_position + underline_thickness + | 14794 | DRAW_FORMAT(underline2, ln->baseline + underline_position + underline_thickness + | ||
14795 | underline_position, underline_thickness); | 14795 | underline_position, underline_thickness); | ||
14796 | } | 14796 | } | ||
14797 | ITEM_WALK_END(); | 14797 | ITEM_WALK_END(); | ||
14798 | ENFN->context_multiplier_unset(engine, context); | 14798 | ENFN->context_multiplier_unset(engine, context); | ||
14799 | } | 14799 | } | ||
14800 | 14800 | | |||
14801 | EOLIAN static void | 14801 | EOLIAN static void | ||
14802 | _efl_canvas_text_efl_canvas_filter_internal_filter_state_prepare( | 14802 | _efl_canvas_text_canvas_efl_canvas_filter_internal_filter_state_prepare( | ||
14803 | Eo *eo_obj, Efl_Canvas_Text_Data *pd EINA_UNUSED, Efl_Canvas_Filter_State *state, void *data) | 14803 | Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *pd EINA_UNUSED, Efl_Canvas_Filter_State *state, void *data) | ||
14804 | { | 14804 | { | ||
14805 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 14805 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
14806 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_TEXT_CLASS); | 14806 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_TEXT_CANVAS_CLASS); | ||
14807 | Evas_Object_Textblock_Text_Item *ti = data; | 14807 | Evas_Object_Textblock_Text_Item *ti = data; | ||
14808 | Efl_Canvas_Text_Filter_Program *program; | 14808 | Efl_Canvas_Text_Canvas_Filter_Program *program; | ||
14809 | Evas_Filter_Padding pad = {}; | 14809 | Evas_Filter_Padding pad = {}; | ||
14810 | 14810 | | |||
14811 | #define STATE_COLOR(dst, src) dst.r = src.r; dst.g = src.g; dst.b = src.b; dst.a = src.a | 14811 | #define STATE_COLOR(dst, src) dst.r = src.r; dst.g = src.g; dst.b = src.b; dst.a = src.a | ||
14812 | STATE_COLOR(state->color, ti->parent.format->color.normal); | 14812 | STATE_COLOR(state->color, ti->parent.format->color.normal); | ||
14813 | STATE_COLOR(state->text.glow, ti->parent.format->color.glow); | 14813 | STATE_COLOR(state->text.glow, ti->parent.format->color.glow); | ||
14814 | STATE_COLOR(state->text.glow2, ti->parent.format->color.glow2); | 14814 | STATE_COLOR(state->text.glow2, ti->parent.format->color.glow2); | ||
14815 | STATE_COLOR(state->text.shadow, ti->parent.format->color.shadow); | 14815 | STATE_COLOR(state->text.shadow, ti->parent.format->color.shadow); | ||
14816 | STATE_COLOR(state->text.outline, ti->parent.format->color.outline); | 14816 | STATE_COLOR(state->text.outline, ti->parent.format->color.outline); | ||
14817 | #undef STATE_COLOR | 14817 | #undef STATE_COLOR | ||
14818 | 14818 | | |||
14819 | program = _filter_program_find(o, ti->parent.format->gfx_filter->name); | 14819 | program = _filter_program_find(o, ti->parent.format->gfx_filter->name); | ||
14820 | if (program) evas_filter_program_padding_get(program->pgm, &pad, NULL); | 14820 | if (program) evas_filter_program_padding_get(program->pgm, &pad, NULL); | ||
14821 | state->w = ti->parent.w; // + l + r; (already included) | 14821 | state->w = ti->parent.w; // + l + r; (already included) | ||
14822 | state->h = ti->parent.h + pad.t + pad.b; | 14822 | state->h = ti->parent.h + pad.t + pad.b; | ||
14823 | state->scale = obj->cur->scale; | 14823 | state->scale = obj->cur->scale; | ||
14824 | } | 14824 | } | ||
14825 | 14825 | | |||
14826 | EOLIAN static Eina_Bool | 14826 | EOLIAN static Eina_Bool | ||
14827 | _efl_canvas_text_efl_canvas_filter_internal_filter_input_render( | 14827 | _efl_canvas_text_canvas_efl_canvas_filter_internal_filter_input_render( | ||
14828 | Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *pd EINA_UNUSED, void *filter, | 14828 | Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *pd EINA_UNUSED, void *filter, | ||
14829 | void *engine, void *output, void *drawctx, void *data, | 14829 | void *engine, void *output, void *drawctx, void *data, | ||
14830 | int l, int r EINA_UNUSED, int t, int b EINA_UNUSED, | 14830 | int l, int r EINA_UNUSED, int t, int b EINA_UNUSED, | ||
14831 | int x, int y, Eina_Bool do_async) | 14831 | int x, int y, Eina_Bool do_async) | ||
14832 | { | 14832 | { | ||
14833 | Evas_Object_Textblock_Text_Item *ti = data; | 14833 | Evas_Object_Textblock_Text_Item *ti = data; | ||
14834 | 14834 | | |||
14835 | return evas_filter_font_draw(filter, engine, output, drawctx, | 14835 | return evas_filter_font_draw(filter, engine, output, drawctx, | ||
14836 | EVAS_FILTER_BUFFER_INPUT_ID, | 14836 | EVAS_FILTER_BUFFER_INPUT_ID, | ||
14837 | ti->parent.format->font.font, | 14837 | ti->parent.format->font.font, | ||
14838 | x + l, | 14838 | x + l, | ||
14839 | y + t + ti->parent.yoff + ti->parent.h - ti->parent.ln->h, | 14839 | y + t + ti->parent.yoff + ti->parent.h - ti->parent.ln->h, | ||
14840 | &ti->text_props, do_async); | 14840 | &ti->text_props, do_async); | ||
14841 | } | 14841 | } | ||
14842 | 14842 | | |||
14843 | EOLIAN static void | 14843 | EOLIAN static void | ||
14844 | _efl_canvas_text_efl_canvas_filter_internal_filter_dirty( | 14844 | _efl_canvas_text_canvas_efl_canvas_filter_internal_filter_dirty( | ||
14845 | Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *pd EINA_UNUSED) | 14845 | Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *pd EINA_UNUSED) | ||
14846 | { | 14846 | { | ||
14847 | WRN("Filter marked as dirty. NOT IMPLEMENTED!"); | 14847 | WRN("Filter marked as dirty. NOT IMPLEMENTED!"); | ||
14848 | } | 14848 | } | ||
14849 | 14849 | | |||
14850 | EOLIAN static void | 14850 | EOLIAN static void | ||
14851 | _efl_canvas_text_efl_gfx_filter_filter_program_set(Eo *eo_obj, Efl_Canvas_Text_Data *pd, const char *code, const char *name) | 14851 | _efl_canvas_text_canvas_efl_gfx_filter_filter_program_set(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *pd, const char *code, const char *name) | ||
14852 | { | 14852 | { | ||
14853 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 14853 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
14854 | Efl_Canvas_Text_Filter_Program *prg; | 14854 | Efl_Canvas_Text_Canvas_Filter_Program *prg; | ||
14855 | 14855 | | |||
14856 | prg = _filter_program_find(pd, name); | 14856 | prg = _filter_program_find(pd, name); | ||
14857 | if (prg) | 14857 | if (prg) | ||
14858 | { | 14858 | { | ||
14859 | if (eina_streq(prg->code, code)) return; | 14859 | if (eina_streq(prg->code, code)) return; | ||
14860 | } | 14860 | } | ||
14861 | else | 14861 | else | ||
14862 | { | 14862 | { | ||
14863 | prg = calloc(1, sizeof(*prg)); | 14863 | prg = calloc(1, sizeof(*prg)); | ||
14864 | prg->name = eina_stringshare_add(name); | 14864 | prg->name = eina_stringshare_add(name); | ||
14865 | pd->gfx_filter.programs = (Efl_Canvas_Text_Filter_Program *) | 14865 | pd->gfx_filter.programs = (Efl_Canvas_Text_Canvas_Filter_Program *) | ||
14866 | eina_inlist_append(EINA_INLIST_GET(pd->gfx_filter.programs), EINA_INLIST_GET(prg)); | 14866 | eina_inlist_append(EINA_INLIST_GET(pd->gfx_filter.programs), EINA_INLIST_GET(prg)); | ||
14867 | } | 14867 | } | ||
14868 | eina_stringshare_replace(&prg->code, code); | 14868 | eina_stringshare_replace(&prg->code, code); | ||
14869 | prg->changed = EINA_TRUE; | 14869 | prg->changed = EINA_TRUE; | ||
14870 | 14870 | | |||
14871 | pd->format_changed = EINA_TRUE; | 14871 | pd->format_changed = EINA_TRUE; | ||
14872 | _evas_textblock_invalidate_all(pd); | 14872 | _evas_textblock_invalidate_all(pd); | ||
14873 | _evas_textblock_changed(pd, eo_obj); | 14873 | _evas_textblock_changed(pd, eo_obj); | ||
14874 | evas_object_change(eo_obj, obj); | 14874 | evas_object_change(eo_obj, obj); | ||
14875 | } | 14875 | } | ||
14876 | 14876 | | |||
14877 | EOLIAN static void | 14877 | EOLIAN static void | ||
14878 | _efl_canvas_text_efl_gfx_filter_filter_program_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *pd EINA_UNUSED, | 14878 | _efl_canvas_text_canvas_efl_gfx_filter_filter_program_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *pd EINA_UNUSED, | ||
14879 | const char **code EINA_UNUSED, const char **name EINA_UNUSED) | 14879 | const char **code EINA_UNUSED, const char **name EINA_UNUSED) | ||
14880 | { | 14880 | { | ||
14881 | // FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME | 14881 | // FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME | ||
14882 | ERR("Invalid API definition for this object! 'name' needs to be an @in or @inout value!"); | 14882 | ERR("Invalid API definition for this object! 'name' needs to be an @in or @inout value!"); | ||
14883 | } | 14883 | } | ||
14884 | 14884 | | |||
14885 | static Evas_Filter_Data_Binding * | 14885 | static Evas_Filter_Data_Binding * | ||
14886 | _filter_data_binding_find(Efl_Canvas_Text_Data *pd, const char *name) | 14886 | _filter_data_binding_find(Efl_Canvas_Text_Canvas_Data *pd, const char *name) | ||
14887 | { | 14887 | { | ||
14888 | Evas_Filter_Data_Binding *db; | 14888 | Evas_Filter_Data_Binding *db; | ||
14889 | 14889 | | |||
14890 | if (!name) return NULL; | 14890 | if (!name) return NULL; | ||
14891 | EINA_INLIST_FOREACH(pd->gfx_filter.data_bindings, db) | 14891 | EINA_INLIST_FOREACH(pd->gfx_filter.data_bindings, db) | ||
14892 | if (!strcmp(db->name, name)) | 14892 | if (!strcmp(db->name, name)) | ||
14893 | return db; | 14893 | return db; | ||
14894 | 14894 | | |||
14895 | return NULL; | 14895 | return NULL; | ||
14896 | } | 14896 | } | ||
14897 | 14897 | | |||
14898 | EOLIAN static void | 14898 | EOLIAN static void | ||
14899 | _efl_canvas_text_efl_gfx_filter_filter_data_set(Eo *obj, Efl_Canvas_Text_Data *pd, const char *name, const char *value, Eina_Bool execute) | 14899 | _efl_canvas_text_canvas_efl_gfx_filter_filter_data_set(Eo *obj, Efl_Canvas_Text_Canvas_Data *pd, const char *name, const char *value, Eina_Bool execute) | ||
14900 | { | 14900 | { | ||
14901 | Efl_Canvas_Text_Filter_Program *prg; | 14901 | Efl_Canvas_Text_Canvas_Filter_Program *prg; | ||
14902 | Evas_Filter_Data_Binding *db; | 14902 | Evas_Filter_Data_Binding *db; | ||
14903 | 14903 | | |||
14904 | if (!name) return; | 14904 | if (!name) return; | ||
14905 | db = _filter_data_binding_find(pd, name); | 14905 | db = _filter_data_binding_find(pd, name); | ||
14906 | if (db) | 14906 | if (db) | ||
14907 | { | 14907 | { | ||
14908 | if (eina_streq(db->value, value) && (db->execute == execute)) | 14908 | if (eina_streq(db->value, value) && (db->execute == execute)) | ||
14909 | return; | 14909 | return; | ||
Show All 29 Lines | |||||
14939 | 14939 | | |||
14940 | pd->format_changed = EINA_TRUE; | 14940 | pd->format_changed = EINA_TRUE; | ||
14941 | _evas_textblock_invalidate_all(pd); | 14941 | _evas_textblock_invalidate_all(pd); | ||
14942 | _evas_textblock_changed(pd, obj); | 14942 | _evas_textblock_changed(pd, obj); | ||
14943 | evas_object_change(obj, efl_data_scope_get(obj, EFL_CANVAS_OBJECT_CLASS)); | 14943 | evas_object_change(obj, efl_data_scope_get(obj, EFL_CANVAS_OBJECT_CLASS)); | ||
14944 | } | 14944 | } | ||
14945 | 14945 | | |||
14946 | EOLIAN static void | 14946 | EOLIAN static void | ||
14947 | _efl_canvas_text_efl_gfx_filter_filter_data_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *pd, const char *name, const char **value, Eina_Bool *execute) | 14947 | _efl_canvas_text_canvas_efl_gfx_filter_filter_data_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *pd, const char *name, const char **value, Eina_Bool *execute) | ||
14948 | { | 14948 | { | ||
14949 | Evas_Filter_Data_Binding *db; | 14949 | Evas_Filter_Data_Binding *db; | ||
14950 | 14950 | | |||
14951 | db = _filter_data_binding_find(pd, name); | 14951 | db = _filter_data_binding_find(pd, name); | ||
14952 | if (!db) | 14952 | if (!db) | ||
14953 | { | 14953 | { | ||
14954 | if (value) *value = NULL; | 14954 | if (value) *value = NULL; | ||
14955 | if (execute) *execute = EINA_FALSE; | 14955 | if (execute) *execute = EINA_FALSE; | ||
14956 | return; | 14956 | return; | ||
14957 | } | 14957 | } | ||
14958 | 14958 | | |||
14959 | if (value) *value = db->value; | 14959 | if (value) *value = db->value; | ||
14960 | if (execute) *execute = db->execute; | 14960 | if (execute) *execute = db->execute; | ||
14961 | } | 14961 | } | ||
14962 | 14962 | | |||
14963 | EOLIAN static void | 14963 | EOLIAN static void | ||
14964 | _efl_canvas_text_efl_gfx_filter_filter_source_set(Eo *eo_obj, Efl_Canvas_Text_Data *pd, const char *name, Efl_Gfx_Entity *eo_source) | 14964 | _efl_canvas_text_canvas_efl_gfx_filter_filter_source_set(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *pd, const char *name, Efl_Gfx_Entity *eo_source) | ||
14965 | { | 14965 | { | ||
14966 | Evas_Object_Protected_Data *obj, *source; | 14966 | Evas_Object_Protected_Data *obj, *source; | ||
14967 | Evas_Filter_Proxy_Binding *pb; | 14967 | Evas_Filter_Proxy_Binding *pb; | ||
14968 | 14968 | | |||
14969 | if (!name) return; | 14969 | if (!name) return; | ||
14970 | 14970 | | |||
14971 | obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 14971 | obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
14972 | source = efl_data_scope_get(eo_source, EFL_CANVAS_OBJECT_CLASS); | 14972 | source = efl_data_scope_get(eo_source, EFL_CANVAS_OBJECT_CLASS); | ||
Show All 37 Lines | |||||
15010 | 15010 | | |||
15011 | pd->format_changed = EINA_TRUE; | 15011 | pd->format_changed = EINA_TRUE; | ||
15012 | _evas_textblock_invalidate_all(pd); | 15012 | _evas_textblock_invalidate_all(pd); | ||
15013 | _evas_textblock_changed(pd, eo_obj); | 15013 | _evas_textblock_changed(pd, eo_obj); | ||
15014 | evas_object_change(eo_obj, obj); | 15014 | evas_object_change(eo_obj, obj); | ||
15015 | } | 15015 | } | ||
15016 | 15016 | | |||
15017 | EOLIAN static Efl_Gfx_Entity * | 15017 | EOLIAN static Efl_Gfx_Entity * | ||
15018 | _efl_canvas_text_efl_gfx_filter_filter_source_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *pd, const char *name) | 15018 | _efl_canvas_text_canvas_efl_gfx_filter_filter_source_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *pd, const char *name) | ||
15019 | { | 15019 | { | ||
15020 | return eina_hash_find(pd->gfx_filter.sources, name); | 15020 | return eina_hash_find(pd->gfx_filter.sources, name); | ||
15021 | } | 15021 | } | ||
15022 | 15022 | | |||
15023 | static void | 15023 | static void | ||
15024 | evas_object_textblock_coords_recalc(Evas_Object *eo_obj, | 15024 | evas_object_textblock_coords_recalc(Evas_Object *eo_obj, | ||
15025 | Evas_Object_Protected_Data *obj, | 15025 | Evas_Object_Protected_Data *obj, | ||
15026 | void *type_private_data) | 15026 | void *type_private_data) | ||
15027 | { | 15027 | { | ||
15028 | Efl_Canvas_Text_Data *o = type_private_data; | 15028 | Efl_Canvas_Text_Canvas_Data *o = type_private_data; | ||
15029 | 15029 | | |||
15030 | #ifdef BIDI_SUPPORT | 15030 | #ifdef BIDI_SUPPORT | ||
15031 | if (o->inherit_paragraph_direction) | 15031 | if (o->inherit_paragraph_direction) | ||
15032 | { | 15032 | { | ||
15033 | Evas_BiDi_Direction parent_dir = EVAS_BIDI_DIRECTION_NEUTRAL; | 15033 | Evas_BiDi_Direction parent_dir = EVAS_BIDI_DIRECTION_NEUTRAL; | ||
15034 | 15034 | | |||
15035 | if (obj->smart.parent) | 15035 | if (obj->smart.parent) | ||
15036 | { | 15036 | { | ||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 15048 | if ( | |||
15079 | } | 15079 | } | ||
15080 | } | 15080 | } | ||
15081 | 15081 | | |||
15082 | static void | 15082 | static void | ||
15083 | evas_object_textblock_render_pre(Evas_Object *eo_obj, | 15083 | evas_object_textblock_render_pre(Evas_Object *eo_obj, | ||
15084 | Evas_Object_Protected_Data *obj, | 15084 | Evas_Object_Protected_Data *obj, | ||
15085 | void *type_private_data) | 15085 | void *type_private_data) | ||
15086 | { | 15086 | { | ||
15087 | Efl_Canvas_Text_Data *o = type_private_data; | 15087 | Efl_Canvas_Text_Canvas_Data *o = type_private_data; | ||
15088 | ASYNC_BLOCK; | 15088 | ASYNC_BLOCK; | ||
15089 | 15089 | | |||
15090 | int is_v, was_v; | 15090 | int is_v, was_v; | ||
15091 | 15091 | | |||
15092 | /* dont pre-render the obj twice! */ | 15092 | /* dont pre-render the obj twice! */ | ||
15093 | if (obj->pre_render_done) return; | 15093 | if (obj->pre_render_done) return; | ||
15094 | obj->pre_render_done = EINA_TRUE; | 15094 | obj->pre_render_done = EINA_TRUE; | ||
15095 | 15095 | | |||
▲ Show 20 Lines • Show All 108 Lines • ▼ Show 20 Line(s) | 15203 | evas_object_render_pre_effect_updates(&obj->layer->evas->clip_changes, | |||
15204 | eo_obj, is_v, was_v); | 15204 | eo_obj, is_v, was_v); | ||
15205 | } | 15205 | } | ||
15206 | 15206 | | |||
15207 | static void | 15207 | static void | ||
15208 | evas_object_textblock_render_post(Evas_Object *eo_obj EINA_UNUSED, | 15208 | evas_object_textblock_render_post(Evas_Object *eo_obj EINA_UNUSED, | ||
15209 | Evas_Object_Protected_Data *obj, | 15209 | Evas_Object_Protected_Data *obj, | ||
15210 | void *type_private_data) | 15210 | void *type_private_data) | ||
15211 | { | 15211 | { | ||
15212 | Efl_Canvas_Text_Data *o = type_private_data; | 15212 | Efl_Canvas_Text_Canvas_Data *o = type_private_data; | ||
15213 | ASYNC_BLOCK; | 15213 | ASYNC_BLOCK; | ||
15214 | 15214 | | |||
15215 | /* this moves the current data to the previous state parts of the object */ | 15215 | /* this moves the current data to the previous state parts of the object */ | ||
15216 | /* in whatever way is safest for the object. also if we don't need object */ | 15216 | /* in whatever way is safest for the object. also if we don't need object */ | ||
15217 | /* data anymore we can free it if the object deems this is a good idea */ | 15217 | /* data anymore we can free it if the object deems this is a good idea */ | ||
15218 | /* o = (Efl_Canvas_Text_Data *)(obj->object_data); */ | 15218 | /* o = (Efl_Canvas_Text_Canvas_Data *)(obj->object_data); */ | ||
15219 | /* remove those pesky changes */ | 15219 | /* remove those pesky changes */ | ||
15220 | evas_object_clip_changes_clean(obj); | 15220 | evas_object_clip_changes_clean(obj); | ||
15221 | /* move cur to prev safely for object data */ | 15221 | /* move cur to prev safely for object data */ | ||
15222 | evas_object_cur_prev(obj); | 15222 | evas_object_cur_prev(obj); | ||
15223 | /* o->prev = o->cur; */ | 15223 | /* o->prev = o->cur; */ | ||
15224 | EINA_SAFETY_ON_NULL_RETURN(o); | 15224 | EINA_SAFETY_ON_NULL_RETURN(o); | ||
15225 | _filter_output_cache_prune(obj, o); | 15225 | _filter_output_cache_prune(obj, o); | ||
15226 | } | 15226 | } | ||
15227 | 15227 | | |||
15228 | static void *evas_object_textblock_engine_data_get(Evas_Object *eo_obj) | 15228 | static void *evas_object_textblock_engine_data_get(Evas_Object *eo_obj) | ||
15229 | { | 15229 | { | ||
15230 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 15230 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
15231 | if (!o) return NULL; | 15231 | if (!o) return NULL; | ||
15232 | return o->engine_data; | 15232 | return o->engine_data; | ||
15233 | } | 15233 | } | ||
15234 | 15234 | | |||
15235 | static int | 15235 | static int | ||
15236 | evas_object_textblock_is_opaque(Evas_Object *eo_obj EINA_UNUSED, | 15236 | evas_object_textblock_is_opaque(Evas_Object *eo_obj EINA_UNUSED, | ||
15237 | Evas_Object_Protected_Data *obj EINA_UNUSED, | 15237 | Evas_Object_Protected_Data *obj EINA_UNUSED, | ||
15238 | void *type_private_data EINA_UNUSED) | 15238 | void *type_private_data EINA_UNUSED) | ||
Show All 9 Lines | 15246 | evas_object_textblock_was_opaque(Evas_Object *eo_obj EINA_UNUSED, | |||
15248 | void *type_private_data EINA_UNUSED) | 15248 | void *type_private_data EINA_UNUSED) | ||
15249 | { | 15249 | { | ||
15250 | /* this returns 1 if the internal object data implies that the object was */ | 15250 | /* this returns 1 if the internal object data implies that the object was */ | ||
15251 | /* currently fully opaque over the entire gradient it occupies */ | 15251 | /* currently fully opaque over the entire gradient it occupies */ | ||
15252 | return 0; | 15252 | return 0; | ||
15253 | } | 15253 | } | ||
15254 | 15254 | | |||
15255 | EOLIAN static void | 15255 | EOLIAN static void | ||
15256 | _efl_canvas_text_efl_gfx_entity_scale_set(Evas_Object *eo_obj, | 15256 | _efl_canvas_text_canvas_efl_gfx_entity_scale_set(Evas_Object *eo_obj, | ||
15257 | Efl_Canvas_Text_Data *o, | 15257 | Efl_Canvas_Text_Canvas_Data *o, | ||
15258 | double scale) | 15258 | double scale) | ||
15259 | { | 15259 | { | ||
15260 | if (EINA_DBL_EQ(efl_gfx_entity_scale_get(eo_obj), scale)) return; | 15260 | if (EINA_DBL_EQ(efl_gfx_entity_scale_get(eo_obj), scale)) return; | ||
15261 | efl_gfx_entity_scale_set(efl_super(eo_obj, MY_CLASS), scale); | 15261 | efl_gfx_entity_scale_set(efl_super(eo_obj, MY_CLASS), scale); | ||
15262 | 15262 | | |||
15263 | _evas_textblock_invalidate_all(o); | 15263 | _evas_textblock_invalidate_all(o); | ||
15264 | _evas_textblock_changed(o, eo_obj); | 15264 | _evas_textblock_changed(o, eo_obj); | ||
15265 | o->last_w = -1; | 15265 | o->last_w = -1; | ||
15266 | o->last_h = -1; | 15266 | o->last_h = -1; | ||
15267 | } | 15267 | } | ||
15268 | 15268 | | |||
15269 | void | 15269 | void | ||
15270 | _evas_object_textblock_rehint(Evas_Object *eo_obj) | 15270 | _evas_object_textblock_rehint(Evas_Object *eo_obj) | ||
15271 | { | 15271 | { | ||
15272 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 15272 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
15273 | Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | 15273 | Efl_Canvas_Text_Canvas_Data *o = efl_data_scope_get(eo_obj, MY_CLASS); | ||
15274 | Evas_Object_Textblock_Paragraph *par; | 15274 | Evas_Object_Textblock_Paragraph *par; | ||
15275 | Evas_Object_Textblock_Line *ln; | 15275 | Evas_Object_Textblock_Line *ln; | ||
15276 | 15276 | | |||
15277 | EINA_INLIST_FOREACH(o->paragraphs, par) | 15277 | EINA_INLIST_FOREACH(o->paragraphs, par) | ||
15278 | { | 15278 | { | ||
15279 | EINA_INLIST_FOREACH(par->lines, ln) | 15279 | EINA_INLIST_FOREACH(par->lines, ln) | ||
15280 | { | 15280 | { | ||
15281 | Evas_Object_Textblock_Item *it; | 15281 | Evas_Object_Textblock_Item *it; | ||
Show All 12 Lines | 15283 | EINA_INLIST_FOREACH(ln->items, it) | |||
15294 | } | 15294 | } | ||
15295 | } | 15295 | } | ||
15296 | } | 15296 | } | ||
15297 | _evas_textblock_invalidate_all(o); | 15297 | _evas_textblock_invalidate_all(o); | ||
15298 | _evas_textblock_changed(o, eo_obj); | 15298 | _evas_textblock_changed(o, eo_obj); | ||
15299 | } | 15299 | } | ||
15300 | 15300 | | |||
15301 | EOLIAN static void | 15301 | EOLIAN static void | ||
15302 | _efl_canvas_text_efl_canvas_object_paragraph_direction_set(Eo *eo_obj, | 15302 | _efl_canvas_text_canvas_efl_canvas_object_paragraph_direction_set(Eo *eo_obj, | ||
15303 | Efl_Canvas_Text_Data *o, | 15303 | Efl_Canvas_Text_Canvas_Data *o, | ||
15304 | Efl_Text_Bidirectional_Type dir) | 15304 | Efl_Text_Bidirectional_Type dir) | ||
15305 | { | 15305 | { | ||
15306 | #ifdef BIDI_SUPPORT | 15306 | #ifdef BIDI_SUPPORT | ||
15307 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 15307 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
15308 | 15308 | | |||
15309 | if ((!(o->inherit_paragraph_direction) && (o->paragraph_direction == dir)) || | 15309 | if ((!(o->inherit_paragraph_direction) && (o->paragraph_direction == dir)) || | ||
15310 | (o->inherit_paragraph_direction && (dir == EVAS_BIDI_DIRECTION_INHERIT))) | 15310 | (o->inherit_paragraph_direction && (dir == EVAS_BIDI_DIRECTION_INHERIT))) | ||
15311 | return; | 15311 | return; | ||
Show All 25 Lines | |||||
15337 | #else | 15337 | #else | ||
15338 | (void) eo_obj; | 15338 | (void) eo_obj; | ||
15339 | (void) o; | 15339 | (void) o; | ||
15340 | (void) dir; | 15340 | (void) dir; | ||
15341 | #endif | 15341 | #endif | ||
15342 | } | 15342 | } | ||
15343 | 15343 | | |||
15344 | EOLIAN static Efl_Text_Bidirectional_Type | 15344 | EOLIAN static Efl_Text_Bidirectional_Type | ||
15345 | _efl_canvas_text_efl_canvas_object_paragraph_direction_get(const Eo *eo_obj EINA_UNUSED, | 15345 | _efl_canvas_text_canvas_efl_canvas_object_paragraph_direction_get(const Eo *eo_obj EINA_UNUSED, | ||
15346 | Efl_Canvas_Text_Data *o) | 15346 | Efl_Canvas_Text_Canvas_Data *o) | ||
15347 | { | 15347 | { | ||
15348 | return (Efl_Text_Bidirectional_Type)o->paragraph_direction; | 15348 | return (Efl_Text_Bidirectional_Type)o->paragraph_direction; | ||
15349 | } | 15349 | } | ||
15350 | 15350 | | |||
15351 | static int | 15351 | static int | ||
15352 | _prepend_text_run2(Efl_Text_Cursor_Cursor *cur, const char *s, const char *p) | 15352 | _prepend_text_run2(Efl_Text_Cursor_Cursor *cur, const char *s, const char *p) | ||
15353 | { | 15353 | { | ||
15354 | if ((s) && (p > s)) | 15354 | if ((s) && (p > s)) | ||
15355 | { | 15355 | { | ||
15356 | char *ts; | 15356 | char *ts; | ||
15357 | 15357 | | |||
15358 | ts = alloca(p - s + 1); | 15358 | ts = alloca(p - s + 1); | ||
15359 | strncpy(ts, s, p - s); | 15359 | strncpy(ts, s, p - s); | ||
15360 | ts[p - s] = 0; | 15360 | ts[p - s] = 0; | ||
15361 | return _evas_textblock_cursor_text_prepend(cur, ts); | 15361 | return _evas_textblock_cursor_text_prepend(cur, ts); | ||
15362 | } | 15362 | } | ||
15363 | return 0; | 15363 | return 0; | ||
15364 | } | 15364 | } | ||
15365 | 15365 | | |||
15366 | static int | 15366 | static int | ||
15367 | _efl_canvas_text_cursor_text_append(Efl_Text_Cursor_Cursor *cur, | 15367 | _efl_canvas_text_canvas_cursor_text_append(Efl_Text_Cursor_Cursor *cur, | ||
15368 | const char *text) | 15368 | const char *text) | ||
15369 | { | 15369 | { | ||
15370 | if (!text) return 0; | 15370 | if (!text) return 0; | ||
15371 | 15371 | | |||
15372 | const char *off = text; | 15372 | const char *off = text; | ||
15373 | int len = 0; | 15373 | int len = 0; | ||
15374 | 15374 | | |||
15375 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | 15375 | Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); | ||
Show All 31 Lines | 15399 | if (format) | |||
15407 | } | 15407 | } | ||
15408 | off += n; | 15408 | off += n; | ||
15409 | } | 15409 | } | ||
15410 | len += _prepend_text_run2(cur, text, off); | 15410 | len += _prepend_text_run2(cur, text, off); | ||
15411 | return len; | 15411 | return len; | ||
15412 | } | 15412 | } | ||
15413 | 15413 | | |||
15414 | EOLIAN static void | 15414 | EOLIAN static void | ||
15415 | _efl_canvas_text_efl_text_text_set(Eo *eo_obj, Efl_Canvas_Text_Data *o, | 15415 | _efl_canvas_text_canvas_efl_text_text_set(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o, | ||
15416 | const char *text) | 15416 | const char *text) | ||
15417 | { | 15417 | { | ||
15418 | ASYNC_BLOCK; | 15418 | ASYNC_BLOCK; | ||
15419 | evas_object_textblock_text_markup_set(eo_obj, ""); | 15419 | evas_object_textblock_text_markup_set(eo_obj, ""); | ||
15420 | efl_text_cursor_text_insert(eo_obj, o->cursor, text); | 15420 | efl_text_cursor_text_insert(eo_obj, o->cursor, text); | ||
15421 | //efl_event_callback_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CHANGED, NULL); | 15421 | //efl_event_callback_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CHANGED, NULL); | ||
15422 | } | 15422 | } | ||
15423 | 15423 | | |||
15424 | static char * | 15424 | static char * | ||
15425 | _canvas_text_get_all(const Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED) | 15425 | _canvas_text_get_all(const Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED) | ||
15426 | { | 15426 | { | ||
15427 | Efl_Text_Cursor_Cursor start, end; | 15427 | Efl_Text_Cursor_Cursor start, end; | ||
15428 | 15428 | | |||
15429 | _evas_textblock_cursor_init(&start, eo_obj); | 15429 | _evas_textblock_cursor_init(&start, eo_obj); | ||
15430 | _evas_textblock_cursor_init(&end, eo_obj); | 15430 | _evas_textblock_cursor_init(&end, eo_obj); | ||
15431 | 15431 | | |||
15432 | evas_textblock_cursor_paragraph_first(&start); | 15432 | evas_textblock_cursor_paragraph_first(&start); | ||
15433 | evas_textblock_cursor_paragraph_last(&end); | 15433 | evas_textblock_cursor_paragraph_last(&end); | ||
15434 | 15434 | | |||
15435 | return _evas_textblock_cursor_range_text_get(&start, &end, EVAS_TEXTBLOCK_TEXT_PLAIN); | 15435 | return _evas_textblock_cursor_range_text_get(&start, &end, EVAS_TEXTBLOCK_TEXT_PLAIN); | ||
15436 | } | 15436 | } | ||
15437 | 15437 | | |||
15438 | EOLIAN static const char * | 15438 | EOLIAN static const char * | ||
15439 | _efl_canvas_text_efl_text_text_get(const Eo *eo_obj, Efl_Canvas_Text_Data *o) | 15439 | _efl_canvas_text_canvas_efl_text_text_get(const Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o) | ||
15440 | { | 15440 | { | ||
15441 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 15441 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
15442 | evas_object_async_block(obj); | 15442 | evas_object_async_block(obj); | ||
15443 | 15443 | | |||
15444 | free(o->utf8); | 15444 | free(o->utf8); | ||
15445 | o->utf8 = _canvas_text_get_all(eo_obj, o); | 15445 | o->utf8 = _canvas_text_get_all(eo_obj, o); | ||
15446 | return o->utf8; | 15446 | return o->utf8; | ||
15447 | } | 15447 | } | ||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Line(s) | 15514 | _textblock_cursor_pos_at_fnode_set(const Eo *eo_obj EINA_UNUSED, | |||
15515 | Efl_Text_Cursor_Cursor *cur, | 15515 | Efl_Text_Cursor_Cursor *cur, | ||
15516 | Evas_Object_Textblock_Node_Format *fnode) | 15516 | Evas_Object_Textblock_Node_Format *fnode) | ||
15517 | { | 15517 | { | ||
15518 | cur->node = fnode->text_node; | 15518 | cur->node = fnode->text_node; | ||
15519 | cur->pos = _evas_textblock_node_format_pos_get(fnode); | 15519 | cur->pos = _evas_textblock_node_format_pos_get(fnode); | ||
15520 | } | 15520 | } | ||
15521 | 15521 | | |||
15522 | static Eina_Bool | 15522 | static Eina_Bool | ||
15523 | _textblock_annotation_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o, | 15523 | _textblock_annotation_set(Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o, | ||
15524 | Efl_Text_Annotate_Annotation *an, | 15524 | Efl_Text_Annotate_Annotation *an, | ||
15525 | Efl_Text_Cursor_Cursor *start, Efl_Text_Cursor_Cursor *end, | 15525 | Efl_Text_Cursor_Cursor *start, Efl_Text_Cursor_Cursor *end, | ||
15526 | const char *format, Eina_Bool is_item) | 15526 | const char *format, Eina_Bool is_item) | ||
15527 | { | 15527 | { | ||
15528 | int len; | 15528 | int len; | ||
15529 | char *buf; | 15529 | char *buf; | ||
15530 | Evas_Textblock_Node_Format *fnode; | 15530 | Evas_Textblock_Node_Format *fnode; | ||
15531 | 15531 | | |||
Show All 23 Lines | |||||
15555 | an->end_node = fnode; | 15555 | an->end_node = fnode; | ||
15556 | fnode->annotation = an; | 15556 | fnode->annotation = an; | ||
15557 | 15557 | | |||
15558 | o->format_changed = EINA_TRUE; | 15558 | o->format_changed = EINA_TRUE; | ||
15559 | return EINA_TRUE; | 15559 | return EINA_TRUE; | ||
15560 | } | 15560 | } | ||
15561 | 15561 | | |||
15562 | EOLIAN static const char * | 15562 | EOLIAN static const char * | ||
15563 | _efl_canvas_text_efl_text_annotate_annotation_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, | 15563 | _efl_canvas_text_canvas_efl_text_annotate_annotation_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, | ||
15564 | Efl_Text_Annotate_Annotation *annotation) | 15564 | Efl_Text_Annotate_Annotation *annotation) | ||
15565 | { | 15565 | { | ||
15566 | if (!annotation || (annotation->obj != eo_obj)) | 15566 | if (!annotation || (annotation->obj != eo_obj)) | ||
15567 | { | 15567 | { | ||
15568 | ERR("Used invalid handle or of a different object"); | 15568 | ERR("Used invalid handle or of a different object"); | ||
15569 | return NULL; | 15569 | return NULL; | ||
15570 | } | 15570 | } | ||
15571 | 15571 | | |||
15572 | return (annotation->start_node ? annotation->start_node->format : NULL); | 15572 | return (annotation->start_node ? annotation->start_node->format : NULL); | ||
15573 | } | 15573 | } | ||
15574 | 15574 | | |||
15575 | EOLIAN static Eina_Bool | 15575 | EOLIAN static Eina_Bool | ||
15576 | _efl_canvas_text_efl_text_annotate_annotation_set(Eo *eo_obj, | 15576 | _efl_canvas_text_canvas_efl_text_annotate_annotation_set(Eo *eo_obj, | ||
15577 | Efl_Canvas_Text_Data *o, Efl_Text_Annotate_Annotation *annotation, | 15577 | Efl_Canvas_Text_Canvas_Data *o, Efl_Text_Annotate_Annotation *annotation, | ||
15578 | const char *format) | 15578 | const char *format) | ||
15579 | { | 15579 | { | ||
15580 | ASYNC_BLOCK; | 15580 | ASYNC_BLOCK; | ||
15581 | Efl_Text_Cursor_Cursor start, end; | 15581 | Efl_Text_Cursor_Cursor start, end; | ||
15582 | Eina_Bool ret = EINA_TRUE; | 15582 | Eina_Bool ret = EINA_TRUE; | ||
15583 | 15583 | | |||
15584 | if (!annotation || (annotation->obj != eo_obj)) | 15584 | if (!annotation || (annotation->obj != eo_obj)) | ||
15585 | { | 15585 | { | ||
Show All 19 Lines | 15603 | if (!_textblock_annotation_set(eo_obj, o, annotation, &start, &end, format, | |||
15605 | { | 15605 | { | ||
15606 | ret = EINA_FALSE; | 15606 | ret = EINA_FALSE; | ||
15607 | } | 15607 | } | ||
15608 | 15608 | | |||
15609 | return ret; | 15609 | return ret; | ||
15610 | } | 15610 | } | ||
15611 | 15611 | | |||
15612 | static void | 15612 | static void | ||
15613 | _evas_textblock_annotation_remove(Efl_Canvas_Text_Data *o, | 15613 | _evas_textblock_annotation_remove(Efl_Canvas_Text_Canvas_Data *o, | ||
15614 | Efl_Text_Annotate_Annotation *an, Eina_Bool remove_nodes) | 15614 | Efl_Text_Annotate_Annotation *an, Eina_Bool remove_nodes) | ||
15615 | { | 15615 | { | ||
15616 | if (remove_nodes) | 15616 | if (remove_nodes) | ||
15617 | { | 15617 | { | ||
15618 | if (an->is_item) | 15618 | if (an->is_item) | ||
15619 | { | 15619 | { | ||
15620 | /* Remove the OBJ character along with the cursor. */ | 15620 | /* Remove the OBJ character along with the cursor. */ | ||
15621 | Efl_Text_Cursor_Cursor cur; | 15621 | Efl_Text_Cursor_Cursor cur; | ||
15622 | _evas_textblock_cursor_init(&cur, an->obj); | 15622 | _evas_textblock_cursor_init(&cur, an->obj); | ||
15623 | _textblock_cursor_pos_at_fnode_set(an->obj, &cur, an->start_node); | 15623 | _textblock_cursor_pos_at_fnode_set(an->obj, &cur, an->start_node); | ||
15624 | evas_textblock_cursor_char_delete(&cur); | 15624 | evas_textblock_cursor_char_delete(&cur); | ||
15625 | return; // 'an' should be deleted after char deletion. | 15625 | return; // 'an' should be deleted after char deletion. | ||
15626 | } | 15626 | } | ||
15627 | _evas_textblock_node_format_remove(o, an->start_node, 0); | 15627 | _evas_textblock_node_format_remove(o, an->start_node, 0); | ||
15628 | _evas_textblock_node_format_remove(o, an->end_node, 0); | 15628 | _evas_textblock_node_format_remove(o, an->end_node, 0); | ||
15629 | } | 15629 | } | ||
15630 | o->annotations = (Efl_Text_Annotate_Annotation *) | 15630 | o->annotations = (Efl_Text_Annotate_Annotation *) | ||
15631 | eina_inlist_remove(EINA_INLIST_GET(o->annotations), | 15631 | eina_inlist_remove(EINA_INLIST_GET(o->annotations), | ||
15632 | EINA_INLIST_GET(an)); | 15632 | EINA_INLIST_GET(an)); | ||
15633 | free(an); | 15633 | free(an); | ||
15634 | } | 15634 | } | ||
15635 | 15635 | | |||
15636 | static void | 15636 | static void | ||
15637 | _evas_textblock_annotations_clear(Efl_Canvas_Text_Data *o) | 15637 | _evas_textblock_annotations_clear(Efl_Canvas_Text_Canvas_Data *o) | ||
15638 | { | 15638 | { | ||
15639 | Efl_Text_Annotate_Annotation *an; | 15639 | Efl_Text_Annotate_Annotation *an; | ||
15640 | 15640 | | |||
15641 | EINA_INLIST_FREE(o->annotations, an) | 15641 | EINA_INLIST_FREE(o->annotations, an) | ||
15642 | { | 15642 | { | ||
15643 | _evas_textblock_annotation_remove(o, an, EINA_TRUE); | 15643 | _evas_textblock_annotation_remove(o, an, EINA_TRUE); | ||
15644 | } | 15644 | } | ||
15645 | } | 15645 | } | ||
15646 | 15646 | | |||
15647 | EOLIAN static Eina_Bool | 15647 | EOLIAN static Eina_Bool | ||
15648 | _efl_canvas_text_efl_text_annotate_annotation_del(Eo *eo_obj EINA_UNUSED, | 15648 | _efl_canvas_text_canvas_efl_text_annotate_annotation_del(Eo *eo_obj EINA_UNUSED, | ||
15649 | Efl_Canvas_Text_Data *o, Efl_Text_Annotate_Annotation *annotation) | 15649 | Efl_Canvas_Text_Canvas_Data *o, Efl_Text_Annotate_Annotation *annotation) | ||
15650 | { | 15650 | { | ||
15651 | ASYNC_BLOCK; | 15651 | ASYNC_BLOCK; | ||
15652 | if (!annotation || (annotation->obj != eo_obj)) | 15652 | if (!annotation || (annotation->obj != eo_obj)) | ||
15653 | { | 15653 | { | ||
15654 | ERR("Used invalid handle or of a different object"); | 15654 | ERR("Used invalid handle or of a different object"); | ||
15655 | return EINA_FALSE; | 15655 | return EINA_FALSE; | ||
15656 | } | 15656 | } | ||
15657 | 15657 | | |||
15658 | _evas_textblock_annotation_remove(o, annotation, EINA_TRUE); | 15658 | _evas_textblock_annotation_remove(o, annotation, EINA_TRUE); | ||
15659 | o->format_changed = EINA_TRUE; | 15659 | o->format_changed = EINA_TRUE; | ||
15660 | 15660 | | |||
15661 | //XXX: It's a workaround. The underlying problem is that only new format | 15661 | //XXX: It's a workaround. The underlying problem is that only new format | ||
15662 | // nodes are checks when their respective text nodes are invalidated (see | 15662 | // nodes are checks when their respective text nodes are invalidated (see | ||
15663 | // _format_changes_invalidate_text_nodes). Complete removal of the format | 15663 | // _format_changes_invalidate_text_nodes). Complete removal of the format | ||
15664 | // nodes was not handled properly (as formats could only be removed via | 15664 | // nodes was not handled properly (as formats could only be removed via | ||
15665 | // text changes e.g. deleting characters). | 15665 | // text changes e.g. deleting characters). | ||
15666 | _evas_textblock_invalidate_all(o); | 15666 | _evas_textblock_invalidate_all(o); | ||
15667 | 15667 | | |||
15668 | _evas_textblock_changed(o, eo_obj); | 15668 | _evas_textblock_changed(o, eo_obj); | ||
15669 | return EINA_TRUE; | 15669 | return EINA_TRUE; | ||
15670 | } | 15670 | } | ||
15671 | 15671 | | |||
15672 | static Efl_Text_Annotate_Annotation * | 15672 | static Efl_Text_Annotate_Annotation * | ||
15673 | _textblock_annotation_insert(Eo *eo_obj, Efl_Canvas_Text_Data *o, | 15673 | _textblock_annotation_insert(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o, | ||
15674 | Efl_Text_Cursor_Cursor *start, Efl_Text_Cursor_Cursor *end, | 15674 | Efl_Text_Cursor_Cursor *start, Efl_Text_Cursor_Cursor *end, | ||
15675 | const char *format, Eina_Bool is_item) | 15675 | const char *format, Eina_Bool is_item) | ||
15676 | { | 15676 | { | ||
15677 | Efl_Text_Annotate_Annotation *ret = NULL; | 15677 | Efl_Text_Annotate_Annotation *ret = NULL; | ||
15678 | Eina_Strbuf *buf; | 15678 | Eina_Strbuf *buf; | ||
15679 | Eina_Bool first = EINA_TRUE; | 15679 | Eina_Bool first = EINA_TRUE; | ||
15680 | const char *item; | 15680 | const char *item; | ||
15681 | 15681 | | |||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 15717 | if (format && (format[0] != '\0')) | |||
15730 | } | 15730 | } | ||
15731 | 15731 | | |||
15732 | eina_strbuf_free(buf); | 15732 | eina_strbuf_free(buf); | ||
15733 | 15733 | | |||
15734 | return ret; | 15734 | return ret; | ||
15735 | } | 15735 | } | ||
15736 | 15736 | | |||
15737 | EOLIAN static Efl_Text_Annotate_Annotation * | 15737 | EOLIAN static Efl_Text_Annotate_Annotation * | ||
15738 | _efl_canvas_text_efl_text_annotate_annotation_insert(Eo *eo_obj, Efl_Canvas_Text_Data *o, | 15738 | _efl_canvas_text_canvas_efl_text_annotate_annotation_insert(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o, | ||
15739 | Efl_Text_Cursor_Cursor *start, Efl_Text_Cursor_Cursor *end, | 15739 | Efl_Text_Cursor_Cursor *start, Efl_Text_Cursor_Cursor *end, | ||
15740 | const char *format) | 15740 | const char *format) | ||
15741 | { | 15741 | { | ||
15742 | ASYNC_BLOCK; | 15742 | ASYNC_BLOCK; | ||
15743 | Efl_Text_Annotate_Annotation *ret; | 15743 | Efl_Text_Annotate_Annotation *ret; | ||
15744 | 15744 | | |||
15745 | ret = _textblock_annotation_insert(eo_obj, o, start, end, format, | 15745 | ret = _textblock_annotation_insert(eo_obj, o, start, end, format, | ||
15746 | EINA_FALSE); | 15746 | EINA_FALSE); | ||
15747 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CHANGED, NULL); | 15747 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CHANGED, NULL); | ||
15748 | return ret; | 15748 | return ret; | ||
15749 | } | 15749 | } | ||
15750 | 15750 | | |||
15751 | EOLIAN static Eina_Iterator * | 15751 | EOLIAN static Eina_Iterator * | ||
15752 | _efl_canvas_text_efl_text_annotate_range_annotations_get(const Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, | 15752 | _efl_canvas_text_canvas_efl_text_annotate_range_annotations_get(const Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, | ||
15753 | const Evas_Textblock_Cursor *start, const Evas_Textblock_Cursor *end) | 15753 | const Evas_Textblock_Cursor *start, const Evas_Textblock_Cursor *end) | ||
15754 | { | 15754 | { | ||
15755 | Eina_List *lst = NULL; | 15755 | Eina_List *lst = NULL; | ||
15756 | Efl_Text_Annotate_Annotation *it; | 15756 | Efl_Text_Annotate_Annotation *it; | ||
15757 | 15757 | | |||
15758 | EINA_INLIST_FOREACH(o->annotations, it) | 15758 | EINA_INLIST_FOREACH(o->annotations, it) | ||
15759 | { | 15759 | { | ||
15760 | Efl_Text_Cursor_Cursor start2, end2; | 15760 | Efl_Text_Cursor_Cursor start2, end2; | ||
Show All 9 Lines | 15768 | if (!((evas_textblock_cursor_compare(&start2, end) > 0) || | |||
15770 | { | 15770 | { | ||
15771 | lst = eina_list_append(lst, it); | 15771 | lst = eina_list_append(lst, it); | ||
15772 | } | 15772 | } | ||
15773 | } | 15773 | } | ||
15774 | return _evas_textblock_annotation_iterator_new(lst); | 15774 | return _evas_textblock_annotation_iterator_new(lst); | ||
15775 | } | 15775 | } | ||
15776 | 15776 | | |||
15777 | EOLIAN static Efl_Text_Annotate_Annotation * | 15777 | EOLIAN static Efl_Text_Annotate_Annotation * | ||
15778 | _efl_canvas_text_efl_text_annotate_cursor_item_insert(Eo *eo_obj, | 15778 | _efl_canvas_text_canvas_efl_text_annotate_cursor_item_insert(Eo *eo_obj, | ||
15779 | Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur, | 15779 | Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur, | ||
15780 | const char *item, const char *format) | 15780 | const char *item, const char *format) | ||
15781 | { | 15781 | { | ||
15782 | Eina_Strbuf *buf = eina_strbuf_new(); | 15782 | Eina_Strbuf *buf = eina_strbuf_new(); | ||
15783 | 15783 | | |||
15784 | eina_strbuf_append_printf(buf, "%s href=%s", format, item); | 15784 | eina_strbuf_append_printf(buf, "%s href=%s", format, item); | ||
15785 | 15785 | | |||
15786 | Efl_Text_Annotate_Annotation *ret = | 15786 | Efl_Text_Annotate_Annotation *ret = | ||
15787 | _textblock_annotation_insert(cur->obj, o, cur, cur, | 15787 | _textblock_annotation_insert(cur->obj, o, cur, cur, | ||
15788 | eina_strbuf_string_get(buf), EINA_TRUE); | 15788 | eina_strbuf_string_get(buf), EINA_TRUE); | ||
15789 | eina_strbuf_free(buf); | 15789 | eina_strbuf_free(buf); | ||
15790 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CHANGED, NULL); | 15790 | efl_event_callback_legacy_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CHANGED, NULL); | ||
15791 | return ret; | 15791 | return ret; | ||
15792 | } | 15792 | } | ||
15793 | 15793 | | |||
15794 | EOLIAN static Efl_Text_Annotate_Annotation * | 15794 | EOLIAN static Efl_Text_Annotate_Annotation * | ||
15795 | _efl_canvas_text_efl_text_annotate_cursor_item_annotation_get(const Eo *eo_obj EINA_UNUSED, | 15795 | _efl_canvas_text_canvas_efl_text_annotate_cursor_item_annotation_get(const Eo *eo_obj EINA_UNUSED, | ||
15796 | Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | 15796 | Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *cur) | ||
15797 | { | 15797 | { | ||
15798 | Eina_Iterator *it; | 15798 | Eina_Iterator *it; | ||
15799 | Efl_Text_Annotate_Annotation *data, *ret = NULL; | 15799 | Efl_Text_Annotate_Annotation *data, *ret = NULL; | ||
15800 | 15800 | | |||
15801 | it = efl_text_range_annotations_get(cur->obj, | 15801 | it = efl_text_range_annotations_get(cur->obj, | ||
15802 | cur, cur); | 15802 | cur, cur); | ||
15803 | EINA_ITERATOR_FOREACH(it, data) | 15803 | EINA_ITERATOR_FOREACH(it, data) | ||
15804 | { | 15804 | { | ||
15805 | if (data->is_item) | 15805 | if (data->is_item) | ||
15806 | { | 15806 | { | ||
15807 | ret = data; | 15807 | ret = data; | ||
15808 | break; | 15808 | break; | ||
15809 | } | 15809 | } | ||
15810 | } | 15810 | } | ||
15811 | eina_iterator_free(it); | 15811 | eina_iterator_free(it); | ||
15812 | return ret; | 15812 | return ret; | ||
15813 | } | 15813 | } | ||
15814 | 15814 | | |||
15815 | EOLIAN static Eina_Bool | 15815 | EOLIAN static Eina_Bool | ||
15816 | _efl_canvas_text_efl_text_annotate_annotation_is_item(Eo *eo_obj EINA_UNUSED, | 15816 | _efl_canvas_text_canvas_efl_text_annotate_annotation_is_item(Eo *eo_obj EINA_UNUSED, | ||
15817 | Efl_Canvas_Text_Data *o EINA_UNUSED, | 15817 | Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, | ||
15818 | Efl_Text_Annotate_Annotation *annotation) | 15818 | Efl_Text_Annotate_Annotation *annotation) | ||
15819 | { | 15819 | { | ||
15820 | if (!annotation || (annotation->obj != eo_obj)) | 15820 | if (!annotation || (annotation->obj != eo_obj)) | ||
15821 | { | 15821 | { | ||
15822 | ERR("Used invalid handle or of a different object"); | 15822 | ERR("Used invalid handle or of a different object"); | ||
15823 | return EINA_FALSE; | 15823 | return EINA_FALSE; | ||
15824 | } | 15824 | } | ||
15825 | 15825 | | |||
15826 | return annotation->is_item; | 15826 | return annotation->is_item; | ||
15827 | } | 15827 | } | ||
15828 | 15828 | | |||
15829 | EOLIAN static Eina_Bool | 15829 | EOLIAN static Eina_Bool | ||
15830 | _efl_canvas_text_efl_text_annotate_item_geometry_get(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, | 15830 | _efl_canvas_text_canvas_efl_text_annotate_item_geometry_get(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, | ||
15831 | const Efl_Text_Annotate_Annotation *an, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) | 15831 | const Efl_Text_Annotate_Annotation *an, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) | ||
15832 | { | 15832 | { | ||
15833 | Efl_Text_Cursor_Cursor cur; | 15833 | Efl_Text_Cursor_Cursor cur; | ||
15834 | 15834 | | |||
15835 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | 15835 | Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); | ||
15836 | evas_object_async_block(obj); | 15836 | evas_object_async_block(obj); | ||
15837 | _relayout_if_needed(eo_obj, o); | 15837 | _relayout_if_needed(eo_obj, o); | ||
15838 | 15838 | | |||
15839 | _evas_textblock_cursor_init(&cur, eo_obj); | 15839 | _evas_textblock_cursor_init(&cur, eo_obj); | ||
15840 | _textblock_cursor_pos_at_fnode_set(eo_obj, &cur, an->start_node); | 15840 | _textblock_cursor_pos_at_fnode_set(eo_obj, &cur, an->start_node); | ||
15841 | return _evas_textblock_cursor_format_item_geometry_get(&cur, cx, cy, cw, ch); | 15841 | return _evas_textblock_cursor_format_item_geometry_get(&cur, cx, cy, cw, ch); | ||
15842 | } | 15842 | } | ||
15843 | 15843 | | |||
15844 | EOLIAN static void | 15844 | EOLIAN static void | ||
15845 | _efl_canvas_text_efl_text_annotate_annotation_positions_get(Eo *eo_obj, | 15845 | _efl_canvas_text_canvas_efl_text_annotate_annotation_positions_get(Eo *eo_obj, | ||
15846 | Efl_Canvas_Text_Data *o EINA_UNUSED, | 15846 | Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, | ||
15847 | const Efl_Text_Annotate_Annotation *annotation, | 15847 | const Efl_Text_Annotate_Annotation *annotation, | ||
15848 | Efl_Text_Cursor_Cursor *start, Efl_Text_Cursor_Cursor *end) | 15848 | Efl_Text_Cursor_Cursor *start, Efl_Text_Cursor_Cursor *end) | ||
15849 | { | 15849 | { | ||
15850 | _textblock_cursor_pos_at_fnode_set(eo_obj, start, annotation->start_node); | 15850 | _textblock_cursor_pos_at_fnode_set(eo_obj, start, annotation->start_node); | ||
15851 | _textblock_cursor_pos_at_fnode_set(eo_obj, end, annotation->end_node); | 15851 | _textblock_cursor_pos_at_fnode_set(eo_obj, end, annotation->end_node); | ||
15852 | } | 15852 | } | ||
15853 | 15853 | | |||
15854 | static void | 15854 | static void | ||
15855 | _canvas_text_format_changed(Eo *eo_obj, Efl_Canvas_Text_Data *o) | 15855 | _canvas_text_format_changed(Eo *eo_obj, Efl_Canvas_Text_Canvas_Data *o) | ||
15856 | { | 15856 | { | ||
15857 | o->format_changed = EINA_TRUE; | 15857 | o->format_changed = EINA_TRUE; | ||
15858 | _evas_textblock_invalidate_all(o); | 15858 | _evas_textblock_invalidate_all(o); | ||
15859 | _evas_textblock_changed(o, eo_obj); | 15859 | _evas_textblock_changed(o, eo_obj); | ||
15860 | efl_event_callback_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CHANGED, NULL); | 15860 | efl_event_callback_call(eo_obj, EFL_CANVAS_TEXT_CANVAS_EVENT_CHANGED, NULL); | ||
15861 | } | 15861 | } | ||
15862 | 15862 | | |||
15863 | /* Efl.Text.Font interface implementation */ | 15863 | /* Efl.Text.Font interface implementation */ | ||
15864 | 15864 | | |||
15865 | static void | 15865 | static void | ||
15866 | _efl_canvas_text_efl_text_font_font_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, const char *font EINA_UNUSED, int size EINA_UNUSED) | 15866 | _efl_canvas_text_canvas_efl_text_font_font_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, const char *font EINA_UNUSED, int size EINA_UNUSED) | ||
15867 | { | 15867 | { | ||
15868 | ASYNC_BLOCK; | 15868 | ASYNC_BLOCK; | ||
15869 | Eina_Bool changed = EINA_FALSE; | 15869 | Eina_Bool changed = EINA_FALSE; | ||
15870 | 15870 | | |||
15871 | Eina_Stringshare *nfont; | 15871 | Eina_Stringshare *nfont; | ||
15872 | 15872 | | |||
15873 | if (size > 0 && o->default_format.info.size != size) | 15873 | if (size > 0 && o->default_format.info.size != size) | ||
15874 | { | 15874 | { | ||
Show All 19 Lines | |||||
15894 | 15894 | | |||
15895 | if (changed) | 15895 | if (changed) | ||
15896 | { | 15896 | { | ||
15897 | _canvas_text_format_changed(obj, o); | 15897 | _canvas_text_format_changed(obj, o); | ||
15898 | } | 15898 | } | ||
15899 | } | 15899 | } | ||
15900 | 15900 | | |||
15901 | static void | 15901 | static void | ||
15902 | _efl_canvas_text_efl_text_font_font_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, const char **font EINA_UNUSED, int *size EINA_UNUSED) | 15902 | _efl_canvas_text_canvas_efl_text_font_font_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, const char **font EINA_UNUSED, int *size EINA_UNUSED) | ||
15903 | { | 15903 | { | ||
15904 | if (font) *font = o->default_format.info.font; | 15904 | if (font) *font = o->default_format.info.font; | ||
15905 | if (size) *size = o->default_format.info.size; | 15905 | if (size) *size = o->default_format.info.size; | ||
15906 | } | 15906 | } | ||
15907 | 15907 | | |||
15908 | static void | 15908 | static void | ||
15909 | _efl_canvas_text_efl_text_font_font_source_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, const char *font_source EINA_UNUSED) | 15909 | _efl_canvas_text_canvas_efl_text_font_font_source_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, const char *font_source EINA_UNUSED) | ||
15910 | { | 15910 | { | ||
15911 | Eina_Stringshare *nfont_source; | 15911 | Eina_Stringshare *nfont_source; | ||
15912 | if (o->default_format.info.font_source != font_source) | 15912 | if (o->default_format.info.font_source != font_source) | ||
15913 | { | 15913 | { | ||
15914 | nfont_source = eina_stringshare_add(font_source); | 15914 | nfont_source = eina_stringshare_add(font_source); | ||
15915 | if (nfont_source == _FMT_INFO(font_source)) | 15915 | if (nfont_source == _FMT_INFO(font_source)) | ||
15916 | { | 15916 | { | ||
15917 | /* Already stringshared here, unref */ | 15917 | /* Already stringshared here, unref */ | ||
15918 | eina_stringshare_del(nfont_source); | 15918 | eina_stringshare_del(nfont_source); | ||
15919 | } | 15919 | } | ||
15920 | else | 15920 | else | ||
15921 | { | 15921 | { | ||
15922 | // Set immediately, load font_source later | 15922 | // Set immediately, load font_source later | ||
15923 | _FMT_INFO(font_source) = nfont_source; | 15923 | _FMT_INFO(font_source) = nfont_source; | ||
15924 | _canvas_text_format_changed(obj, o); | 15924 | _canvas_text_format_changed(obj, o); | ||
15925 | } | 15925 | } | ||
15926 | } | 15926 | } | ||
15927 | } | 15927 | } | ||
15928 | 15928 | | |||
15929 | static const char* | 15929 | static const char* | ||
15930 | _efl_canvas_text_efl_text_font_font_source_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED) | 15930 | _efl_canvas_text_canvas_efl_text_font_font_source_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED) | ||
15931 | { | 15931 | { | ||
15932 | return _FMT_INFO(font_source); | 15932 | return _FMT_INFO(font_source); | ||
15933 | } | 15933 | } | ||
15934 | 15934 | | |||
15935 | static void | 15935 | static void | ||
15936 | _efl_canvas_text_efl_text_font_font_fallbacks_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, const char *font_fallbacks EINA_UNUSED) | 15936 | _efl_canvas_text_canvas_efl_text_font_font_fallbacks_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, const char *font_fallbacks EINA_UNUSED) | ||
15937 | { | 15937 | { | ||
15938 | Eina_Stringshare *nfont_fallbacks; | 15938 | Eina_Stringshare *nfont_fallbacks; | ||
15939 | if (o->default_format.info.font_fallbacks != font_fallbacks) | 15939 | if (o->default_format.info.font_fallbacks != font_fallbacks) | ||
15940 | { | 15940 | { | ||
15941 | nfont_fallbacks = eina_stringshare_add(font_fallbacks); | 15941 | nfont_fallbacks = eina_stringshare_add(font_fallbacks); | ||
15942 | if (nfont_fallbacks == _FMT_INFO(font_fallbacks)) | 15942 | if (nfont_fallbacks == _FMT_INFO(font_fallbacks)) | ||
15943 | { | 15943 | { | ||
15944 | /* Already stringshared here, unref */ | 15944 | /* Already stringshared here, unref */ | ||
15945 | eina_stringshare_del(nfont_fallbacks); | 15945 | eina_stringshare_del(nfont_fallbacks); | ||
15946 | } | 15946 | } | ||
15947 | else | 15947 | else | ||
15948 | { | 15948 | { | ||
15949 | // Set immediately, load font_fallbacks later | 15949 | // Set immediately, load font_fallbacks later | ||
15950 | _FMT_INFO(font_fallbacks) = nfont_fallbacks; | 15950 | _FMT_INFO(font_fallbacks) = nfont_fallbacks; | ||
15951 | _canvas_text_format_changed(obj, o); | 15951 | _canvas_text_format_changed(obj, o); | ||
15952 | } | 15952 | } | ||
15953 | } | 15953 | } | ||
15954 | } | 15954 | } | ||
15955 | 15955 | | |||
15956 | static const char* | 15956 | static const char* | ||
15957 | _efl_canvas_text_efl_text_font_font_fallbacks_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED) | 15957 | _efl_canvas_text_canvas_efl_text_font_font_fallbacks_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED) | ||
15958 | { | 15958 | { | ||
15959 | return _FMT_INFO(font_fallbacks); | 15959 | return _FMT_INFO(font_fallbacks); | ||
15960 | } | 15960 | } | ||
15961 | 15961 | | |||
15962 | static void | 15962 | static void | ||
15963 | _efl_canvas_text_efl_text_font_font_lang_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, const char *font_lang EINA_UNUSED) | 15963 | _efl_canvas_text_canvas_efl_text_font_font_lang_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, const char *font_lang EINA_UNUSED) | ||
15964 | { | 15964 | { | ||
15965 | Eina_Stringshare *nfont_lang; | 15965 | Eina_Stringshare *nfont_lang; | ||
15966 | if (o->default_format.info.font_lang != font_lang) | 15966 | if (o->default_format.info.font_lang != font_lang) | ||
15967 | { | 15967 | { | ||
15968 | nfont_lang = eina_stringshare_add(font_lang); | 15968 | nfont_lang = eina_stringshare_add(font_lang); | ||
15969 | if (nfont_lang == _FMT_INFO(font_lang)) | 15969 | if (nfont_lang == _FMT_INFO(font_lang)) | ||
15970 | { | 15970 | { | ||
15971 | /* Already stringshared here, unref */ | 15971 | /* Already stringshared here, unref */ | ||
15972 | eina_stringshare_del(nfont_lang); | 15972 | eina_stringshare_del(nfont_lang); | ||
15973 | } | 15973 | } | ||
15974 | else | 15974 | else | ||
15975 | { | 15975 | { | ||
15976 | // Set immediately, load font_lang later | 15976 | // Set immediately, load font_lang later | ||
15977 | _FMT_INFO(font_lang) = nfont_lang; | 15977 | _FMT_INFO(font_lang) = nfont_lang; | ||
15978 | _canvas_text_format_changed(obj, o); | 15978 | _canvas_text_format_changed(obj, o); | ||
15979 | } | 15979 | } | ||
15980 | } | 15980 | } | ||
15981 | } | 15981 | } | ||
15982 | 15982 | | |||
15983 | static const char* | 15983 | static const char* | ||
15984 | _efl_canvas_text_efl_text_font_font_lang_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED) | 15984 | _efl_canvas_text_canvas_efl_text_font_font_lang_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED) | ||
15985 | { | 15985 | { | ||
15986 | return _FMT_INFO(font_lang); | 15986 | return _FMT_INFO(font_lang); | ||
15987 | } | 15987 | } | ||
15988 | 15988 | | |||
15989 | static void | 15989 | static void | ||
15990 | _efl_canvas_text_efl_text_font_font_weight_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Font_Weight font_weight EINA_UNUSED) | 15990 | _efl_canvas_text_canvas_efl_text_font_font_weight_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Font_Weight font_weight EINA_UNUSED) | ||
15991 | { | 15991 | { | ||
15992 | if (_FMT_INFO(font_weight) == font_weight) return; | 15992 | if (_FMT_INFO(font_weight) == font_weight) return; | ||
15993 | _FMT_INFO(font_weight) = font_weight; | 15993 | _FMT_INFO(font_weight) = font_weight; | ||
15994 | _canvas_text_format_changed(obj, o); | 15994 | _canvas_text_format_changed(obj, o); | ||
15995 | } | 15995 | } | ||
15996 | 15996 | | |||
15997 | static Efl_Text_Font_Weight | 15997 | static Efl_Text_Font_Weight | ||
15998 | _efl_canvas_text_efl_text_font_font_weight_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED) | 15998 | _efl_canvas_text_canvas_efl_text_font_font_weight_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED) | ||
15999 | { | 15999 | { | ||
16000 | return _FMT_INFO(font_weight); | 16000 | return _FMT_INFO(font_weight); | ||
16001 | } | 16001 | } | ||
16002 | 16002 | | |||
16003 | static void | 16003 | static void | ||
16004 | _efl_canvas_text_efl_text_font_font_slant_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Font_Slant font_slant EINA_UNUSED) | 16004 | _efl_canvas_text_canvas_efl_text_font_font_slant_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Font_Slant font_slant EINA_UNUSED) | ||
16005 | { | 16005 | { | ||
16006 | ASYNC_BLOCK; | 16006 | ASYNC_BLOCK; | ||
16007 | if (_FMT_INFO(font_slant) == font_slant) return; | 16007 | if (_FMT_INFO(font_slant) == font_slant) return; | ||
16008 | _FMT_INFO(font_slant) = font_slant; | 16008 | _FMT_INFO(font_slant) = font_slant; | ||
16009 | _canvas_text_format_changed(obj, o); | 16009 | _canvas_text_format_changed(obj, o); | ||
16010 | } | 16010 | } | ||
16011 | 16011 | | |||
16012 | static Efl_Text_Font_Slant | 16012 | static Efl_Text_Font_Slant | ||
16013 | _efl_canvas_text_efl_text_font_font_slant_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED) | 16013 | _efl_canvas_text_canvas_efl_text_font_font_slant_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED) | ||
16014 | { | 16014 | { | ||
16015 | return _FMT_INFO(font_slant); | 16015 | return _FMT_INFO(font_slant); | ||
16016 | } | 16016 | } | ||
16017 | 16017 | | |||
16018 | static void | 16018 | static void | ||
16019 | _efl_canvas_text_efl_text_font_font_width_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Font_Width font_width EINA_UNUSED) | 16019 | _efl_canvas_text_canvas_efl_text_font_font_width_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Font_Width font_width EINA_UNUSED) | ||
16020 | { | 16020 | { | ||
16021 | ASYNC_BLOCK; | 16021 | ASYNC_BLOCK; | ||
16022 | if (_FMT_INFO(font_width) == font_width) return; | 16022 | if (_FMT_INFO(font_width) == font_width) return; | ||
16023 | _FMT_INFO(font_width) = font_width; | 16023 | _FMT_INFO(font_width) = font_width; | ||
16024 | _canvas_text_format_changed(obj, o); | 16024 | _canvas_text_format_changed(obj, o); | ||
16025 | } | 16025 | } | ||
16026 | 16026 | | |||
16027 | static Efl_Text_Font_Width | 16027 | static Efl_Text_Font_Width | ||
16028 | _efl_canvas_text_efl_text_font_font_width_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED) | 16028 | _efl_canvas_text_canvas_efl_text_font_font_width_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED) | ||
16029 | { | 16029 | { | ||
16030 | return _FMT_INFO(font_width); | 16030 | return _FMT_INFO(font_width); | ||
16031 | } | 16031 | } | ||
16032 | 16032 | | |||
16033 | EOLIAN static void | 16033 | EOLIAN static void | ||
16034 | _efl_canvas_text_efl_text_font_font_bitmap_scalable_set(Eo *obj, Efl_Canvas_Text_Data *o, Efl_Text_Font_Bitmap_Scalable bitmap_scalable) | 16034 | _efl_canvas_text_canvas_efl_text_font_font_bitmap_scalable_set(Eo *obj, Efl_Canvas_Text_Canvas_Data *o, Efl_Text_Font_Bitmap_Scalable bitmap_scalable) | ||
16035 | { | 16035 | { | ||
16036 | if (_FMT_INFO(bitmap_scalable) == bitmap_scalable) return; | 16036 | if (_FMT_INFO(bitmap_scalable) == bitmap_scalable) return; | ||
16037 | _FMT_INFO(bitmap_scalable) = bitmap_scalable; | 16037 | _FMT_INFO(bitmap_scalable) = bitmap_scalable; | ||
16038 | _canvas_text_format_changed(obj, o); | 16038 | _canvas_text_format_changed(obj, o); | ||
16039 | } | 16039 | } | ||
16040 | 16040 | | |||
16041 | EOLIAN static Efl_Text_Font_Bitmap_Scalable | 16041 | EOLIAN static Efl_Text_Font_Bitmap_Scalable | ||
16042 | _efl_canvas_text_efl_text_font_font_bitmap_scalable_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o) | 16042 | _efl_canvas_text_canvas_efl_text_font_font_bitmap_scalable_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o) | ||
16043 | { | 16043 | { | ||
16044 | return _FMT_INFO(bitmap_scalable); | 16044 | return _FMT_INFO(bitmap_scalable); | ||
16045 | } | 16045 | } | ||
16046 | 16046 | | |||
16047 | /* Efl.Text.Style interface implementation */ | 16047 | /* Efl.Text.Style interface implementation */ | ||
16048 | 16048 | | |||
16049 | /* Helper: sets color fields of style 'x' and informs if any are changed. */ | 16049 | /* Helper: sets color fields of style 'x' and informs if any are changed. */ | ||
16050 | #define _FMT_COLOR_SET(x) \ | 16050 | #define _FMT_COLOR_SET(x) \ | ||
Show All 24 Lines | 16073 | #define _FMT_INFO_SET_START(x, v) \ | |||
16075 | if (_FMT_INFO(x) == v) return; \ | 16075 | if (_FMT_INFO(x) == v) return; \ | ||
16076 | changed = EINA_TRUE; \ | 16076 | changed = EINA_TRUE; \ | ||
16077 | _FMT_INFO(x) = v; \ | 16077 | _FMT_INFO(x) = v; \ | ||
16078 | 16078 | | |||
16079 | #define _FMT_INFO_SET_END() \ | 16079 | #define _FMT_INFO_SET_END() \ | ||
16080 | if (changed) _canvas_text_format_changed(obj, o); | 16080 | if (changed) _canvas_text_format_changed(obj, o); | ||
16081 | 16081 | | |||
16082 | static void | 16082 | static void | ||
16083 | _efl_canvas_text_efl_text_style_normal_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | 16083 | _efl_canvas_text_canvas_efl_text_style_normal_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | ||
16084 | { | 16084 | { | ||
16085 | ASYNC_BLOCK; | 16085 | ASYNC_BLOCK; | ||
16086 | _FMT_COLOR_SET(normal); | 16086 | _FMT_COLOR_SET(normal); | ||
16087 | } | 16087 | } | ||
16088 | 16088 | | |||
16089 | static void | 16089 | static void | ||
16090 | _efl_canvas_text_efl_text_style_normal_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | 16090 | _efl_canvas_text_canvas_efl_text_style_normal_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | ||
16091 | { | 16091 | { | ||
16092 | _FMT_COLOR_RET(normal); | 16092 | _FMT_COLOR_RET(normal); | ||
16093 | } | 16093 | } | ||
16094 | 16094 | | |||
16095 | static void | 16095 | static void | ||
16096 | _efl_canvas_text_efl_text_style_backing_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Style_Backing_Type type EINA_UNUSED) | 16096 | _efl_canvas_text_canvas_efl_text_style_backing_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Style_Backing_Type type EINA_UNUSED) | ||
16097 | { | 16097 | { | ||
16098 | ASYNC_BLOCK; | 16098 | ASYNC_BLOCK; | ||
16099 | _FMT_SET(backing, type); | 16099 | _FMT_SET(backing, type); | ||
16100 | } | 16100 | } | ||
16101 | 16101 | | |||
16102 | static Efl_Text_Style_Backing_Type | 16102 | static Efl_Text_Style_Backing_Type | ||
16103 | _efl_canvas_text_efl_text_style_backing_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED) | 16103 | _efl_canvas_text_canvas_efl_text_style_backing_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED) | ||
16104 | { | 16104 | { | ||
16105 | return _FMT(backing); | 16105 | return _FMT(backing); | ||
16106 | } | 16106 | } | ||
16107 | 16107 | | |||
16108 | static void | 16108 | static void | ||
16109 | _efl_canvas_text_efl_text_style_backing_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | 16109 | _efl_canvas_text_canvas_efl_text_style_backing_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | ||
16110 | { | 16110 | { | ||
16111 | ASYNC_BLOCK; | 16111 | ASYNC_BLOCK; | ||
16112 | _FMT_COLOR_SET(backing); | 16112 | _FMT_COLOR_SET(backing); | ||
16113 | } | 16113 | } | ||
16114 | 16114 | | |||
16115 | static void | 16115 | static void | ||
16116 | _efl_canvas_text_efl_text_style_backing_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | 16116 | _efl_canvas_text_canvas_efl_text_style_backing_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | ||
16117 | { | 16117 | { | ||
16118 | _FMT_COLOR_RET(backing); | 16118 | _FMT_COLOR_RET(backing); | ||
16119 | } | 16119 | } | ||
16120 | 16120 | | |||
16121 | static struct | 16121 | static struct | ||
16122 | { | 16122 | { | ||
16123 | Eina_Bool underline_single : 1; | 16123 | Eina_Bool underline_single : 1; | ||
16124 | Eina_Bool underline_double : 1; | 16124 | Eina_Bool underline_double : 1; | ||
16125 | Eina_Bool underline_dashed : 1; | 16125 | Eina_Bool underline_dashed : 1; | ||
16126 | } _style_underline_map[] = { | 16126 | } _style_underline_map[] = { | ||
16127 | { 0, 0, 0 }, | 16127 | { 0, 0, 0 }, | ||
16128 | { 1, 0, 0 }, | 16128 | { 1, 0, 0 }, | ||
16129 | { 1, 1, 0 }, | 16129 | { 1, 1, 0 }, | ||
16130 | { 0, 0, 1 } | 16130 | { 0, 0, 1 } | ||
16131 | }; | 16131 | }; | ||
16132 | 16132 | | |||
16133 | static void | 16133 | static void | ||
16134 | _efl_canvas_text_efl_text_style_underline_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Style_Underline_Type type EINA_UNUSED) | 16134 | _efl_canvas_text_canvas_efl_text_style_underline_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Style_Underline_Type type EINA_UNUSED) | ||
16135 | { | 16135 | { | ||
16136 | ASYNC_BLOCK; | 16136 | ASYNC_BLOCK; | ||
16137 | _FMT_SET(underline, _style_underline_map[type].underline_single); | 16137 | _FMT_SET(underline, _style_underline_map[type].underline_single); | ||
16138 | _FMT_SET(underline2, _style_underline_map[type].underline_double); | 16138 | _FMT_SET(underline2, _style_underline_map[type].underline_double); | ||
16139 | _FMT_SET(underline_dash, _style_underline_map[type].underline_dashed); | 16139 | _FMT_SET(underline_dash, _style_underline_map[type].underline_dashed); | ||
16140 | 16140 | | |||
16141 | } | 16141 | } | ||
16142 | 16142 | | |||
16143 | static Efl_Text_Style_Underline_Type | 16143 | static Efl_Text_Style_Underline_Type | ||
16144 | _efl_canvas_text_efl_text_style_underline_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED) | 16144 | _efl_canvas_text_canvas_efl_text_style_underline_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED) | ||
16145 | { | 16145 | { | ||
16146 | return _FMT(underline); | 16146 | return _FMT(underline); | ||
16147 | } | 16147 | } | ||
16148 | 16148 | | |||
16149 | static void | 16149 | static void | ||
16150 | _efl_canvas_text_efl_text_style_underline_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | 16150 | _efl_canvas_text_canvas_efl_text_style_underline_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | ||
16151 | { | 16151 | { | ||
16152 | ASYNC_BLOCK; | 16152 | ASYNC_BLOCK; | ||
16153 | _FMT_COLOR_SET(underline); | 16153 | _FMT_COLOR_SET(underline); | ||
16154 | } | 16154 | } | ||
16155 | 16155 | | |||
16156 | static void | 16156 | static void | ||
16157 | _efl_canvas_text_efl_text_style_underline_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | 16157 | _efl_canvas_text_canvas_efl_text_style_underline_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | ||
16158 | { | 16158 | { | ||
16159 | _FMT_COLOR_RET(underline); | 16159 | _FMT_COLOR_RET(underline); | ||
16160 | } | 16160 | } | ||
16161 | 16161 | | |||
16162 | static void | 16162 | static void | ||
16163 | _efl_canvas_text_efl_text_style_underline_height_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, double height EINA_UNUSED) | 16163 | _efl_canvas_text_canvas_efl_text_style_underline_height_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, double height EINA_UNUSED) | ||
16164 | { | 16164 | { | ||
16165 | ASYNC_BLOCK; | 16165 | ASYNC_BLOCK; | ||
16166 | _FMT_SET(underline_height, height); | 16166 | _FMT_SET(underline_height, height); | ||
16167 | } | 16167 | } | ||
16168 | 16168 | | |||
16169 | static double | 16169 | static double | ||
16170 | _efl_canvas_text_efl_text_style_underline_height_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED) | 16170 | _efl_canvas_text_canvas_efl_text_style_underline_height_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED) | ||
16171 | { | 16171 | { | ||
16172 | return _FMT(underline_height); | 16172 | return _FMT(underline_height); | ||
16173 | } | 16173 | } | ||
16174 | 16174 | | |||
16175 | static void | 16175 | static void | ||
16176 | _efl_canvas_text_efl_text_style_underline_dashed_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | 16176 | _efl_canvas_text_canvas_efl_text_style_underline_dashed_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | ||
16177 | { | 16177 | { | ||
16178 | ASYNC_BLOCK; | 16178 | ASYNC_BLOCK; | ||
16179 | _FMT_COLOR_SET(underline_dash); | 16179 | _FMT_COLOR_SET(underline_dash); | ||
16180 | } | 16180 | } | ||
16181 | 16181 | | |||
16182 | static void | 16182 | static void | ||
16183 | _efl_canvas_text_efl_text_style_underline_dashed_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | 16183 | _efl_canvas_text_canvas_efl_text_style_underline_dashed_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | ||
16184 | { | 16184 | { | ||
16185 | _FMT_COLOR_RET(underline_dash); | 16185 | _FMT_COLOR_RET(underline_dash); | ||
16186 | } | 16186 | } | ||
16187 | 16187 | | |||
16188 | static void | 16188 | static void | ||
16189 | _efl_canvas_text_efl_text_style_underline_dashed_width_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, int width EINA_UNUSED) | 16189 | _efl_canvas_text_canvas_efl_text_style_underline_dashed_width_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, int width EINA_UNUSED) | ||
16190 | { | 16190 | { | ||
16191 | ASYNC_BLOCK; | 16191 | ASYNC_BLOCK; | ||
16192 | _FMT_SET(underline_dash_width, width); | 16192 | _FMT_SET(underline_dash_width, width); | ||
16193 | } | 16193 | } | ||
16194 | 16194 | | |||
16195 | static int | 16195 | static int | ||
16196 | _efl_canvas_text_efl_text_style_underline_dashed_width_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED) | 16196 | _efl_canvas_text_canvas_efl_text_style_underline_dashed_width_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED) | ||
16197 | { | 16197 | { | ||
16198 | return _FMT(underline_dash_width); | 16198 | return _FMT(underline_dash_width); | ||
16199 | } | 16199 | } | ||
16200 | 16200 | | |||
16201 | static void | 16201 | static void | ||
16202 | _efl_canvas_text_efl_text_style_underline_dashed_gap_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, int gap EINA_UNUSED) | 16202 | _efl_canvas_text_canvas_efl_text_style_underline_dashed_gap_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, int gap EINA_UNUSED) | ||
16203 | { | 16203 | { | ||
16204 | ASYNC_BLOCK; | 16204 | ASYNC_BLOCK; | ||
16205 | _FMT_SET(underline_dash_gap, gap); | 16205 | _FMT_SET(underline_dash_gap, gap); | ||
16206 | } | 16206 | } | ||
16207 | 16207 | | |||
16208 | static int | 16208 | static int | ||
16209 | _efl_canvas_text_efl_text_style_underline_dashed_gap_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED) | 16209 | _efl_canvas_text_canvas_efl_text_style_underline_dashed_gap_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED) | ||
16210 | { | 16210 | { | ||
16211 | return _FMT(underline_dash_width); | 16211 | return _FMT(underline_dash_width); | ||
16212 | } | 16212 | } | ||
16213 | 16213 | | |||
16214 | static void | 16214 | static void | ||
16215 | _efl_canvas_text_efl_text_style_underline2_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | 16215 | _efl_canvas_text_canvas_efl_text_style_underline2_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | ||
16216 | { | 16216 | { | ||
16217 | ASYNC_BLOCK; | 16217 | ASYNC_BLOCK; | ||
16218 | _FMT_COLOR_SET(underline2); | 16218 | _FMT_COLOR_SET(underline2); | ||
16219 | } | 16219 | } | ||
16220 | 16220 | | |||
16221 | static void | 16221 | static void | ||
16222 | _efl_canvas_text_efl_text_style_underline2_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | 16222 | _efl_canvas_text_canvas_efl_text_style_underline2_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | ||
16223 | { | 16223 | { | ||
16224 | _FMT_COLOR_RET(underline2); | 16224 | _FMT_COLOR_RET(underline2); | ||
16225 | } | 16225 | } | ||
16226 | 16226 | | |||
16227 | static void | 16227 | static void | ||
16228 | _efl_canvas_text_efl_text_style_strikethrough_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Style_Strikethrough_Type type EINA_UNUSED) | 16228 | _efl_canvas_text_canvas_efl_text_style_strikethrough_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Style_Strikethrough_Type type EINA_UNUSED) | ||
16229 | { | 16229 | { | ||
16230 | ASYNC_BLOCK; | 16230 | ASYNC_BLOCK; | ||
16231 | _FMT_SET(strikethrough, type); | 16231 | _FMT_SET(strikethrough, type); | ||
16232 | } | 16232 | } | ||
16233 | 16233 | | |||
16234 | static Efl_Text_Style_Strikethrough_Type | 16234 | static Efl_Text_Style_Strikethrough_Type | ||
16235 | _efl_canvas_text_efl_text_style_strikethrough_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED) | 16235 | _efl_canvas_text_canvas_efl_text_style_strikethrough_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED) | ||
16236 | { | 16236 | { | ||
16237 | return _FMT(strikethrough); | 16237 | return _FMT(strikethrough); | ||
16238 | } | 16238 | } | ||
16239 | 16239 | | |||
16240 | static void | 16240 | static void | ||
16241 | _efl_canvas_text_efl_text_style_strikethrough_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | 16241 | _efl_canvas_text_canvas_efl_text_style_strikethrough_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | ||
16242 | { | 16242 | { | ||
16243 | ASYNC_BLOCK; | 16243 | ASYNC_BLOCK; | ||
16244 | _FMT_COLOR_SET(strikethrough); | 16244 | _FMT_COLOR_SET(strikethrough); | ||
16245 | } | 16245 | } | ||
16246 | 16246 | | |||
16247 | static void | 16247 | static void | ||
16248 | _efl_canvas_text_efl_text_style_strikethrough_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | 16248 | _efl_canvas_text_canvas_efl_text_style_strikethrough_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | ||
16249 | { | 16249 | { | ||
16250 | _FMT_COLOR_RET(strikethrough); | 16250 | _FMT_COLOR_RET(strikethrough); | ||
16251 | } | 16251 | } | ||
16252 | 16252 | | |||
16253 | static const struct | 16253 | static const struct | ||
16254 | { | 16254 | { | ||
16255 | Efl_Text_Style_Effect_Type x; | 16255 | Efl_Text_Style_Effect_Type x; | ||
16256 | Evas_Text_Style_Type y; | 16256 | Evas_Text_Style_Type y; | ||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 16307 | { | |||
16308 | if (_map_shadow_dir[i].x == dir) | 16308 | if (_map_shadow_dir[i].x == dir) | ||
16309 | return _map_shadow_dir[i].y; | 16309 | return _map_shadow_dir[i].y; | ||
16310 | } | 16310 | } | ||
16311 | ERR("Mapping direction failed. Please check code\n"); | 16311 | ERR("Mapping direction failed. Please check code\n"); | ||
16312 | return EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT; // shouldn't reach | 16312 | return EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT; // shouldn't reach | ||
16313 | } | 16313 | } | ||
16314 | 16314 | | |||
16315 | static void | 16315 | static void | ||
16316 | _efl_canvas_text_efl_text_style_effect_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Style_Effect_Type type EINA_UNUSED) | 16316 | _efl_canvas_text_canvas_efl_text_style_effect_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Style_Effect_Type type EINA_UNUSED) | ||
16317 | { | 16317 | { | ||
16318 | ASYNC_BLOCK; | 16318 | ASYNC_BLOCK; | ||
16319 | _FMT_INFO_SET_START(effect, type); | 16319 | _FMT_INFO_SET_START(effect, type); | ||
16320 | _FMT(style) = _get_style_from_map(type); | 16320 | _FMT(style) = _get_style_from_map(type); | ||
16321 | // Re-apply shadow direction | 16321 | // Re-apply shadow direction | ||
16322 | EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(_FMT(style), | 16322 | EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(_FMT(style), | ||
16323 | _get_dir_from_map(_FMT_INFO(shadow_direction))); | 16323 | _get_dir_from_map(_FMT_INFO(shadow_direction))); | ||
16324 | _FMT_INFO_SET_END(); | 16324 | _FMT_INFO_SET_END(); | ||
16325 | } | 16325 | } | ||
16326 | 16326 | | |||
16327 | static Efl_Text_Style_Effect_Type | 16327 | static Efl_Text_Style_Effect_Type | ||
16328 | _efl_canvas_text_efl_text_style_effect_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED) | 16328 | _efl_canvas_text_canvas_efl_text_style_effect_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED) | ||
16329 | { | 16329 | { | ||
16330 | return _FMT_INFO(effect); | 16330 | return _FMT_INFO(effect); | ||
16331 | } | 16331 | } | ||
16332 | 16332 | | |||
16333 | static void | 16333 | static void | ||
16334 | _efl_canvas_text_efl_text_style_outline_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | 16334 | _efl_canvas_text_canvas_efl_text_style_outline_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | ||
16335 | { | 16335 | { | ||
16336 | ASYNC_BLOCK; | 16336 | ASYNC_BLOCK; | ||
16337 | _FMT_COLOR_SET(outline); | 16337 | _FMT_COLOR_SET(outline); | ||
16338 | } | 16338 | } | ||
16339 | 16339 | | |||
16340 | static void | 16340 | static void | ||
16341 | _efl_canvas_text_efl_text_style_outline_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | 16341 | _efl_canvas_text_canvas_efl_text_style_outline_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | ||
16342 | { | 16342 | { | ||
16343 | _FMT_COLOR_RET(outline); | 16343 | _FMT_COLOR_RET(outline); | ||
16344 | } | 16344 | } | ||
16345 | 16345 | | |||
16346 | static void | 16346 | static void | ||
16347 | _efl_canvas_text_efl_text_style_shadow_direction_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Style_Shadow_Direction type EINA_UNUSED) | 16347 | _efl_canvas_text_canvas_efl_text_style_shadow_direction_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Style_Shadow_Direction type EINA_UNUSED) | ||
16348 | { | 16348 | { | ||
16349 | ASYNC_BLOCK; | 16349 | ASYNC_BLOCK; | ||
16350 | _FMT_INFO_SET_START(shadow_direction, type); | 16350 | _FMT_INFO_SET_START(shadow_direction, type); | ||
16351 | EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(_FMT(style), | 16351 | EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(_FMT(style), | ||
16352 | _get_dir_from_map(_FMT_INFO(shadow_direction))); | 16352 | _get_dir_from_map(_FMT_INFO(shadow_direction))); | ||
16353 | _FMT_INFO_SET_END(); | 16353 | _FMT_INFO_SET_END(); | ||
16354 | } | 16354 | } | ||
16355 | 16355 | | |||
16356 | static Efl_Text_Style_Shadow_Direction | 16356 | static Efl_Text_Style_Shadow_Direction | ||
16357 | _efl_canvas_text_efl_text_style_shadow_direction_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED) | 16357 | _efl_canvas_text_canvas_efl_text_style_shadow_direction_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED) | ||
16358 | { | 16358 | { | ||
16359 | return _FMT_INFO(shadow_direction); | 16359 | return _FMT_INFO(shadow_direction); | ||
16360 | } | 16360 | } | ||
16361 | 16361 | | |||
16362 | static void | 16362 | static void | ||
16363 | _efl_canvas_text_efl_text_style_shadow_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | 16363 | _efl_canvas_text_canvas_efl_text_style_shadow_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | ||
16364 | { | 16364 | { | ||
16365 | ASYNC_BLOCK; | 16365 | ASYNC_BLOCK; | ||
16366 | _FMT_COLOR_SET(shadow); | 16366 | _FMT_COLOR_SET(shadow); | ||
16367 | } | 16367 | } | ||
16368 | 16368 | | |||
16369 | static void | 16369 | static void | ||
16370 | _efl_canvas_text_efl_text_style_shadow_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | 16370 | _efl_canvas_text_canvas_efl_text_style_shadow_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | ||
16371 | { | 16371 | { | ||
16372 | _FMT_COLOR_RET(shadow); | 16372 | _FMT_COLOR_RET(shadow); | ||
16373 | } | 16373 | } | ||
16374 | 16374 | | |||
16375 | static void | 16375 | static void | ||
16376 | _efl_canvas_text_efl_text_style_glow_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | 16376 | _efl_canvas_text_canvas_efl_text_style_glow_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | ||
16377 | { | 16377 | { | ||
16378 | ASYNC_BLOCK; | 16378 | ASYNC_BLOCK; | ||
16379 | _FMT_COLOR_SET(glow); | 16379 | _FMT_COLOR_SET(glow); | ||
16380 | } | 16380 | } | ||
16381 | 16381 | | |||
16382 | static void | 16382 | static void | ||
16383 | _efl_canvas_text_efl_text_style_glow_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | 16383 | _efl_canvas_text_canvas_efl_text_style_glow_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | ||
16384 | { | 16384 | { | ||
16385 | _FMT_COLOR_RET(glow); | 16385 | _FMT_COLOR_RET(glow); | ||
16386 | } | 16386 | } | ||
16387 | 16387 | | |||
16388 | static void | 16388 | static void | ||
16389 | _efl_canvas_text_efl_text_style_glow2_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | 16389 | _efl_canvas_text_canvas_efl_text_style_glow2_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED) | ||
16390 | { | 16390 | { | ||
16391 | ASYNC_BLOCK; | 16391 | ASYNC_BLOCK; | ||
16392 | _FMT_COLOR_SET(glow2); | 16392 | _FMT_COLOR_SET(glow2); | ||
16393 | } | 16393 | } | ||
16394 | 16394 | | |||
16395 | static void | 16395 | static void | ||
16396 | _efl_canvas_text_efl_text_style_glow2_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | 16396 | _efl_canvas_text_canvas_efl_text_style_glow2_color_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED) | ||
16397 | { | 16397 | { | ||
16398 | _FMT_COLOR_RET(glow2); | 16398 | _FMT_COLOR_RET(glow2); | ||
16399 | } | 16399 | } | ||
16400 | 16400 | | |||
16401 | static void | 16401 | static void | ||
16402 | _efl_canvas_text_efl_text_style_gfx_filter_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, | 16402 | _efl_canvas_text_canvas_efl_text_style_gfx_filter_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, | ||
16403 | const char *gfx_filter_name) | 16403 | const char *gfx_filter_name) | ||
16404 | { | 16404 | { | ||
16405 | ASYNC_BLOCK; | 16405 | ASYNC_BLOCK; | ||
16406 | Eina_Stringshare *ngfx_filter_name; | 16406 | Eina_Stringshare *ngfx_filter_name; | ||
16407 | 16407 | | |||
16408 | if (_FMT_INFO(gfx_filter_name) != gfx_filter_name) | 16408 | if (_FMT_INFO(gfx_filter_name) != gfx_filter_name) | ||
16409 | { | 16409 | { | ||
16410 | ngfx_filter_name = eina_stringshare_add(gfx_filter_name); | 16410 | ngfx_filter_name = eina_stringshare_add(gfx_filter_name); | ||
16411 | if (_FMT_INFO(gfx_filter_name) == ngfx_filter_name) | 16411 | if (_FMT_INFO(gfx_filter_name) == ngfx_filter_name) | ||
16412 | { | 16412 | { | ||
16413 | /* Already stringshared here, unref */ | 16413 | /* Already stringshared here, unref */ | ||
16414 | eina_stringshare_del(ngfx_filter_name); | 16414 | eina_stringshare_del(ngfx_filter_name); | ||
16415 | } | 16415 | } | ||
16416 | else | 16416 | else | ||
16417 | { | 16417 | { | ||
16418 | // Set immediately, load style_gfx_filter_name later | 16418 | // Set immediately, load style_gfx_filter_name later | ||
16419 | _FMT_INFO(gfx_filter_name) = ngfx_filter_name; | 16419 | _FMT_INFO(gfx_filter_name) = ngfx_filter_name; | ||
16420 | _canvas_text_format_changed(obj, o); | 16420 | _canvas_text_format_changed(obj, o); | ||
16421 | } | 16421 | } | ||
16422 | } | 16422 | } | ||
16423 | } | 16423 | } | ||
16424 | 16424 | | |||
16425 | static const char * | 16425 | static const char * | ||
16426 | _efl_canvas_text_efl_text_style_gfx_filter_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED) | 16426 | _efl_canvas_text_canvas_efl_text_style_gfx_filter_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED) | ||
16427 | { | 16427 | { | ||
16428 | return _FMT(gfx_filter)?_FMT(gfx_filter->name):NULL; | 16428 | return _FMT(gfx_filter)?_FMT(gfx_filter->name):NULL; | ||
16429 | } | 16429 | } | ||
16430 | 16430 | | |||
16431 | static void | 16431 | static void | ||
16432 | _efl_canvas_text_efl_text_format_ellipsis_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, double value EINA_UNUSED) | 16432 | _efl_canvas_text_canvas_efl_text_format_ellipsis_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, double value EINA_UNUSED) | ||
16433 | { | 16433 | { | ||
16434 | ASYNC_BLOCK; | 16434 | ASYNC_BLOCK; | ||
16435 | _FMT_SET(ellipsis, value); | 16435 | _FMT_SET(ellipsis, value); | ||
16436 | } | 16436 | } | ||
16437 | 16437 | | |||
16438 | static double | 16438 | static double | ||
16439 | _efl_canvas_text_efl_text_format_ellipsis_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED) | 16439 | _efl_canvas_text_canvas_efl_text_format_ellipsis_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED) | ||
16440 | { | 16440 | { | ||
16441 | return _FMT(ellipsis); | 16441 | return _FMT(ellipsis); | ||
16442 | } | 16442 | } | ||
16443 | 16443 | | |||
16444 | static void | 16444 | static void | ||
16445 | _efl_canvas_text_efl_text_format_wrap_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Format_Wrap wrap EINA_UNUSED) | 16445 | _efl_canvas_text_canvas_efl_text_format_wrap_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Canvas_Data *o EINA_UNUSED, Efl_Text_Format_Wrap wrap EINA_UNUSED) | ||
16446 | { | 16446 | { | ||
16447 | ASYNC_BLOCK; | 16447 | ASYNC_BLOCK; | ||
16448 | _FMT_INFO_SET_START(wrap, wrap); | 16448 | _FMT_INFO_SET_START(wrap, wrap); | ||
16449 | _FMT(wrap_word) = (wrap == EFL_TEXT_FORMAT_WRAP_WORD); | 16449 | _FMT(wrap_word) = (wrap == EFL_TEXT_FORMAT_WRAP_WORD); | ||
16450 | _FMT(wrap_char) = (wrap == EFL_TEXT_FORMAT_WRAP_CHAR); | 16450 | _FMT(wrap_char) = (wrap == EFL_TEXT_FORMAT_WRAP_CHAR); | ||
16451 | _FMT(wrap_mixed) = (wrap == EFL_TEXT_FORMAT_WRAP_MIXED); | 16451 | _FMT(wrap_mixed) = (wrap == EFL_TEXT_FORMAT_WRAP_MIXED); | ||
16452 | _FMT(wrap_hyphenation) = (wrap == EFL_TEXT_FORMAT_WRAP_HYPHENATION); | 16452 | _FMT(wrap_hyphenation) = (wrap == EFL_TEXT_FORMAT_WRAP_HYPHENATION); | ||
16453 | _FMT_INFO_SET_END(); | 16453 | _FMT_INFO_SET_END(); | ||
16454 | } | 16454 | } | ||
16455 | 16455 | |