Evas_Object_Textblock_Node_Format *format_node;
Evas_BiDi_Paragraph_Props *bidi_props;
Eina_Bool dirty : 1;
+ Eina_Bool new : 1;
};
struct _Evas_Object_Textblock_Node_Format
static void _evas_textblock_node_format_remove(Evas_Object_Textblock *o, Evas_Object_Textblock_Node_Format *n, int visual_adjustment);
static void _evas_textblock_node_format_free(Evas_Object_Textblock_Node_Format *n);
static void _evas_textblock_node_text_free(Evas_Object_Textblock_Node_Text *n);
-static void _evas_textblock_text_node_changed(Evas_Object_Textblock *o, Evas_Object *obj, Evas_Object_Textblock_Node_Text *n);
+static void _evas_textblock_changed(Evas_Object_Textblock *o, Evas_Object *obj);
static void _evas_textblock_cursors_update_offset(const Evas_Textblock_Cursor *cur, const Evas_Object_Textblock_Node_Text *n, size_t start, int offset);
static void _evas_textblock_cursors_set_node(Evas_Object_Textblock *o, const Evas_Object_Textblock_Node_Text *n, Evas_Object_Textblock_Node_Text *new_node);
if (o->content_changed)
{
+ /* FIXME-tom: Add some logic to redo only the dirty nodes */
_paragraphs_free(obj, o->paragraphs);
/* Go through all the text nodes to create the logical layout */
EINA_INLIST_FOREACH(c->o->text_nodes, n)
size_t start;
int off;
- n->dirty = 0; /* Mark as if we cleaned the paragraph, although
- we should really use it to fine tune the
- changes here, and not just blindly mark */
+ /* Mark as if we cleaned the paragraph, although
+ we should really use it to fine tune the
+ changes here, and not just blindly mark */
+ n->new = EINA_FALSE;
+ n->dirty = EINA_FALSE;
+
_layout_paragraph_new(c, n); /* Each node is a paragraph */
/* For each text node to thorugh all of it's format nodes
Evas_Object_Textblock *o;
o = (Evas_Object_Textblock *)(obj->object_data);
- _evas_textblock_text_node_changed(o, obj, NULL);
+ _evas_textblock_changed(o, obj);
+ /* FIXME-tom: Update the affected nodes. */
}
_style_replace(ts, text);
}
o->style = ts;
- _evas_textblock_text_node_changed(o, obj, NULL);
+ _evas_textblock_changed(o, obj);
+ /* FIXME-tom: Update the affected nodes */
}
/**
if (o->repch) eina_stringshare_del(o->repch);
if (ch) o->repch = eina_stringshare_add(ch);
else o->repch = NULL;
- _evas_textblock_text_node_changed(o, obj, NULL);
+ _evas_textblock_changed(o, obj);
+ /* FIXME-tom: Invalidate all the nodes */
}
/**
else if (align > 1.0) align = 1.0;
if (o->valign == align) return;
o->valign = align;
- _evas_textblock_text_node_changed(o, obj, NULL);
+ _evas_textblock_changed(o, obj);
}
/**
p++;
}
}
- _evas_textblock_text_node_changed(o, obj, o->cursor->node);
+ _evas_textblock_changed(o, obj);
+ /* If the node is NULL it means we just created paragraphs,
+ * and not edited, so no need to mark anything */
+ if (o->cursor->node)
+ o->cursor->node->dirty = EINA_TRUE;
}
/* pnode can never be visible! (it's the closing format) */
_evas_textblock_node_format_remove(o, pnode, 0);
}
- _evas_textblock_text_node_changed(o, obj, tnode);
+ _evas_textblock_changed(o, obj);
+ /* FIXME-tom: Add invalidation point? make the node? can't tell */
}
/**
n->unicode = eina_ustrbuf_new();
/* We want to layout each paragraph at least once. */
n->dirty = EINA_TRUE;
+ n->new = EINA_TRUE;
#ifdef BIDI_SUPPORT
n->bidi_props = evas_bidi_paragraph_props_new();
n->bidi_props->direction = EVAS_BIDI_PARAGRAPH_NATURAL;
/**
* @internal
- * Mark and notifiy that the textblock, and specifically a node has changed.
+ * Mark that the textblock has changed.
*
* @param o the textblock object.
* @param obj the evas object.
- * @param n the paragraph that changed - NULL means all.
*/
static void
-_evas_textblock_text_node_changed(Evas_Object_Textblock *o, Evas_Object *obj,
- Evas_Object_Textblock_Node_Text *n)
+_evas_textblock_changed(Evas_Object_Textblock *o, Evas_Object *obj)
{
- if (!n)
- {
- Evas_Object_Textblock_Node_Text *itr;
- EINA_INLIST_FOREACH(EINA_INLIST_GET(o->text_nodes), itr)
- {
- itr->dirty = EINA_TRUE;
- }
- }
- else
- {
- n->dirty = EINA_TRUE;
- }
o->formatted.valid = 0;
o->native.valid = 0;
o->content_changed = 1;
evas_bidi_paragraph_props_unref(n->bidi_props);
n->bidi_props = evas_bidi_paragraph_props_get(eina_ustrbuf_string_get(n->unicode));
#endif
- _evas_textblock_text_node_changed(o, cur->obj, n);
+ _evas_textblock_changed(o, cur->obj);
+ n->dirty = EINA_TRUE;
free(text);
return len;
}
eina_ustrbuf_insert_char(cur->node->unicode,
EVAS_TEXTBLOCK_REPLACEMENT_CHAR, cur->pos);
+ /* Mark as dirty */
+ cur->node->dirty = EINA_TRUE;
+
/* Advance all the cursors after our cursor */
_evas_textblock_cursors_update_offset(cur, cur->node, cur->pos, 1);
if (_IS_PARAGRAPH_SEPARATOR(o, format))
}
}
- _evas_textblock_text_node_changed(o, cur->obj, cur->node);
+ _evas_textblock_changed(o, cur->obj);
+ /* FIXME-tom: Add invalidation point */
return is_visible;
}
}
_evas_textblock_cursors_update_offset(cur, n, ppos, -(index - ppos));
- _evas_textblock_text_node_changed(o, cur->obj, cur->node);
+ _evas_textblock_changed(o, cur->obj);
+ cur->node->dirty = EINA_TRUE;
}
/**
if (reset_cursor)
evas_textblock_cursor_copy(cur1, o->cursor);
- _evas_textblock_text_node_changed(o, cur1->obj, cur1->node);
+ _evas_textblock_changed(o, cur1->obj);
+ /* FIXME-tom: Should mark here as dirty! */
}
_paragraphs_free(obj, o->paragraphs);
o->paragraphs = NULL;
}
- _evas_textblock_text_node_changed(o, obj, NULL);
+ _evas_textblock_changed(o, obj);
}
/**
}
}
}
- _evas_textblock_text_node_changed(o, obj, NULL);
+ _evas_textblock_changed(o, obj);
+ /* FIXME-tom: invalidate all the text nodes */
}
/**