st_collections_group_parts_part_description_text_filter(void)
{
Edje_Part_Description_Text *ed;
+ Eina_List *sources = NULL;
+ Eina_Stringshare *name;
+ char *token, *code;
+ Eina_Bool valid = EINA_TRUE;
+
+ static const char *allowed_name_chars =
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHJIKLMNOPQRSTUVWXYZ0123456789_";
check_arg_count(1);
}
ed = (Edje_Part_Description_Text*) current_desc;
+ ed->text.filter_sources = NULL;
ed->text.filter.str = parse_str(0);
+ if (!ed->text.filter.str) return;
+
+ // Parse list of buffers that have a source
+ // note: does not support comments
+ code = strdup(ed->text.filter.str);
+ for (token = strtok(code, ";"); token; token = strtok(NULL, ";"))
+ {
+ size_t len;
+
+ len = strspn(token, " \n\t");
+ token += len;
+
+ if (!strncasecmp("buffer", token, 6))
+ {
+ // note: a valid string won't necessary compile at runtime
+
+ token = strchr(token, ':');
+ if (!token)
+ {
+ valid = EINA_FALSE;
+ break;
+ }
+ token = strchr(token, '(');
+ if (!token)
+ {
+ valid = EINA_FALSE;
+ break;
+ }
+ token = strcasestr(token, "src");
+ if (!token) continue;
+ token += 3;
+ len = strspn(token, " =\n\t");
+ if (!len || !token[len])
+ {
+ valid = EINA_FALSE;
+ break;
+ }
+ token += len;
+ len = strspn(token, allowed_name_chars);
+ if (!len || !token[len])
+ {
+ valid = EINA_FALSE;
+ break;
+ }
+ token[len] = '\0';
+ name = eina_stringshare_add(token);
+
+ sources = eina_list_append(sources, name);
+ }
+ }
+ free(code);
+
+ if (valid) ed->text.filter_sources = sources;
}
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.id_text_source", text.id_text_source, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.elipsis", text.elipsis, EET_T_DOUBLE);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.filter", text.filter, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_LIST_STRING(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.filter_sources", text.filter_sources);
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Text);
eddc.func.mem_free = mem_free_textblock;
Edje_String font; /* if a specific font is asked for */
Edje_String repch; /* replacement char for password mode entry */
Edje_String filter; /* special effects */
+ Eina_List *filter_sources; /* proxy sources for special effects */
Edje_Alignment align; /* text alignment within bounds */
Edje_Color color3;
const char *font; // 4
const char *style; // 4
const char *filter; // 4
+ Eina_List *filter_sources; // 4
Edje_Position offset; // 8
short size; // 2
struct {
const char *out_str; // 4
FLOAT_T align_x, align_y; // 16
} cache;
-}; // 76
+}; // 84
// FIXME make text a potiner to struct and alloc at end
// if part type is TEXT move common members textblock +
// text to front and have smaller struct for textblock
char *font2 = NULL;
char *sfont = NULL;
int size;
- const char *filter;
+ const char *filter, *source_name;
+ Eina_List *filter_sources = NULL, *prev_sources = NULL, *li;
Evas_Coord tw, th;
Evas_Coord sw, sh;
int inlined_font = 0, free_text = 0;
if (ep->typedata.text->font) font = ep->typedata.text->font;
if (ep->typedata.text->size > 0) size = ep->typedata.text->size;
if (ep->typedata.text->filter) filter = ep->typedata.text->filter;
+ if (ep->typedata.text->filter_sources != chosen_desc->text.filter_sources)
+ {
+ prev_sources = ep->typedata.text->filter_sources;
+ filter_sources = chosen_desc->text.filter_sources;
+ ep->typedata.text->filter_sources = chosen_desc->text.filter_sources;
+ }
if (ep->typedata.text->text_source)
{
if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
eo_do(ep->object,
evas_obj_text_font_set(font, size),
- evas_obj_text_filter_program_set(filter),
evas_obj_text_text_set(text));
part_get_geometry(ep, &tw, &th);
+
+ /* filters */
+ EINA_LIST_FOREACH(prev_sources, li, source_name)
+ eo_do(ep->object, evas_obj_text_filter_source_set(source_name, NULL));
+ EINA_LIST_FOREACH(filter_sources, li, source_name)
+ {
+ Edje_Real_Part *rp = _edje_real_part_get(ed, source_name);
+ eo_do(ep->object, evas_obj_text_filter_source_set(source_name, rp ? rp->object : NULL));
+ }
+ eo_do(ep->object, evas_obj_text_filter_program_set(filter));
+
/* Handle alignment */
{
FLOAT_T align_x;