edje_edit: add correct tweens generation for inherit state 77/92677/2
authorVyacheslav Reutskiy <v.reutskiy@samsung.com>
Mon, 17 Oct 2016 14:25:43 +0000 (17:25 +0300)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Fri, 21 Oct 2016 02:29:35 +0000 (19:29 -0700)
Change-Id: I639de7b040687e4f21852b4d0c4580f807e5f0e6
Signed-off-by: Vyacheslav Reutskiy <v.reutskiy@samsung.com>
src/lib/edje/edje_edit.c

index 7db9605..45979b9 100644 (file)
@@ -13334,6 +13334,7 @@ _edje_generate_source_state_image(Edje_Edit *eed, Evas_Object *obj,
    int attr_amount = 0;
    int indent_space = strlen(I6);
    char *data;
+   unsigned int i;
 
    Eina_Bool name = EINA_FALSE;
    Eina_Bool border = EINA_FALSE;
@@ -13341,12 +13342,12 @@ _edje_generate_source_state_image(Edje_Edit *eed, Evas_Object *obj,
    Eina_Bool scale_hint = EINA_FALSE;
    Eina_Bool border_no_fill = EINA_FALSE;
    Eina_Bool border_scale = EINA_FALSE;
+   Eina_Bool tweens = EINA_FALSE;
 
    Edje_Part_Description_Image *img;
    img = (Edje_Part_Description_Image *)pd;
    Edje_Part_Description_Image *inherit_pd_img = (Edje_Part_Description_Image *)inherit_pd;
 
-   ll = edje_edit_state_tweens_list_get(obj, part, state, value);
 
 /*TODO: support tweens inherit*/
    if (inherit_pd)
@@ -13366,7 +13367,19 @@ _edje_generate_source_state_image(Edje_Edit *eed, Evas_Object *obj,
 
         border_scale = (img->image.border.scale == inherit_pd_img->image.border.scale) ? EINA_FALSE : EINA_TRUE;
 
-        /*Add check for a tween images*/
+        if (img->image.tweens_count == inherit_pd_img->image.tweens_count)
+          {
+             for (i = 0; i < img->image.tweens_count; i++)
+               {
+                  if (img->image.tweens[i]->id == inherit_pd_img->image.tweens[i]->id)
+                    continue;
+                  else
+                    {
+                       tweens = EINA_TRUE;
+                       break;
+                    }
+               }
+          }
      }
    else
      {
@@ -13377,11 +13390,11 @@ _edje_generate_source_state_image(Edje_Edit *eed, Evas_Object *obj,
         scale_hint = (img->image.scale_hint == EVAS_IMAGE_SCALE_HINT_NONE) ? EINA_FALSE : EINA_TRUE;
         border_no_fill = (img->image.border.no_fill == 0) ? EINA_FALSE : EINA_TRUE;
         border_scale = (img->image.border.scale == 0) ? EINA_FALSE : EINA_TRUE;
+        tweens = (img->image.tweens_count == 0) ? EINA_FALSE : EINA_TRUE;
      }
 
 
-   attr_amount =  name + border + border_scale_by + scale_hint + border_no_fill + border_scale;
-   attr_amount += (ll == NULL) ? 0 : 2;
+   attr_amount =  name + border + border_scale_by + scale_hint + border_no_fill + border_scale + tweens;
 
    if (attr_amount == 0) goto fill;
    if (attr_amount == 1)
@@ -13404,9 +13417,13 @@ _edje_generate_source_state_image(Edje_Edit *eed, Evas_Object *obj,
           }
      }
 
-   EINA_LIST_FOREACH(ll, l, data)
-     BUF_APPENDF("%*stween: \"%s\";\n", indent_space, "", data);
-   edje_edit_string_list_free(ll);
+   if (tweens)
+     {
+        ll = edje_edit_state_tweens_list_get(obj, part, state, value);
+        EINA_LIST_FOREACH(ll, l, data)
+           BUF_APPENDF("%*stween: \"%s\";\n", indent_space, "", data);
+        edje_edit_string_list_free(ll);
+     }
 
    if (border)
      BUF_APPENDF("%*sborder: %d %d %d %d;\n", indent_space, "",