Evas filters: Implement basic Edje support
authorJean-Philippe Andre <jp.andre@samsung.com>
Wed, 5 Feb 2014 06:36:05 +0000 (15:36 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Fri, 7 Feb 2014 08:33:18 +0000 (17:33 +0900)
Does not support proxies yet.
Implemented as "filter" field in a part.description.text (next
to a "font").

src/bin/edje/edje_cc_handlers.c
src/lib/edje/edje_data.c
src/lib/edje/edje_load.c
src/lib/edje/edje_private.h
src/lib/edje/edje_text.c

index 214c173..cf82202 100644 (file)
@@ -314,6 +314,7 @@ static void st_collections_group_parts_part_description_text_align(void);
 static void st_collections_group_parts_part_description_text_source(void);
 static void st_collections_group_parts_part_description_text_text_source(void);
 static void st_collections_group_parts_part_description_text_elipsis(void);
+static void st_collections_group_parts_part_description_text_filter(void);
 static void st_collections_group_parts_part_description_box_layout(void);
 static void st_collections_group_parts_part_description_box_align(void);
 static void st_collections_group_parts_part_description_box_padding(void);
@@ -651,6 +652,7 @@ New_Statement_Handler statement_handlers[] =
      {"collections.group.parts.part.description.text.fonts.font", st_fonts_font}, /* dup */
      {"collections.group.parts.part.description.text.elipsis", st_collections_group_parts_part_description_text_elipsis},
      {"collections.group.parts.part.description.text.ellipsis", st_collections_group_parts_part_description_text_elipsis},
+     {"collections.group.parts.part.description.text.filter", st_collections_group_parts_part_description_text_filter},
      {"collections.group.parts.part.description.box.layout", st_collections_group_parts_part_description_box_layout},
      {"collections.group.parts.part.description.box.align", st_collections_group_parts_part_description_box_align},
      {"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)
               ted->text.text.str = STRDUP(ted->text.text.str);
               ted->text.text_class = STRDUP(ted->text.text_class);
               ted->text.font.str = STRDUP(ted->text.font.str);
+              ted->text.filter.str = STRDUP(ted->text.filter.str);
 
               data_queue_copied_part_lookup(pc, &(tparent->text.id_source), &(ted->text.id_source));
               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)
    ed->text.elipsis = parse_float_range(0, -1.0, 1.0);
 }
 
+/**
+    @page edcref
+
+    @property
+        filter
+    @parameters
+        [filter program as a string]
+    @effect
+        Applies a series of filtering operations to the text.
+        EXPERIMENTAL FEATURE. TO BE DOCUMENTED.
+    @endproperty
+*/
+static void
+st_collections_group_parts_part_description_text_filter(void)
+{
+   Edje_Part_Description_Text *ed;
+
+   check_arg_count(1);
+
+   if (current_part->type != EDJE_PART_TYPE_TEXT)
+     {
+        ERR("parse error %s:%i. text attributes in non-TEXT part.",
+            file_in, line - 1);
+        exit(-1);
+     }
+
+   ed = (Edje_Part_Description_Text*) current_desc;
+
+   ed->text.filter.str = parse_str(0);
+}
+
 
 /**
    @edcsubsection{collections_group_parts_description_box,Box}
index 2e515ad..d48f807 100644 (file)
@@ -805,6 +805,7 @@ _edje_edd_init(void)
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.id_source", text.id_source, EET_T_INT);
    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_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Description_Text);
    eddc.func.mem_free = mem_free_textblock;
index 56435d4..073de55 100644 (file)
@@ -1358,10 +1358,11 @@ _edje_file_del(Edje *ed)
              else if ((rp->type == EDJE_RP_TYPE_TEXT) &&
                       (rp->typedata.text))
                {
-                  if (rp->typedata.text->text) eina_stringshare_del(rp->typedata.text->text);
-                  if (rp->typedata.text->font) eina_stringshare_del(rp->typedata.text->font);
-                  if (rp->typedata.text->cache.in_str) eina_stringshare_del(rp->typedata.text->cache.in_str);
-                  if (rp->typedata.text->cache.out_str) eina_stringshare_del(rp->typedata.text->cache.out_str);
+                  eina_stringshare_del(rp->typedata.text->text);
+                  eina_stringshare_del(rp->typedata.text->font);
+                  eina_stringshare_del(rp->typedata.text->cache.in_str);
+                  eina_stringshare_del(rp->typedata.text->cache.out_str);
+                  eina_stringshare_del(rp->typedata.text->filter);
                   free(rp->typedata.text);
                }
              else if ((rp->type == EDJE_RP_TYPE_SWALLOW) &&
@@ -1746,10 +1747,11 @@ _edje_collection_free_part_description_clean(int type, Edje_Part_Description_Com
 
               text = (Edje_Part_Description_Text *) desc;
 
-              if (text->text.text.str)      eina_stringshare_del(text->text.text.str);
-              if (text->text.text_class)    eina_stringshare_del(text->text.text_class);
-              if (text->text.style.str)     eina_stringshare_del(text->text.style.str);
-              if (text->text.font.str)      eina_stringshare_del(text->text.font.str);
+              eina_stringshare_del(text->text.text.str);
+              eina_stringshare_del(text->text.text_class);
+              eina_stringshare_del(text->text.style.str);
+              eina_stringshare_del(text->text.font.str);
+              eina_stringshare_del(text->text.filter.str);
            }
          break;
      }
index 48d38bc..c4b9df1 100644 (file)
@@ -1175,6 +1175,7 @@ struct _Edje_Part_Description_Spec_Text
    Edje_String    style; /* the text style if a 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 */
 
    Edje_Alignment align; /* text alignment within bounds */
    Edje_Color     color3;
@@ -1530,6 +1531,7 @@ struct _Edje_Real_Part_Text
    const char            *text; // 4
    const char            *font; // 4
    const char            *style; // 4
+   const char            *filter; // 4
    Edje_Position          offset; // 8
    short                  size; // 2
    struct {
index 3f68519..dd9f80b 100644 (file)
@@ -169,6 +169,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
    char                *font2 = NULL;
    char         *sfont = NULL;
    int          size;
+   const char   *filter;
    Evas_Coord   tw, th;
    Evas_Coord   sw, sh;
    int          inlined_font = 0, free_text = 0;
@@ -181,10 +182,12 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
    if (sc == 0.0) sc = _edje_scale;
    text = edje_string_get(&chosen_desc->text.text);
    font = _edje_text_class_font_get(ed, chosen_desc, &size, &sfont);
+   filter = chosen_desc->text.filter.str;
 
    if (ep->typedata.text->text) text = ep->typedata.text->text;
    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->text_source)
      {
@@ -418,6 +421,7 @@ arrange_text:
    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);
    /* Handle alignment */