D("OP_GETINFO %i\n", c->pid);
len = sizeof(Op_Getinfo_Reply);
+ D("... foreach\n");
if (active_images)
eina_hash_foreach(active_images, getinfo_hash_image_cb, &imgs);
+ D("... walk foreach list output\n");
EINA_LIST_FOREACH(cache_images, l, img)
{
imgs = eina_list_append(imgs, img);
}
+ D("... walk image cache\n");
EINA_LIST_FOREACH(imgs, l, img)
{
len += sizeof(Op_Getinfo_Item);
if (img->file.key) len += strlen(img->file.key);
len++;
}
+ D("... malloc msg\n");
msg = malloc(len);
if (msg)
{
unsigned char *p;
+ D("... init msg\n");
memset(msg, 0, len);
p = (unsigned char *)msg;
msg->active.mem_total = 0;
msg->cached.mem_total = 0;
msg->cached.count = 0;
p += sizeof(Op_Getinfo_Reply);
+ D("... walk all imgs\n");
EINA_LIST_FOREACH(imgs, l, img)
{
Op_Getinfo_Item *itt, it;
+ D("... img %p\n", img);
memset(&it, 0, sizeof(Op_Getinfo_Item));
itt = (Op_Getinfo_Item *)p;
it.file_key_size = 0;
it.data_load_time = img->stats.load2;
it.alpha = img->image.alpha;
if (img->image.data)
- it.data_loaded = 1;
+ it.data_loaded = 1;
else
it.data_loaded = 0;
it.active = img->active;
}
it.dead = img->dead;
it.useless = img->useless;
+ D("... memcpy %p %p %i \n",
+ itt, &it, sizeof(Op_Getinfo_Item));
memcpy(itt, &it, sizeof(Op_Getinfo_Item));
+ D("... memcpy done n\n", img);
p += sizeof(Op_Getinfo_Item) + it.file_key_size;
}
+ D("... walk all imgs done\n");
msg->active.mem_total =
(msg->active.mem_total + 1023) / 1024;
msg->cached.mem_total =
}
break;
default:
- D("OP_... UNKNOWN??? %i opcoe: %i\n", c->pid, opcode);
+ D("OP_... UNKNOWN??? %i opcode: %i\n", c->pid, opcode);
break;
}
}
#define NODE_FORMAT 1
struct _Evas_Object_Style_Tag
-{ EINA_INLIST;
+{
+ EINA_INLIST;
char *tag;
char *replace;
};
struct _Evas_Object_Textblock_Node
-{ EINA_INLIST;
+{
+ EINA_INLIST;
char *text;
int type;
int len, alloc;
};
struct _Evas_Object_Textblock_Line
-{ EINA_INLIST;
+{
+ EINA_INLIST;
Evas_Object_Textblock_Item *items;
Evas_Object_Textblock_Format_Item *format_items;
int x, y, w, h;
};
struct _Evas_Object_Textblock_Item
-{ EINA_INLIST;
+{
+ EINA_INLIST;
char *text;
Evas_Object_Textblock_Format *format;
Evas_Object_Textblock_Node *source_node;
};
struct _Evas_Object_Textblock_Format_Item
-{ EINA_INLIST;
+{
+ EINA_INLIST;
const char *item;
Evas_Object_Textblock_Node *source_node;
int x, w;
Evas_Object *obj;
int pos;
Evas_Object_Textblock_Node *node;
+ Eina_Bool eol : 1;
};
struct _Evas_Object_Textblock
}
static void
-_find_layout_item_line_match(Evas_Object *obj, Evas_Object_Textblock_Node *n, int pos, Evas_Object_Textblock_Line **lnr, Evas_Object_Textblock_Item **itr)
+_find_layout_item_line_match(Evas_Object *obj, Evas_Object_Textblock_Node *n, int pos, int eol, Evas_Object_Textblock_Line **lnr, Evas_Object_Textblock_Item **itr)
{
Evas_Object_Textblock_Line *ln;
/* Evas_Object_Textblock_Node *nn; */
o = (Evas_Object_Textblock *)(obj->object_data);
/* EINA_INLIST_FOREACH(o->nodes, nn) */
/* ; */
+ if ((eol) && (n->type == NODE_TEXT))
+ {
+ int pos2 = pos;
+
+ evas_common_font_utf8_get_prev(n->text, &pos2);
+ if (pos2 < pos) pos = pos2;
+ }
EINA_INLIST_FOREACH(o->lines, ln)
{
Evas_Object_Textblock_Format_Item *fit;
cur->obj = obj;
cur->node = o->nodes;
cur->pos = 0;
+ cur->eol = 0;
o->cursors = eina_list_append(o->cursors, cur);
return cur;
}
o = (Evas_Object_Textblock *)(cur->obj->object_data);
cur->node = o->nodes;
cur->pos = 0;
+ cur->eol = 0;
}
/**
{
cur->node = (Evas_Object_Textblock_Node *)((EINA_INLIST_GET(o->nodes))->last);
cur->pos = 0;
+ cur->eol = 0; // 1
evas_textblock_cursor_char_last(cur);
}
else
{
cur->node = NULL;
cur->pos = 0;
+ cur->eol = 0; // 1
}
}
{
cur->node = (Evas_Object_Textblock_Node *)((EINA_INLIST_GET(cur->node))->next);
cur->pos = 0;
+ cur->eol = 0;
return 1;
}
return 0;
{
Evas_Object_Textblock *o;
int index, tindex, ch;
+ int at_start_of_line = 0;
if (!cur) return 0;
o = (Evas_Object_Textblock *)(cur->obj->object_data);
if (cur->node->type == NODE_FORMAT) return 0;
if (!cur->node->text) return 0;
index = cur->pos;
+
+ if (cur->node->type == NODE_TEXT)
+ {
+ Evas_Object_Textblock_Line *ln = NULL;
+ Evas_Object_Textblock_Item *it = NULL;
+ int pos;
+
+ _find_layout_item_line_match(cur->obj, cur->node, cur->pos, cur->eol, &ln, &it);
+ pos = cur->pos - it->source_pos;
+ if (pos <= 0) index -= pos;
+ }
+
ch = evas_common_font_utf8_get_next((unsigned char *)(cur->node->text), &index);
if ((ch == 0) || (index < 0)) return 0;
if (cur->node->text[index] == 0) return 0;
tindex = index;
cur->pos = index;
+ cur->eol = 0; // 1
return 1;
}
{
Evas_Object_Textblock *o;
int index, ch;
+ int at_end_of_line = 0;
+ int at_start_of_line = 0;
if (!cur) return 0;
o = (Evas_Object_Textblock *)(cur->obj->object_data);
if (!cur->node->text) return 0;
index = cur->pos;
if (index == 0) return 0;
+
+ // XXX: FIXME: determine at_end_of_line and at_start_of_line
+
+ if (cur->node->type == NODE_TEXT)
+ {
+ Evas_Object_Textblock_Line *ln = NULL;
+ Evas_Object_Textblock_Item *it = NULL;
+ int pos;
+
+ _find_layout_item_line_match(cur->obj, cur->node, cur->pos, cur->eol, &ln, &it);
+ if (it)
+ {
+ pos = cur->pos - it->source_pos;
+ if (pos <= 0) at_start_of_line = 1;
+ if (it->text)
+ {
+ int plast;
+
+ plast = evas_common_font_utf8_get_last(it->text, strlen(it->text));
+ if ((index - it->source_pos) == plast) at_end_of_line = 1;
+ }
+ }
+ }
+
+ if ((cur->eol) && (at_end_of_line))
+ {
+ cur->eol = 0;
+ return 1;
+ }
ch = evas_common_font_utf8_get_prev((unsigned char *)(cur->node->text), &index);
if (/*(ch == 0) || */(index < 0)) return 0;
cur->pos = index;
+ if (at_start_of_line)
+ cur->eol =1;
+ else
+ cur->eol = 0;
return 1;
}
{
if (!cur) return;
cur->pos = 0;
+ cur->eol = 0;
}
/**
index = evas_common_font_utf8_get_last((unsigned char *)cur->node->text, cur->node->len);
if (index < 0) cur->pos = 0;
cur->pos = index;
+ cur->eol = 0; // 1
}
/**
if (!cur->node) return;
o = (Evas_Object_Textblock *)(cur->obj->object_data);
if (!o->formatted.valid) _relayout(cur->obj);
+ cur->eol = 0;
if (cur->node->type == NODE_FORMAT)
_find_layout_format_item_line_match(cur->obj, cur->node, &ln, &fi);
else
- _find_layout_item_line_match(cur->obj, cur->node, cur->pos, &ln, &it);
+ _find_layout_item_line_match(cur->obj, cur->node, cur->pos, cur->eol, &ln, &it);
if (!ln) return;
it = (Evas_Object_Textblock_Item *)ln->items;
fi = (Evas_Object_Textblock_Format_Item *)ln->format_items;
if (!cur->node) return;
o = (Evas_Object_Textblock *)(cur->obj->object_data);
if (!o->formatted.valid) _relayout(cur->obj);
+ cur->eol = 1;
if (cur->node->type == NODE_FORMAT)
_find_layout_format_item_line_match(cur->obj, cur->node, &ln, &fi);
else
- _find_layout_item_line_match(cur->obj, cur->node, cur->pos, &ln, &it);
+ _find_layout_item_line_match(cur->obj, cur->node, cur->pos, cur->eol, &ln, &it);
if (!ln) return;
if (ln->items)
it = (Evas_Object_Textblock_Item *)((EINA_INLIST_GET(ln->items))->last);
else if (fi)
{
cur->pos = 0;
+ cur->eol = 0;
cur->node = fi->source_node;
}
}
if (pos < 0) pos = 0;
else if (pos > cur->node->len) pos = cur->node->len;
cur->pos = pos;
+ cur->eol = 0;
}
/**
if (it)
{
cur->pos = it->source_pos;
+ cur->eol = 0;
cur->node = it->source_node;
}
else if (fi)
{
cur->pos = 0;
+ cur->eol = 0;
cur->node = fi->source_node;
}
+ cur->eol = 0;
return 1;
}
{
if (cur1->pos < cur2->pos) return -1; /* cur1 < cur2 */
else if (cur1->pos > cur2->pos) return 1; /* cur2 < cur1 */
- return 0; /* cur1 == cur2 */
+ if ((cur1->eol) == (cur1->eol)) return 0; /* cur1 == cur2 */
+ if (cur1->eol) return 1; /* cur2 < cur1 */
+ return -1; /* cur1 < cur2 */
}
for (l1 = EINA_INLIST_GET(cur1->node),
- l2 = EINA_INLIST_GET(cur1->node); (l1) || (l2);)
+ l2 = EINA_INLIST_GET(cur1->node); (l1) || (l2);)
{
if (l1 == EINA_INLIST_GET(cur2->node)) return 1; /* cur2 < cur 1 */
else if (l2 == EINA_INLIST_GET(cur2->node)) return -1; /* cur1 < cur 2 */
if (cur->obj != cur_dest->obj) return;
cur_dest->pos = cur->pos;
cur_dest->node = cur->node;
+ cur_dest->eol = cur->eol;
}
n->text = _strbuf_append(n->text, (char *)text, &(n->len), &(n->alloc));
else
n->text = _strbuf_insert(n->text, (char *)text, cur->pos, &(n->len), &(n->alloc));
+// XXX: This makes no sense?
cur->pos += strlen(text);
o->formatted.valid = 0;
o->native.valid = 0;
}
}
cur->node = n;
+// XXX: This makes no sense
cur->pos = 0;
o->formatted.valid = 0;
o->native.valid = 0;
{
o->cursor->node = cur->node;
o->cursor->pos = cur->pos;
+ o->cursor->eol = cur->eol;
}
}
EINA_LIST_FOREACH(o->cursors, l, data)
{
data->node = cur->node;
data->pos = cur->pos;
+ data->eol = cur->eol;
}
}
}
}
else
{
- _find_layout_item_line_match(cur->obj, cur->node, cur->pos, &ln, &it);
+ _find_layout_item_line_match(cur->obj, cur->node, cur->pos, cur->eol, &ln, &it);
}
if (!ln)
{
{
pos = cur->pos - it->source_pos;
ret = -1;
+ if (cur->eol)
+ {
+ int pos2;
+
+ pos2 = pos;
+ evas_common_font_utf8_get_next((unsigned char *)(it->text), &pos2);
+ if (pos2 > pos) pos = pos2;
+ }
+ if (pos < 0) pos = 0;
if (it->format->font.font)
ret = cur->ENFN->font_char_coords_get(cur->ENDT, it->format->font.font,
it->text,
if (cur->node->type == NODE_FORMAT)
_find_layout_format_item_line_match(cur->obj, cur->node, &ln, &fi);
else
- _find_layout_item_line_match(cur->obj, cur->node, cur->pos, &ln, &it);
+ _find_layout_item_line_match(cur->obj, cur->node, cur->pos, cur->eol, &ln, &it);
if (!ln) return -1;
x = ln->x;
y = ln->y;
if (((fi->x + ln->x) <= x) && (((fi->x + ln->x) + fi->w) > x))
{
cur->pos = 0;
+ cur->eol = 0;
cur->node = fi->source_node;
return 1;
}
{
it = it_break;
cur->pos = it->source_pos;
+ cur->eol = 0;
cur->node = it->source_node;
return 1;
}
return rects;
}
+EAPI Eina_Bool
+evas_textblock_cursor_eol_get(const Evas_Textblock_Cursor *cur)
+{
+ if (!cur) return 0;
+ return cur->eol;
+}
+
+EAPI void
+evas_textblock_cursor_eol_set(Evas_Textblock_Cursor *cur, Eina_Bool eol)
+{
+ if (!cur) return;
+ cur->eol = eol;
+}
+
+
/* general controls */
/**
* to be documented.
_nodes_clear(obj);
o->cursor->node = NULL;
o->cursor->pos = 0;
+ o->cursor->eol = 0;
EINA_LIST_FOREACH(o->cursors, l, cur)
{
cur->node = NULL;
cur->pos = 0;
+ cur->eol = 0;
}
if (o->lines)
{