edje_cc: allow omitting "name" keyword in color_classes.color_class block 04/89104/2
authorJee-Yong Um <jc9.um@samsung.com>
Fri, 5 Feb 2016 07:30:31 +0000 (08:30 +0100)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Thu, 22 Sep 2016 09:42:34 +0000 (02:42 -0700)
Summary:
This allows developer to omit "name" keyword in color_classes.color_class
block in EDC.

Reviewers: cedric, jpeg

Reviewed By: jpeg

Differential Revision: https://phab.enlightenment.org/D3598

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Change-Id: Idfb304a31db9028c279a40c7e3bdb6e6e7b2ffd4

src/bin/edje/edje_cc_handlers.c

index a0245ee..6f76917 100644 (file)
@@ -2641,6 +2641,25 @@ ob_color_class(void)
    cc->a3 = 0;
 }
 
+static void
+_color_class_name(char *name)
+{
+   Edje_Color_Class *cc, *tcc;
+   Eina_List *l;
+
+   cc = eina_list_data_get(eina_list_last(edje_file->color_classes));
+   cc->name = name;
+   EINA_LIST_FOREACH(edje_file->color_classes, l, tcc)
+     {
+        if ((cc != tcc) && (!strcmp(cc->name, tcc->name)))
+          {
+             ERR("parse error %s:%i. There is already a color class named \"%s\"",
+                 file_in, line - 1, cc->name);
+             exit(-1);
+          }
+     }
+}
+
 /**
     @page edcref
 
@@ -14374,6 +14393,13 @@ edje_cc_handlers_wildcard(void)
          stack_pop_quick(EINA_FALSE, EINA_FALSE);
          return EINA_TRUE;
      }
+   if (edje_file->color_classes && (!strcmp(last, "color_class")))
+     {
+        if (!had_quote) return EINA_FALSE;
+        _color_class_name(token);
+        stack_pop_quick(EINA_FALSE, EINA_FALSE);
+        return EINA_TRUE;
+     }
    return EINA_FALSE;
 }