forked from enlightenment/efl
edje/textblock: Added edje_textblock_style_get() api.
Summary: Now all textblock_style functionality are wrapped under api for easy of optimization. so going forward no one should directly acess the styles from the File . the styles should be acesses by the internal api's provided by edje_textblock_style. Reviewers: Hermet, ali.alzyod, woohyun, kimcinoo Reviewed By: kimcinoo Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9774
This commit is contained in:
parent
14f9782a81
commit
5f70cacd92
|
@ -1700,26 +1700,13 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
|
||||||
if (rp->part->default_desc)
|
if (rp->part->default_desc)
|
||||||
{
|
{
|
||||||
Edje_Part_Description_Text *text;
|
Edje_Part_Description_Text *text;
|
||||||
Edje_Style *stl = NULL;
|
Evas_Textblock_Style *style = NULL;
|
||||||
const char *style;
|
|
||||||
|
|
||||||
text = (Edje_Part_Description_Text *)rp->part->default_desc;
|
text = (Edje_Part_Description_Text *)rp->part->default_desc;
|
||||||
style = edje_string_get(&text->text.style);
|
style = _edje_textblock_style_get(ed, edje_string_get(&text->text.style));
|
||||||
if (style)
|
|
||||||
{
|
|
||||||
Eina_List *l;
|
|
||||||
|
|
||||||
EINA_LIST_FOREACH(ed->file->styles, l, stl)
|
if (evas_object_textblock_style_get(rp->object) != style)
|
||||||
{
|
evas_object_textblock_style_set(rp->object, style);
|
||||||
if ((stl->name) && (!strcmp(stl->name, style))) break;
|
|
||||||
stl = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (stl)
|
|
||||||
{
|
|
||||||
if (evas_object_textblock_style_get(rp->object) != stl->style)
|
|
||||||
evas_object_textblock_style_set(rp->object, stl->style);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_edje_entry_init(ed);
|
_edje_entry_init(ed);
|
||||||
|
|
|
@ -2787,12 +2787,17 @@ void _edje_message_queue_process (void);
|
||||||
void _edje_message_queue_clear (void);
|
void _edje_message_queue_clear (void);
|
||||||
void _edje_message_del (Edje *ed);
|
void _edje_message_del (Edje *ed);
|
||||||
|
|
||||||
|
// Edje object level textblock style api
|
||||||
|
Evas_Textblock_Style * _edje_textblock_style_get(Edje *ed, const char *style);
|
||||||
void _edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep);
|
void _edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep);
|
||||||
void _edje_textblock_styles_del(Edje *ed, Edje_Part *pt);
|
void _edje_textblock_styles_del(Edje *ed, Edje_Part *pt);
|
||||||
void _edje_textblock_style_all_update_text_class(Edje *ed, const char *text_class);
|
|
||||||
|
// Edje File level textblock style api
|
||||||
void _edje_textblock_style_all_update(Edje *ed);
|
void _edje_textblock_style_all_update(Edje *ed);
|
||||||
|
void _edje_textblock_style_all_update_text_class(Edje *ed, const char *text_class);
|
||||||
void _edje_textblock_style_parse_and_fix(Edje_File *edf);
|
void _edje_textblock_style_parse_and_fix(Edje_File *edf);
|
||||||
void _edje_textblock_style_cleanup(Edje_File *edf);
|
void _edje_textblock_style_cleanup(Edje_File *edf);
|
||||||
|
|
||||||
Edje_File *_edje_cache_file_coll_open(const Eina_File *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret, Edje *ed);
|
Edje_File *_edje_cache_file_coll_open(const Eina_File *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret, Edje *ed);
|
||||||
void _edje_cache_coll_clean(Edje_File *edf);
|
void _edje_cache_coll_clean(Edje_File *edf);
|
||||||
void _edje_cache_coll_flush(Edje_File *edf);
|
void _edje_cache_coll_flush(Edje_File *edf);
|
||||||
|
|
|
@ -434,9 +434,8 @@ _edje_part_recalc_single_textblock(FLOAT_T sc,
|
||||||
Evas_Coord tw, th;
|
Evas_Coord tw, th;
|
||||||
const char *text = "";
|
const char *text = "";
|
||||||
const char *style = "";
|
const char *style = "";
|
||||||
Edje_Style *stl = NULL;
|
Evas_Textblock_Style *stl = NULL;
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
Eina_List *l;
|
|
||||||
|
|
||||||
if (chosen_desc->text.id_source >= 0)
|
if (chosen_desc->text.id_source >= 0)
|
||||||
{
|
{
|
||||||
|
@ -484,19 +483,14 @@ _edje_part_recalc_single_textblock(FLOAT_T sc,
|
||||||
if (ep->typedata.text->text) text = ep->typedata.text->text;
|
if (ep->typedata.text->text) text = ep->typedata.text->text;
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_LIST_FOREACH(ed->file->styles, l, stl)
|
|
||||||
{
|
|
||||||
if ((stl->name) && (!strcmp(stl->name, style))) break;
|
|
||||||
stl = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ep->part->scale)
|
if (ep->part->scale)
|
||||||
evas_object_scale_set(ep->object, TO_DOUBLE(sc));
|
evas_object_scale_set(ep->object, TO_DOUBLE(sc));
|
||||||
|
|
||||||
|
stl = _edje_textblock_style_get(ed, style);
|
||||||
if (stl)
|
if (stl)
|
||||||
{
|
{
|
||||||
if (evas_object_textblock_style_get(ep->object) != stl->style)
|
if (evas_object_textblock_style_get(ep->object) != stl)
|
||||||
evas_object_textblock_style_set(ep->object, stl->style);
|
evas_object_textblock_style_set(ep->object, stl);
|
||||||
// FIXME: need to account for editing
|
// FIXME: need to account for editing
|
||||||
if (ep->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
if (ep->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -350,6 +350,31 @@ _edje_textblock_styles_del(Edje *ed, Edje_Part *pt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* returns a evas_textblock style for a given style_string.
|
||||||
|
* does lazy computation of the evas_textblock_style
|
||||||
|
* It will compute and cache it if not computed yet and
|
||||||
|
* will return the final textblock style.
|
||||||
|
*/
|
||||||
|
Evas_Textblock_Style *
|
||||||
|
_edje_textblock_style_get(Edje *ed, const char *style)
|
||||||
|
{
|
||||||
|
if (!style) return NULL;
|
||||||
|
|
||||||
|
Edje_Style *stl = _edje_textblock_style_search(ed, style);
|
||||||
|
|
||||||
|
if (!stl) return NULL;
|
||||||
|
|
||||||
|
/* readonly style naver change */
|
||||||
|
if (stl->readonly) return stl->style;
|
||||||
|
|
||||||
|
/* if style is dirty recompute */
|
||||||
|
if (!stl->cache)
|
||||||
|
_edje_textblock_style_update(ed, stl, EINA_FALSE);
|
||||||
|
|
||||||
|
return stl->style;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Finds all the styles having text class tag as text_class and
|
* Finds all the styles having text class tag as text_class and
|
||||||
* updates them.
|
* updates them.
|
||||||
|
|
Loading…
Reference in New Issue