forked from enlightenment/efl
Edje entry: Use the new textblock _format_list_get in anchors_get.
SVN revision: 59326
This commit is contained in:
parent
13d032d0b1
commit
e20db04ef0
|
@ -896,24 +896,24 @@ _anchors_clear(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, E
|
||||||
static void
|
static void
|
||||||
_anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
|
_anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
|
||||||
{
|
{
|
||||||
const Evas_Object_Textblock_Node_Format *node;
|
const Eina_List *anchors_a, *anchors_item;
|
||||||
Anchor *an = NULL;
|
Anchor *an = NULL;
|
||||||
|
|
||||||
_anchors_clear(c, o, en);
|
_anchors_clear(c, o, en);
|
||||||
node = evas_textblock_node_format_first_get(o);
|
|
||||||
for (; node; node = evas_textblock_node_format_next_get(node))
|
|
||||||
{
|
|
||||||
const char *s;
|
|
||||||
|
|
||||||
s = evas_textblock_node_format_text_get(node);
|
anchors_a = evas_textblock_node_format_list_get(o, "a");
|
||||||
if (s)
|
anchors_item = evas_textblock_node_format_list_get(o, "item");
|
||||||
|
|
||||||
|
if (anchors_a)
|
||||||
{
|
{
|
||||||
if ((!strncmp(s, "+ a ", 4)) || (!strncmp(s, "+a ", 3)))
|
const Evas_Object_Textblock_Node_Format *node;
|
||||||
{
|
const Eina_List *itr;
|
||||||
an = calloc(1, sizeof(Anchor));
|
EINA_LIST_FOREACH(anchors_a, itr, node)
|
||||||
if (an)
|
|
||||||
{
|
{
|
||||||
|
const char *s = evas_textblock_node_format_text_get(node);
|
||||||
char *p;
|
char *p;
|
||||||
|
an = calloc(1, sizeof(Anchor));
|
||||||
|
if (!an)
|
||||||
|
break;
|
||||||
|
|
||||||
an->en = en;
|
an->en = en;
|
||||||
p = strstr(s, "href=");
|
p = strstr(s, "href=");
|
||||||
|
@ -926,15 +926,22 @@ _anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
|
||||||
an->end = evas_object_textblock_cursor_new(o);
|
an->end = evas_object_textblock_cursor_new(o);
|
||||||
evas_textblock_cursor_at_format_set(an->start, node);
|
evas_textblock_cursor_at_format_set(an->start, node);
|
||||||
evas_textblock_cursor_copy(an->start, an->end);
|
evas_textblock_cursor_copy(an->start, an->end);
|
||||||
}
|
|
||||||
}
|
/* Close the anchor, if the anchor was without text,
|
||||||
else if ((!strcmp(s, "- a")) || (!strcmp(s, "-a")))
|
* free it as well */
|
||||||
|
node = evas_textblock_node_format_next_get(node);
|
||||||
|
for (; node; node = evas_textblock_node_format_next_get(node))
|
||||||
{
|
{
|
||||||
/* Close the anchor, if the anchor was without text, free it as well */
|
s = evas_textblock_node_format_text_get(node);
|
||||||
if (an)
|
if ((!strcmp(s, "- a")) || (!strcmp(s, "-a")))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node)
|
||||||
{
|
{
|
||||||
evas_textblock_cursor_at_format_set(an->end, node);
|
evas_textblock_cursor_at_format_set(an->end, node);
|
||||||
if (!evas_textblock_cursor_compare(an->start, an->end))
|
}
|
||||||
|
else if (!evas_textblock_cursor_compare(an->start, an->end))
|
||||||
{
|
{
|
||||||
if (an->name) free(an->name);
|
if (an->name) free(an->name);
|
||||||
evas_textblock_cursor_free(an->start);
|
evas_textblock_cursor_free(an->start);
|
||||||
|
@ -945,12 +952,18 @@ _anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
|
||||||
an = NULL;
|
an = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strncmp(s, "+ item ", 7))
|
|
||||||
|
if (anchors_item)
|
||||||
{
|
{
|
||||||
an = calloc(1, sizeof(Anchor));
|
const Evas_Object_Textblock_Node_Format *node;
|
||||||
if (an)
|
const Eina_List *itr;
|
||||||
|
EINA_LIST_FOREACH(anchors_item, itr, node)
|
||||||
{
|
{
|
||||||
|
const char *s = evas_textblock_node_format_text_get(node);
|
||||||
char *p;
|
char *p;
|
||||||
|
an = calloc(1, sizeof(Anchor));
|
||||||
|
if (!an)
|
||||||
|
break;
|
||||||
|
|
||||||
an->en = en;
|
an->en = en;
|
||||||
an->item = 1;
|
an->item = 1;
|
||||||
|
@ -964,25 +977,8 @@ _anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
|
||||||
an->end = evas_object_textblock_cursor_new(o);
|
an->end = evas_object_textblock_cursor_new(o);
|
||||||
evas_textblock_cursor_at_format_set(an->start, node);
|
evas_textblock_cursor_at_format_set(an->start, node);
|
||||||
evas_textblock_cursor_copy(an->start, an->end);
|
evas_textblock_cursor_copy(an->start, an->end);
|
||||||
}
|
/* Although needed in textblock, don't bother with finding the end
|
||||||
}
|
* here cause it doesn't really matter. */
|
||||||
else if ((!strcmp(s, "- item")) || (!strcmp(s, "-item")))
|
|
||||||
{
|
|
||||||
if (an)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
if (!firsttext)
|
|
||||||
{
|
|
||||||
if (an->name) free(an->name);
|
|
||||||
evas_textblock_cursor_free(an->start);
|
|
||||||
evas_textblock_cursor_free(an->end);
|
|
||||||
en->anchors = eina_list_remove(en->anchors, an);
|
|
||||||
free(an);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
an = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue