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,93 +896,89 @@ _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))
|
anchors_a = evas_textblock_node_format_list_get(o, "a");
|
||||||
|
anchors_item = evas_textblock_node_format_list_get(o, "item");
|
||||||
|
|
||||||
|
if (anchors_a)
|
||||||
{
|
{
|
||||||
const char *s;
|
const Evas_Object_Textblock_Node_Format *node;
|
||||||
|
const Eina_List *itr;
|
||||||
s = evas_textblock_node_format_text_get(node);
|
EINA_LIST_FOREACH(anchors_a, itr, node)
|
||||||
if (s)
|
|
||||||
{
|
{
|
||||||
if ((!strncmp(s, "+ a ", 4)) || (!strncmp(s, "+a ", 3)))
|
const char *s = evas_textblock_node_format_text_get(node);
|
||||||
{
|
char *p;
|
||||||
an = calloc(1, sizeof(Anchor));
|
an = calloc(1, sizeof(Anchor));
|
||||||
if (an)
|
if (!an)
|
||||||
{
|
break;
|
||||||
char *p;
|
|
||||||
|
|
||||||
an->en = en;
|
an->en = en;
|
||||||
p = strstr(s, "href=");
|
p = strstr(s, "href=");
|
||||||
if (p)
|
if (p)
|
||||||
{
|
|
||||||
an->name = strdup(p + 5);
|
|
||||||
}
|
|
||||||
en->anchors = eina_list_append(en->anchors, an);
|
|
||||||
an->start = 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_copy(an->start, an->end);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((!strcmp(s, "- a")) || (!strcmp(s, "-a")))
|
|
||||||
{
|
{
|
||||||
/* Close the anchor, if the anchor was without text, free it as well */
|
an->name = strdup(p + 5);
|
||||||
if (an)
|
|
||||||
{
|
|
||||||
evas_textblock_cursor_at_format_set(an->end, node);
|
|
||||||
if (!evas_textblock_cursor_compare(an->start, an->end))
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (!strncmp(s, "+ item ", 7))
|
en->anchors = eina_list_append(en->anchors, an);
|
||||||
{
|
an->start = evas_object_textblock_cursor_new(o);
|
||||||
an = calloc(1, sizeof(Anchor));
|
an->end = evas_object_textblock_cursor_new(o);
|
||||||
if (an)
|
evas_textblock_cursor_at_format_set(an->start, node);
|
||||||
{
|
evas_textblock_cursor_copy(an->start, an->end);
|
||||||
char *p;
|
|
||||||
|
|
||||||
an->en = en;
|
/* Close the anchor, if the anchor was without text,
|
||||||
an->item = 1;
|
* free it as well */
|
||||||
p = strstr(s, "href=");
|
node = evas_textblock_node_format_next_get(node);
|
||||||
if (p)
|
for (; node; node = evas_textblock_node_format_next_get(node))
|
||||||
{
|
|
||||||
an->name = strdup(p + 5);
|
|
||||||
}
|
|
||||||
en->anchors = eina_list_append(en->anchors, an);
|
|
||||||
an->start = 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_copy(an->start, an->end);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((!strcmp(s, "- item")) || (!strcmp(s, "-item")))
|
|
||||||
{
|
{
|
||||||
if (an)
|
s = evas_textblock_node_format_text_get(node);
|
||||||
{
|
if ((!strcmp(s, "- a")) || (!strcmp(s, "-a")))
|
||||||
/*
|
break;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (node)
|
||||||
|
{
|
||||||
|
evas_textblock_cursor_at_format_set(an->end, node);
|
||||||
|
}
|
||||||
|
else if (!evas_textblock_cursor_compare(an->start, an->end))
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anchors_item)
|
||||||
|
{
|
||||||
|
const Evas_Object_Textblock_Node_Format *node;
|
||||||
|
const Eina_List *itr;
|
||||||
|
EINA_LIST_FOREACH(anchors_item, itr, node)
|
||||||
|
{
|
||||||
|
const char *s = evas_textblock_node_format_text_get(node);
|
||||||
|
char *p;
|
||||||
|
an = calloc(1, sizeof(Anchor));
|
||||||
|
if (!an)
|
||||||
|
break;
|
||||||
|
|
||||||
|
an->en = en;
|
||||||
|
an->item = 1;
|
||||||
|
p = strstr(s, "href=");
|
||||||
|
if (p)
|
||||||
|
{
|
||||||
|
an->name = strdup(p + 5);
|
||||||
|
}
|
||||||
|
en->anchors = eina_list_append(en->anchors, an);
|
||||||
|
an->start = 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_copy(an->start, an->end);
|
||||||
|
/* Although needed in textblock, don't bother with finding the end
|
||||||
|
* here cause it doesn't really matter. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue