summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-02-05 15:36:05 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-02-07 17:33:18 +0900
commit08f2624e6a0421962fbd2e05cb37beb7b23befd7 (patch)
treece1248beef9d9a3fc402393ae4d5dd62b7e8db54 /src
parente112d49e0b73e9a081aa515141582ff42d74afd5 (diff)
Evas filters: Implement basic Edje support
Does not support proxies yet. Implemented as "filter" field in a part.description.text (next to a "font").
Diffstat (limited to 'src')
-rw-r--r--src/bin/edje/edje_cc_handlers.c34
-rw-r--r--src/lib/edje/edje_data.c1
-rw-r--r--src/lib/edje/edje_load.c18
-rw-r--r--src/lib/edje/edje_private.h2
-rw-r--r--src/lib/edje/edje_text.c4
5 files changed, 51 insertions, 8 deletions
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index 214c173461..cf82202614 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -314,6 +314,7 @@ static void st_collections_group_parts_part_description_text_align(void);
314static void st_collections_group_parts_part_description_text_source(void); 314static void st_collections_group_parts_part_description_text_source(void);
315static void st_collections_group_parts_part_description_text_text_source(void); 315static void st_collections_group_parts_part_description_text_text_source(void);
316static void st_collections_group_parts_part_description_text_elipsis(void); 316static void st_collections_group_parts_part_description_text_elipsis(void);
317static void st_collections_group_parts_part_description_text_filter(void);
317static void st_collections_group_parts_part_description_box_layout(void); 318static void st_collections_group_parts_part_description_box_layout(void);
318static void st_collections_group_parts_part_description_box_align(void); 319static void st_collections_group_parts_part_description_box_align(void);
319static void st_collections_group_parts_part_description_box_padding(void); 320static void st_collections_group_parts_part_description_box_padding(void);
@@ -651,6 +652,7 @@ New_Statement_Handler statement_handlers[] =
651 {"collections.group.parts.part.description.text.fonts.font", st_fonts_font}, /* dup */ 652 {"collections.group.parts.part.description.text.fonts.font", st_fonts_font}, /* dup */
652 {"collections.group.parts.part.description.text.elipsis", st_collections_group_parts_part_description_text_elipsis}, 653 {"collections.group.parts.part.description.text.elipsis", st_collections_group_parts_part_description_text_elipsis},
653 {"collections.group.parts.part.description.text.ellipsis", st_collections_group_parts_part_description_text_elipsis}, 654 {"collections.group.parts.part.description.text.ellipsis", st_collections_group_parts_part_description_text_elipsis},
655 {"collections.group.parts.part.description.text.filter", st_collections_group_parts_part_description_text_filter},
654 {"collections.group.parts.part.description.box.layout", st_collections_group_parts_part_description_box_layout}, 656 {"collections.group.parts.part.description.box.layout", st_collections_group_parts_part_description_box_layout},
655 {"collections.group.parts.part.description.box.align", st_collections_group_parts_part_description_box_align}, 657 {"collections.group.parts.part.description.box.align", st_collections_group_parts_part_description_box_align},
656 {"collections.group.parts.part.description.box.padding", st_collections_group_parts_part_description_box_padding}, 658 {"collections.group.parts.part.description.box.padding", st_collections_group_parts_part_description_box_padding},
@@ -5212,6 +5214,7 @@ st_collections_group_parts_part_description_inherit(void)
5212 ted->text.text.str = STRDUP(ted->text.text.str); 5214 ted->text.text.str = STRDUP(ted->text.text.str);
5213 ted->text.text_class = STRDUP(ted->text.text_class); 5215 ted->text.text_class = STRDUP(ted->text.text_class);
5214 ted->text.font.str = STRDUP(ted->text.font.str); 5216 ted->text.font.str = STRDUP(ted->text.font.str);
5217 ted->text.filter.str = STRDUP(ted->text.filter.str);
5215 5218
5216 data_queue_copied_part_lookup(pc, &(tparent->text.id_source), &(ted->text.id_source)); 5219 data_queue_copied_part_lookup(pc, &(tparent->text.id_source), &(ted->text.id_source));
5217 data_queue_copied_part_lookup(pc, &(tparent->text.id_text_source), &(ted->text.id_text_source)); 5220 data_queue_copied_part_lookup(pc, &(tparent->text.id_text_source), &(ted->text.id_text_source));
@@ -7295,6 +7298,37 @@ st_collections_group_parts_part_description_text_elipsis(void)
7295 ed->text.elipsis = parse_float_range(0, -1.0, 1.0); 7298 ed->text.elipsis = parse_float_range(0, -1.0, 1.0);
7296} 7299}
7297 7300
7301/**
7302 @page edcref
7303
7304 @property
7305 filter
7306 @parameters
7307 [filter program as a string]
7308 @effect
7309 Applies a series of filtering operations to the text.
7310 EXPERIMENTAL FEATURE. TO BE DOCUMENTED.
7311 @endproperty
7312*/
7313static void
7314st_collections_group_parts_part_description_text_filter(void)
7315{
7316 Edje_Part_Description_Text *ed;
7317
7318 check_arg_count(1);
7319
7320 if (current_part->type != EDJE_PART_TYPE_TEXT)
7321 {
7322 ERR("parse error %s:%i. text attributes in non-TEXT part.",
7323 file_in, line - 1);
7324 exit(-1);
7325 }
7326
7327 ed = (Edje_Part_Description_Text*) current_desc;
7328
7329 ed->text.filter.str = parse_str(0);
7330}
7331
7298 7332
7299/** 7333/**
7300 @edcsubsection{collections_group_parts_description_box,Box} 7334 @edcsubsection{collections_group_parts_description_box,Box}
diff --git a/src/lib/edje/edje_data.c b/src/lib/edje/edje_data.c
index 2e515ad4b6..d48f8070dc 100644
--- a/src/lib/edje/edje_data.c
+++ b/src/lib/edje/edje_data.c
@@ -805,6 +805,7 @@ _edje_edd_init(void)
805 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.id_source", text.id_source, EET_T_INT); 805 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.id_source", text.id_source, EET_T_INT);
806 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); 806 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);
807 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.elipsis", text.elipsis, EET_T_DOUBLE); 807 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.elipsis", text.elipsis, EET_T_DOUBLE);
808 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.filter", text.filter, EET_T_STRING);
808 809
809 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Text); 810 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Text);
810 eddc.func.mem_free = mem_free_textblock; 811 eddc.func.mem_free = mem_free_textblock;
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index 56435d485b..073de55b36 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -1358,10 +1358,11 @@ _edje_file_del(Edje *ed)
1358 else if ((rp->type == EDJE_RP_TYPE_TEXT) && 1358 else if ((rp->type == EDJE_RP_TYPE_TEXT) &&
1359 (rp->typedata.text)) 1359 (rp->typedata.text))
1360 { 1360 {
1361 if (rp->typedata.text->text) eina_stringshare_del(rp->typedata.text->text); 1361 eina_stringshare_del(rp->typedata.text->text);
1362 if (rp->typedata.text->font) eina_stringshare_del(rp->typedata.text->font); 1362 eina_stringshare_del(rp->typedata.text->font);
1363 if (rp->typedata.text->cache.in_str) eina_stringshare_del(rp->typedata.text->cache.in_str); 1363 eina_stringshare_del(rp->typedata.text->cache.in_str);
1364 if (rp->typedata.text->cache.out_str) eina_stringshare_del(rp->typedata.text->cache.out_str); 1364 eina_stringshare_del(rp->typedata.text->cache.out_str);
1365 eina_stringshare_del(rp->typedata.text->filter);
1365 free(rp->typedata.text); 1366 free(rp->typedata.text);
1366 } 1367 }
1367 else if ((rp->type == EDJE_RP_TYPE_SWALLOW) && 1368 else if ((rp->type == EDJE_RP_TYPE_SWALLOW) &&
@@ -1746,10 +1747,11 @@ _edje_collection_free_part_description_clean(int type, Edje_Part_Description_Com
1746 1747
1747 text = (Edje_Part_Description_Text *) desc; 1748 text = (Edje_Part_Description_Text *) desc;
1748 1749
1749 if (text->text.text.str) eina_stringshare_del(text->text.text.str); 1750 eina_stringshare_del(text->text.text.str);
1750 if (text->text.text_class) eina_stringshare_del(text->text.text_class); 1751 eina_stringshare_del(text->text.text_class);
1751 if (text->text.style.str) eina_stringshare_del(text->text.style.str); 1752 eina_stringshare_del(text->text.style.str);
1752 if (text->text.font.str) eina_stringshare_del(text->text.font.str); 1753 eina_stringshare_del(text->text.font.str);
1754 eina_stringshare_del(text->text.filter.str);
1753 } 1755 }
1754 break; 1756 break;
1755 } 1757 }
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 48d38bc798..c4b9df11b0 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -1175,6 +1175,7 @@ struct _Edje_Part_Description_Spec_Text
1175 Edje_String style; /* the text style if a textblock */ 1175 Edje_String style; /* the text style if a textblock */
1176 Edje_String font; /* if a specific font is asked for */ 1176 Edje_String font; /* if a specific font is asked for */
1177 Edje_String repch; /* replacement char for password mode entry */ 1177 Edje_String repch; /* replacement char for password mode entry */
1178 Edje_String filter; /* special effects */
1178 1179
1179 Edje_Alignment align; /* text alignment within bounds */ 1180 Edje_Alignment align; /* text alignment within bounds */
1180 Edje_Color color3; 1181 Edje_Color color3;
@@ -1530,6 +1531,7 @@ struct _Edje_Real_Part_Text
1530 const char *text; // 4 1531 const char *text; // 4
1531 const char *font; // 4 1532 const char *font; // 4
1532 const char *style; // 4 1533 const char *style; // 4
1534 const char *filter; // 4
1533 Edje_Position offset; // 8 1535 Edje_Position offset; // 8
1534 short size; // 2 1536 short size; // 2
1535 struct { 1537 struct {
diff --git a/src/lib/edje/edje_text.c b/src/lib/edje/edje_text.c
index 3f68519987..dd9f80b55f 100644
--- a/src/lib/edje/edje_text.c
+++ b/src/lib/edje/edje_text.c
@@ -169,6 +169,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
169 char *font2 = NULL; 169 char *font2 = NULL;
170 char *sfont = NULL; 170 char *sfont = NULL;
171 int size; 171 int size;
172 const char *filter;
172 Evas_Coord tw, th; 173 Evas_Coord tw, th;
173 Evas_Coord sw, sh; 174 Evas_Coord sw, sh;
174 int inlined_font = 0, free_text = 0; 175 int inlined_font = 0, free_text = 0;
@@ -181,10 +182,12 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
181 if (sc == 0.0) sc = _edje_scale; 182 if (sc == 0.0) sc = _edje_scale;
182 text = edje_string_get(&chosen_desc->text.text); 183 text = edje_string_get(&chosen_desc->text.text);
183 font = _edje_text_class_font_get(ed, chosen_desc, &size, &sfont); 184 font = _edje_text_class_font_get(ed, chosen_desc, &size, &sfont);
185 filter = chosen_desc->text.filter.str;
184 186
185 if (ep->typedata.text->text) text = ep->typedata.text->text; 187 if (ep->typedata.text->text) text = ep->typedata.text->text;
186 if (ep->typedata.text->font) font = ep->typedata.text->font; 188 if (ep->typedata.text->font) font = ep->typedata.text->font;
187 if (ep->typedata.text->size > 0) size = ep->typedata.text->size; 189 if (ep->typedata.text->size > 0) size = ep->typedata.text->size;
190 if (ep->typedata.text->filter) filter = ep->typedata.text->filter;
188 191
189 if (ep->typedata.text->text_source) 192 if (ep->typedata.text->text_source)
190 { 193 {
@@ -418,6 +421,7 @@ arrange_text:
418 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc)); 421 if (ep->part->scale) evas_object_scale_set(ep->object, TO_DOUBLE(sc));
419 eo_do(ep->object, 422 eo_do(ep->object,
420 evas_obj_text_font_set(font, size), 423 evas_obj_text_font_set(font, size),
424 evas_obj_text_filter_program_set(filter),
421 evas_obj_text_text_set(text)); 425 evas_obj_text_text_set(text));
422 part_get_geometry(ep, &tw, &th); 426 part_get_geometry(ep, &tw, &th);
423 /* Handle alignment */ 427 /* Handle alignment */