forked from enlightenment/efl
efl_text_attribute_factory: rename to efl_text_formatter
Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8455 Differential Revision: https://phab.enlightenment.org/D10925
This commit is contained in:
parent
5cf7fa7670
commit
8dbc75fdce
|
@ -16,7 +16,7 @@ _apply_style(Eo *obj, size_t start_pos, size_t end_pos, const char *style)
|
|||
efl_text_cursor_position_set(start, start_pos);
|
||||
efl_text_cursor_position_set(end, end_pos);
|
||||
|
||||
efl_text_attribute_factory_attribute_insert(start, end, style);
|
||||
efl_text_formatter_attribute_insert(start, end, style);
|
||||
|
||||
efl_del(start);
|
||||
efl_del(end);
|
||||
|
|
|
@ -2808,7 +2808,7 @@ _textblock_node_format_to_atspi_text_attr(Efl_Text_Attribute_Handle *annotation)
|
|||
Efl_Access_Text_Attribute *ret;
|
||||
const char *txt;
|
||||
|
||||
txt = efl_text_attribute_factory_attribute_get(annotation);
|
||||
txt = efl_text_formatter_attribute_get(annotation);
|
||||
if (!txt) return NULL;
|
||||
|
||||
ret = calloc(1, sizeof(Efl_Access_Text_Attribute));
|
||||
|
@ -2843,7 +2843,7 @@ _efl_ui_textbox_efl_access_text_attribute_get(const Eo *obj, Efl_Ui_Textbox_Data
|
|||
efl_text_cursor_position_set(cur1, *start_offset);
|
||||
efl_text_cursor_position_set(cur2, *end_offset);
|
||||
|
||||
annotations = efl_text_attribute_factory_range_attributes_get(cur1, cur2);
|
||||
annotations = efl_text_formatter_range_attributes_get(cur1, cur2);
|
||||
|
||||
efl_del(cur1);
|
||||
efl_del(cur2);
|
||||
|
@ -2889,7 +2889,7 @@ _efl_ui_textbox_efl_access_text_text_attributes_get(const Eo *obj, Efl_Ui_Textbo
|
|||
efl_text_cursor_position_set(cur1, *start_offset);
|
||||
efl_text_cursor_position_set(cur2, *end_offset);
|
||||
|
||||
annotations = efl_text_attribute_factory_range_attributes_get(cur1, cur2);
|
||||
annotations = efl_text_formatter_range_attributes_get(cur1, cur2);
|
||||
|
||||
efl_del(cur1);
|
||||
efl_del(cur2);
|
||||
|
@ -2924,7 +2924,7 @@ _efl_ui_textbox_efl_access_text_default_attributes_get(const Eo *obj, Efl_Ui_Tex
|
|||
efl_text_cursor_move(start, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST);
|
||||
efl_text_cursor_move(end, EFL_TEXT_CURSOR_MOVE_TYPE_LAST);
|
||||
|
||||
annotations = efl_text_attribute_factory_range_attributes_get(start, end);
|
||||
annotations = efl_text_formatter_range_attributes_get(start, end);
|
||||
|
||||
EINA_ITERATOR_FOREACH(annotations, an)
|
||||
{
|
||||
|
@ -3288,14 +3288,14 @@ _anchor_get(Eo *obj, Efl_Ui_Textbox_Data *sd, Efl_Text_Attribute_Handle *an)
|
|||
Eina_List *i;
|
||||
const char *str;
|
||||
|
||||
str = efl_text_attribute_factory_attribute_get(an);
|
||||
str = efl_text_formatter_attribute_get(an);
|
||||
|
||||
EINA_LIST_FOREACH(sd->anchors, i, anc)
|
||||
{
|
||||
if (anc->annotation == an) break;
|
||||
}
|
||||
|
||||
if (!anc && (efl_text_attribute_factory_attribute_is_item(an) || !strncmp(str, "a ", 2)))
|
||||
if (!anc && (efl_text_formatter_attribute_is_item(an) || !strncmp(str, "a ", 2)))
|
||||
{
|
||||
const char *p;
|
||||
|
||||
|
@ -3304,7 +3304,7 @@ _anchor_get(Eo *obj, Efl_Ui_Textbox_Data *sd, Efl_Text_Attribute_Handle *an)
|
|||
{
|
||||
anc->obj = obj;
|
||||
anc->annotation = an;
|
||||
anc->item = efl_text_attribute_factory_attribute_is_item(an);
|
||||
anc->item = efl_text_formatter_attribute_is_item(an);
|
||||
p = strstr(str, "href=");
|
||||
if (p)
|
||||
{
|
||||
|
@ -3344,7 +3344,7 @@ _anchors_update(Eo *obj, Efl_Ui_Textbox_Data *sd)
|
|||
efl_text_cursor_move(start, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST);
|
||||
efl_text_cursor_move(end, EFL_TEXT_CURSOR_MOVE_TYPE_LAST);
|
||||
|
||||
it = efl_text_attribute_factory_range_attributes_get(start, end);
|
||||
it = efl_text_formatter_range_attributes_get(start, end);
|
||||
efl_del(start);
|
||||
efl_del(end);
|
||||
|
||||
|
@ -3386,7 +3386,7 @@ _anchors_update(Eo *obj, Efl_Ui_Textbox_Data *sd)
|
|||
}
|
||||
|
||||
rect = eina_list_data_get(anc->rects);
|
||||
efl_text_attribute_factory_item_geometry_get(anc->annotation, &cx, &cy, &cw, &ch);
|
||||
efl_text_formatter_item_geometry_get(anc->annotation, &cx, &cy, &cw, &ch);
|
||||
efl_gfx_entity_size_set(rect->obj, EINA_SIZE2D(cw, ch));
|
||||
efl_gfx_entity_position_set(rect->obj,
|
||||
EINA_POSITION2D(off.x + cx, off.y + cy));
|
||||
|
@ -3400,7 +3400,7 @@ _anchors_update(Eo *obj, Efl_Ui_Textbox_Data *sd)
|
|||
size_t count;
|
||||
start = efl_ui_textbox_cursor_create(obj);
|
||||
end = efl_ui_textbox_cursor_create(obj);
|
||||
efl_text_attribute_factory_attribute_cursors_get(anc->annotation, start, end);
|
||||
efl_text_formatter_attribute_cursors_get(anc->annotation, start, end);
|
||||
|
||||
range = efl_text_cursor_range_geometry_get(start, end);
|
||||
count = eina_list_count(eina_iterator_container_get(range));
|
||||
|
|
|
@ -84,7 +84,7 @@ extern "C" {
|
|||
*/
|
||||
#include <canvas/efl_canvas_snapshot.eo.h>
|
||||
#include <canvas/efl_text_cursor.eo.h>
|
||||
#include <canvas/efl_text_attribute_factory.eo.h>
|
||||
#include <canvas/efl_text_formatter.eo.h>
|
||||
#include <canvas/efl_canvas_textblock.eo.h>
|
||||
#include <canvas/efl_canvas_textblock_factory.eo.h>
|
||||
#include <canvas/efl_canvas_vg_node.eo.h>
|
||||
|
|
|
@ -148,7 +148,7 @@ struct _Efl_Canvas_Object_Animation_Event
|
|||
* @{
|
||||
*/
|
||||
#include "canvas/efl_text_cursor.eo.h"
|
||||
#include "canvas/efl_text_attribute_factory.eo.h"
|
||||
#include "canvas/efl_text_formatter.eo.h"
|
||||
#include "canvas/efl_canvas_textblock.eo.h"
|
||||
#include "canvas/efl_canvas_textblock_factory.eo.h"
|
||||
/**
|
||||
|
|
|
@ -322,12 +322,12 @@ EAPI Eina_Bool evas_textblock_cursor_at_cluster_as_single_glyph(Evas_Textblock_C
|
|||
|
||||
|
||||
/*Attribute Factory Internal function*/
|
||||
EAPI const char * efl_text_attribute_factory_attribute_get(Efl_Text_Attribute_Handle *annotation);
|
||||
EAPI Eina_Iterator * efl_text_attribute_factory_range_attributes_get(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
|
||||
EAPI void efl_text_attribute_factory_attribute_cursors_get(const Efl_Text_Attribute_Handle *handle, Efl_Text_Cursor *start, Efl_Text_Cursor *end);
|
||||
EAPI void efl_text_attribute_factory_remove(Efl_Text_Attribute_Handle *annotation);
|
||||
EAPI Eina_Bool efl_text_attribute_factory_attribute_is_item(Efl_Text_Attribute_Handle *annotation);
|
||||
EAPI Eina_Bool efl_text_attribute_factory_item_geometry_get(const Efl_Text_Attribute_Handle *annotation, int *x, int *y, int *w, int *h);
|
||||
EAPI const char * efl_text_formatter_attribute_get(Efl_Text_Attribute_Handle *annotation);
|
||||
EAPI Eina_Iterator * efl_text_formatter_range_attributes_get(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end);
|
||||
EAPI void efl_text_formatter_attribute_cursors_get(const Efl_Text_Attribute_Handle *handle, Efl_Text_Cursor *start, Efl_Text_Cursor *end);
|
||||
EAPI void efl_text_formatter_remove(Efl_Text_Attribute_Handle *annotation);
|
||||
EAPI Eina_Bool efl_text_formatter_attribute_is_item(Efl_Text_Attribute_Handle *annotation);
|
||||
EAPI Eina_Bool efl_text_formatter_item_geometry_get(const Efl_Text_Attribute_Handle *annotation, int *x, int *y, int *w, int *h);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
#include "efl_canvas_textblock_internal.h"
|
||||
#include "efl_text_cursor.eo.h"
|
||||
|
||||
#define MY_CLASS EFL_TEXT_ATTRIBUTE_FACTORY_CLASS
|
||||
#define MY_CLASS EFL_TEXT_FORMATTER_CLASS
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
} Efl_Text_Attribute_Factory_Data;
|
||||
} Efl_Text_Formatter_Data;
|
||||
|
||||
EOLIAN static void
|
||||
_efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
|
||||
_efl_text_formatter_attribute_insert(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end, const char *format)
|
||||
{
|
||||
EINA_SAFETY_ON_TRUE_RETURN(!efl_text_cursor_handle_get(start) ||
|
||||
!efl_text_cursor_handle_get(end) ||
|
||||
|
@ -27,19 +27,19 @@ _efl_text_attribute_factory_attribute_insert(const Efl_Text_Cursor *start, const
|
|||
}
|
||||
|
||||
EOLIAN static unsigned int
|
||||
_efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end)
|
||||
_efl_text_formatter_attribute_clear(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end)
|
||||
{
|
||||
unsigned int ret = 0;
|
||||
Eina_Iterator *annotations;
|
||||
Efl_Text_Attribute_Handle *an;
|
||||
annotations = efl_text_attribute_factory_range_attributes_get(start, end);
|
||||
annotations = efl_text_formatter_range_attributes_get(start, end);
|
||||
|
||||
if (!annotations) return ret;
|
||||
|
||||
EINA_ITERATOR_FOREACH(annotations, an)
|
||||
{
|
||||
ret++;
|
||||
efl_text_attribute_factory_remove(an);
|
||||
efl_text_formatter_remove(an);
|
||||
}
|
||||
eina_iterator_free(annotations);
|
||||
|
||||
|
@ -47,7 +47,7 @@ _efl_text_attribute_factory_attribute_clear(const Efl_Text_Cursor *start, const
|
|||
}
|
||||
|
||||
const char *
|
||||
efl_text_attribute_factory_attribute_get(Efl_Text_Attribute_Handle *annotation)
|
||||
efl_text_formatter_attribute_get(Efl_Text_Attribute_Handle *annotation)
|
||||
{
|
||||
EINA_SAFETY_ON_TRUE_RETURN_VAL(!annotation || !(annotation->obj), NULL);
|
||||
|
||||
|
@ -55,7 +55,7 @@ efl_text_attribute_factory_attribute_get(Efl_Text_Attribute_Handle *annotation)
|
|||
}
|
||||
|
||||
Eina_Iterator *
|
||||
efl_text_attribute_factory_range_attributes_get(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end)
|
||||
efl_text_formatter_range_attributes_get(const Efl_Text_Cursor *start, const Efl_Text_Cursor *end)
|
||||
{
|
||||
Eina_List *lst = NULL;
|
||||
Efl_Text_Attribute_Handle *it;
|
||||
|
@ -86,7 +86,7 @@ efl_text_attribute_factory_range_attributes_get(const Efl_Text_Cursor *start, co
|
|||
}
|
||||
|
||||
void
|
||||
efl_text_attribute_factory_attribute_cursors_get(const Efl_Text_Attribute_Handle *handle, Efl_Text_Cursor *start, Efl_Text_Cursor *end)
|
||||
efl_text_formatter_attribute_cursors_get(const Efl_Text_Attribute_Handle *handle, Efl_Text_Cursor *start, Efl_Text_Cursor *end)
|
||||
{
|
||||
EINA_SAFETY_ON_TRUE_RETURN (!handle || !(handle->obj));
|
||||
|
||||
|
@ -97,7 +97,7 @@ efl_text_attribute_factory_attribute_cursors_get(const Efl_Text_Attribute_Handle
|
|||
}
|
||||
|
||||
void
|
||||
efl_text_attribute_factory_remove(Efl_Text_Attribute_Handle *annotation)
|
||||
efl_text_formatter_remove(Efl_Text_Attribute_Handle *annotation)
|
||||
{
|
||||
EINA_SAFETY_ON_TRUE_RETURN (!annotation || !(annotation->obj));
|
||||
|
||||
|
@ -106,7 +106,7 @@ efl_text_attribute_factory_remove(Efl_Text_Attribute_Handle *annotation)
|
|||
}
|
||||
|
||||
Eina_Bool
|
||||
efl_text_attribute_factory_attribute_is_item(Efl_Text_Attribute_Handle *annotation)
|
||||
efl_text_formatter_attribute_is_item(Efl_Text_Attribute_Handle *annotation)
|
||||
{
|
||||
EINA_SAFETY_ON_TRUE_RETURN_VAL(!annotation || !(annotation->obj), EINA_FALSE);
|
||||
|
||||
|
@ -114,7 +114,7 @@ efl_text_attribute_factory_attribute_is_item(Efl_Text_Attribute_Handle *annotati
|
|||
}
|
||||
|
||||
Eina_Bool
|
||||
efl_text_attribute_factory_item_geometry_get(const Efl_Text_Attribute_Handle *annotation, int *x, int *y, int *w, int *h)
|
||||
efl_text_formatter_item_geometry_get(const Efl_Text_Attribute_Handle *annotation, int *x, int *y, int *w, int *h)
|
||||
{
|
||||
EINA_SAFETY_ON_TRUE_RETURN_VAL(!annotation || !(annotation->obj), EINA_FALSE);
|
||||
|
||||
|
@ -130,4 +130,4 @@ efl_text_attribute_factory_item_geometry_get(const Efl_Text_Attribute_Handle *an
|
|||
return evas_textblock_cursor_format_item_geometry_get(&cur, x, y, w, h);
|
||||
}
|
||||
|
||||
#include "efl_text_attribute_factory.eo.c"
|
||||
#include "efl_text_formatter.eo.c"
|
|
@ -1,7 +1,7 @@
|
|||
import efl_text_types;
|
||||
|
||||
abstract @beta Efl.Text.Attribute.Factory extends Efl.Object {
|
||||
[[Attribute factory API to manage text attributes.
|
||||
abstract @beta Efl.Text.Formatter extends Efl.Object {
|
||||
[[Text Formatter API to manage text formatting(attributes).
|
||||
Use it to insert and remove style attributes (font, size, color, ...) using @Efl.Text.Cursor on EFL Widgets.
|
||||
|
||||
Attributes can be assigned to character ranges, selected using two @Efl.Text.Cursor instances.
|
|
@ -56,7 +56,7 @@ pub_eo_files = [
|
|||
'efl_canvas_event_grabber.eo',
|
||||
'efl_text_cursor.eo',
|
||||
'efl_canvas_textblock.eo',
|
||||
'efl_text_attribute_factory.eo',
|
||||
'efl_text_formatter.eo',
|
||||
'efl_canvas_object_animation.eo',
|
||||
]
|
||||
|
||||
|
@ -210,7 +210,7 @@ evas_src += files([
|
|||
'evas_canvas3d_eet.c',
|
||||
'efl_canvas_object_animation.c',
|
||||
'efl_text_cursor.c',
|
||||
'efl_text_attribute_factory.c'
|
||||
'efl_text_formatter.c'
|
||||
])
|
||||
|
||||
evas_include_directories += include_directories('.')
|
||||
|
|
|
@ -4362,17 +4362,17 @@ EFL_START_TEST(evas_textblock_annotation)
|
|||
|
||||
efl_text_cursor_position_set(start, 0);
|
||||
efl_text_cursor_position_set(end, 3);
|
||||
efl_text_attribute_factory_attribute_insert(start, end, "font_size=80");
|
||||
efl_text_formatter_attribute_insert(start, end, "font_size=80");
|
||||
efl_text_cursor_position_set(start, 1);
|
||||
efl_text_cursor_position_set(end, 2);
|
||||
efl_text_attribute_factory_attribute_insert(start, end, "font=arial");
|
||||
efl_text_formatter_attribute_insert(start, end, "font=arial");
|
||||
efl_text_cursor_position_set(start, 2);
|
||||
efl_text_cursor_position_set(end, 3);
|
||||
efl_text_attribute_factory_attribute_insert(start, end, "color=#fff");
|
||||
efl_text_formatter_attribute_insert(start, end, "color=#fff");
|
||||
|
||||
efl_text_cursor_position_set(start, 0);
|
||||
efl_text_cursor_position_set(end, 3);
|
||||
unsigned int count = efl_text_attribute_factory_attribute_clear(start, end);
|
||||
unsigned int count = efl_text_formatter_attribute_clear(start, end);
|
||||
fail_if(count != 3);
|
||||
}
|
||||
EFL_END_TEST;
|
||||
|
|
Loading…
Reference in New Issue