forked from enlightenment/efl
Evas textblock: Stringshare the style text of each style.
SVN revision: 57295
This commit is contained in:
parent
28ee865391
commit
38bf6ec94c
|
@ -394,7 +394,7 @@ struct _Evas_Object_Textblock_Format
|
||||||
|
|
||||||
struct _Evas_Textblock_Style
|
struct _Evas_Textblock_Style
|
||||||
{
|
{
|
||||||
char *style_text;
|
const char *style_text;
|
||||||
char *default_tag;
|
char *default_tag;
|
||||||
Evas_Object_Style_Tag *tags;
|
Evas_Object_Style_Tag *tags;
|
||||||
Eina_List *objects;
|
Eina_List *objects;
|
||||||
|
@ -520,13 +520,14 @@ static void _evas_textblock_cursors_set_node(Evas_Object_Textblock *o, const Eva
|
||||||
/* styles */
|
/* styles */
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
* Clears the textblock style passed.
|
* Clears the textblock style passed except for the style_text which is replaced.
|
||||||
* @param ts The ts to be cleared. Must not be NULL.
|
* @param ts The ts to be cleared. Must not be NULL.
|
||||||
|
* @param style_text the style's text.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
_style_clear(Evas_Textblock_Style *ts)
|
_style_replace(Evas_Textblock_Style *ts, const char *style_text)
|
||||||
{
|
{
|
||||||
if (ts->style_text) free(ts->style_text);
|
eina_stringshare_replace(&ts->style_text, style_text);
|
||||||
if (ts->default_tag) free(ts->default_tag);
|
if (ts->default_tag) free(ts->default_tag);
|
||||||
while (ts->tags)
|
while (ts->tags)
|
||||||
{
|
{
|
||||||
|
@ -538,11 +539,21 @@ _style_clear(Evas_Textblock_Style *ts)
|
||||||
free(tag->replace);
|
free(tag->replace);
|
||||||
free(tag);
|
free(tag);
|
||||||
}
|
}
|
||||||
ts->style_text = NULL;
|
|
||||||
ts->default_tag = NULL;
|
ts->default_tag = NULL;
|
||||||
ts->tags = NULL;
|
ts->tags = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* Clears the textblock style passed.
|
||||||
|
* @param ts The ts to be cleared. Must not be NULL.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
_style_clear(Evas_Textblock_Style *ts)
|
||||||
|
{
|
||||||
|
_style_replace(ts, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
* Searches inside the tags stored in the style for the tag who's
|
* Searches inside the tags stored in the style for the tag who's
|
||||||
|
@ -3900,14 +3911,13 @@ evas_textblock_style_set(Evas_Textblock_Style *ts, const char *text)
|
||||||
_evas_textblock_text_node_changed(o, obj, NULL);
|
_evas_textblock_text_node_changed(o, obj, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
_style_clear(ts);
|
_style_replace(ts, text);
|
||||||
if (text) ts->style_text = strdup(text);
|
|
||||||
|
|
||||||
if (ts->style_text)
|
if (ts->style_text)
|
||||||
{
|
{
|
||||||
// format MUST be KEY='VALUE'[KEY='VALUE']...
|
// format MUST be KEY='VALUE'[KEY='VALUE']...
|
||||||
char *p;
|
const char *p;
|
||||||
char *key_start, *key_stop, *val_start, *val_stop;
|
const char *key_start, *key_stop, *val_start, *val_stop;
|
||||||
|
|
||||||
key_start = key_stop = val_start = val_stop = NULL;
|
key_start = key_stop = val_start = val_stop = NULL;
|
||||||
p = ts->style_text;
|
p = ts->style_text;
|
||||||
|
|
Loading…
Reference in New Issue