This is an automated email from the git hooks/post-receive script.

git pushed a commit to reference refs/pull/122/head
in repository efl.

View the commit online.

commit 23ff2396628737899fc10f0c89930b015dd6b152
Author: Cedric BAIL <[email protected]>
AuthorDate: Thu Nov 26 13:13:19 2026 -0600

    edje_edit: keep vector trees through state edits and generated source
    
    edje_decc and edje_edit_source_generate are how a theme is recovered
    from an .edj, and edje_edit is how editors change one, so both have
    to carry vector trees and overrides or they silently drop them.
    
    The generated source writes the vectors {} block, each description's
    vector.use or inline tree and its overrides, in the syntax edje_cc
    reads back, and only the values that differ from the defaults. Vector
    descriptions are written out in full instead of with inherit: the
    inherit difference check does not look at trees and overrides, so it
    would lose them.
    
    State edits treat vector descriptions like the other types: a new
    state has no tree (tree_id -1, as tree 0 is a real tree now), a copy
    takes the tree and a copy of the overrides, and a deleted state stops
    observing its color classes. The part type table also lacked VECTOR,
    so a vector part was written out with a garbage type.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/edje/edje_edit.c | 503 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 502 insertions(+), 1 deletion(-)

diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 100a377eea..9b057c3ed3 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -11,6 +11,7 @@
 #define EFL_CANVAS_GROUP_PROTECTED
 
 #include "edje_private.h"
+#include "edje_vg_tree.h"
 
 #include "canvas/evas_canvas_eo.h"
 
@@ -6281,6 +6282,9 @@ edje_edit_state_del(Evas_Object *obj, const char *part, const char *state, doubl
           break;
        }
 
+   if (rp->part->type == EDJE_PART_TYPE_VECTOR)
+     _edje_vg_desc_color_classes_observe(ed, (Edje_Part_Description_Vector *)pd, EINA_FALSE);
+
    _edje_collection_free_part_description_free(rp->part->type, pd, ce, 0);
    return EINA_TRUE;
 }
@@ -6344,6 +6348,9 @@ case EDJE_PART_TYPE_##Short:                                          \
         EDIT_ALLOC_POOL(VECTOR, Vector, vector);
      }
 
+   if (pd && (type == EDJE_PART_TYPE_VECTOR))
+     ((Edje_Part_Description_Vector *)pd)->vg.tree_id = -1;
+
    return pd;
 }
 
@@ -6695,6 +6702,37 @@ _edje_edit_part_state_copy(Evas_Object *obj, const char *part, const char *part_
          break;
       }
 
+      case EDJE_PART_TYPE_VECTOR:
+      {
+         Edje_Part_Description_Vector *vec_to = (Edje_Part_Description_Vector *)pdto;
+         Edje_Part_Description_Vector *vec_from = (Edje_Part_Description_Vector *)pdfrom;
+         Edje_Vg_Override *ovr;
+         Eina_List *l;
+
+         _edje_vg_desc_color_classes_observe(ed, vec_to, EINA_FALSE);
+         EINA_LIST_FREE(vec_to->vg.overrides, ovr)
+           {
+              _edje_if_string_free(ed, &ovr->target_name);
+              _edje_vg_override_free(ovr, EINA_FALSE);
+           }
+
+         vec_to->vg = vec_from->vg;
+         vec_to->vg.overrides = NULL;
+         EINA_LIST_FOREACH(vec_from->vg.overrides, l, ovr)
+           {
+              Edje_Vg_Override *copy = _edje_vg_override_dup(ovr);
+
+              if (!copy)
+                {
+                   ERR("Out of memory while copying a vector override");
+                   continue;
+                }
+              vec_to->vg.overrides = eina_list_append(vec_to->vg.overrides, copy);
+           }
+         _edje_vg_desc_color_classes_observe(ed, vec_to, EINA_TRUE);
+         break;
+      }
+
       case EDJE_PART_TYPE_EXTERNAL:
       {
          Edje_Part_Description_External *ext_to = (Edje_Part_Description_External *)pdto;
@@ -12673,7 +12711,9 @@ edje_edit_script_error_list_get(Evas_Object *obj)
          list = eina_list_append(list, condition_data);  \
     }
 
-static const char *types[] = {"NONE", "RECT", "TEXT", "IMAGE", "SWALLOW", "TEXTBLOCK", "GRADIENT", "GROUP", "BOX", "TABLE", "EXTERNAL", "PROXY", "SPACER"};
+static const char *types[] = {"NONE", "RECT", "TEXT", "IMAGE", "SWALLOW", "TEXTBLOCK",
+                              "GRADIENT", "GROUP", "BOX", "TABLE", "EXTERNAL", "PROXY",
+                              "SPACER", [EDJE_PART_TYPE_VECTOR] = "VECTOR"};
 static const char *effects[] = {"NONE", "PLAIN", "OUTLINE", "SOFT_OUTLINE", "SHADOW", "SOFT_SHADOW", "OUTLINE_SHADOW", "OUTLINE_SOFT_SHADOW", "FAR_SHADOW", "FAR_SOFT_SHADOW", "GLOW"};
 static const char *shadow_direction[] = {"BOTTOM_RIGHT", "BOTTOM", "BOTTOM_LEFT", "LEFT", "TOP_LEFT", "TOP", "TOP_RIGHT", "RIGHT"};
 static const char *prefers[] = {"NONE", "VERTICAL", "HORIZONTAL", "BOTH", "SOURCE"};
@@ -12683,6 +12723,9 @@ static const char *aspect_mode[] = {"NONE", "NEITHER", "HORIZONTAL", "VERTICAL",
 static Eina_Bool
  _edje_generate_source_of_group(Edje *ed, Edje_Part_Collection_Directory_Entry *pce, Eina_Strbuf *buf);
 
+static Eina_Bool
+ _edje_generate_source_of_vectors_block(const Edje_File *ef, Eina_Strbuf *buf);
+
 static Eina_Bool
  _edje_generate_source_of_style(Edje *ed, const char *name, Eina_Strbuf *buf);
 
@@ -13052,6 +13095,9 @@ _edje_edit_source_generate(Evas_Object *obj, Eina_Bool without_global_data)
      }
 
 
+   if (!without_global_data)
+     ret &= _edje_generate_source_of_vectors_block(ed->file, buf);
+
    /* print the main code of group collections */
    if (!without_global_data) BUF_APPEND(I0 "collections {\n");
    /* if sounds were found, print them */
@@ -14000,6 +14046,444 @@ _edje_generate_source_state_relative(Edje *ed,
      }
 }
 
+static const char *
+_vg_cap_str(Efl_Gfx_Cap cap)
+{
+   switch (cap)
+     {
+      case EFL_GFX_CAP_ROUND:  return "ROUND";
+      case EFL_GFX_CAP_SQUARE: return "SQUARE";
+      default:                 return "BUTT";
+     }
+}
+
+static const char *
+_vg_join_str(Efl_Gfx_Join join)
+{
+   switch (join)
+     {
+      case EFL_GFX_JOIN_ROUND: return "ROUND";
+      case EFL_GFX_JOIN_BEVEL: return "BEVEL";
+      default:                 return "MITER";
+     }
+}
+
+static const char *
+_vg_fill_rule_str(Efl_Gfx_Fill_Rule rule)
+{
+   return (rule == EFL_GFX_FILL_RULE_ODD_EVEN) ? "EVEN_ODD" : "WINDING";
+}
+
+static const char *
+_vg_spread_str(Efl_Gfx_Gradient_Spread spread)
+{
+   switch (spread)
+     {
+      case EFL_GFX_GRADIENT_SPREAD_REFLECT: return "REFLECT";
+      case EFL_GFX_GRADIENT_SPREAD_REPEAT:  return "REPEAT";
+      default:                              return "PAD";
+     }
+}
+
+static const char *
+_vg_node_keyword(Edje_Vg_Node_Type type)
+{
+   switch (type)
+     {
+      case EDJE_VG_NODE_SHAPE:           return "shape";
+      case EDJE_VG_NODE_CONTAINER:       return "container";
+      case EDJE_VG_NODE_GRADIENT_LINEAR: return "gradient_linear";
+      case EDJE_VG_NODE_GRADIENT_RADIAL: return "gradient_radial";
+     }
+   ERR("Unknown vector node type %d", type);
+   return NULL;
+}
+
+static Eina_Bool
+_vg_color_is_default(const Edje_Vg_Color_Binding *cb)
+{
+   return (cb->r == 255) && (cb->g == 255) && (cb->b == 255) && (cb->a == 255);
+}
+
+/* The properties are written with the given prefix, as in "fill.color". */
+static Eina_Bool
+_edje_vg_emit_color(Eina_Strbuf *buf, int indent, const char *prefix,
+                    const Edje_Vg_Color_Binding *cb)
+{
+   Eina_Bool ret = EINA_TRUE;
+
+   if (!_vg_color_is_default(cb))
+     BUF_APPENDF("%*s%scolor: %d %d %d %d;\n", indent, "", prefix,
+                 cb->r, cb->g, cb->b, cb->a);
+   if (cb->color_class && *cb->color_class)
+     BUF_APPENDF("%*s%scolor_class: \"%s\";\n", indent, "", prefix, cb->color_class);
+   return ret;
+}
+
+static Eina_Bool
+_edje_vg_emit_xform(Eina_Strbuf *buf, int indent, const Edje_Vg_Transform *x)
+{
+   Eina_Bool ret = EINA_TRUE;
+
+   if (x->has_matrix)
+     {
+        BUF_APPENDF("%*stransform.matrix: %.10g %.10g %.10g %.10g %.10g %.10g %.10g %.10g %.10g;\n",
+                    indent, "", x->m[0], x->m[1], x->m[2], x->m[3], x->m[4],
+                    x->m[5], x->m[6], x->m[7], x->m[8]);
+        return ret;
+     }
+   if (EINA_DBL_NONZERO(x->tx) || EINA_DBL_NONZERO(x->ty))
+     BUF_APPENDF("%*stransform.translate: %.10g %.10g;\n", indent, "", x->tx, x->ty);
+   if (EINA_DBL_NONZERO(x->angle))
+     BUF_APPENDF("%*stransform.rotate: %.10g;\n", indent, "", x->angle);
+   if (!EINA_DBL_EQ(x->sx, 1.0) || !EINA_DBL_EQ(x->sy, 1.0))
+     BUF_APPENDF("%*stransform.scale: %.10g %.10g;\n", indent, "", x->sx, x->sy);
+   return ret;
+}
+
+/* Paths are stored as the command and point arrays the parser produced from
+ * an SVG string, so only the absolute M, L, C and Z commands come back. */
+static Eina_Bool
+_edje_vg_emit_path(Eina_Strbuf *buf, int indent, const char *prefix,
+                   const Edje_Vg_Node *shape)
+{
+   const double *p = shape->shape.points;
+   Eina_Bool ret = EINA_TRUE;
+   unsigned int i;
+
+   BUF_APPENDF("%*s%spath: \"", indent, "", prefix);
+   for (i = 0; i < shape->shape.commands_count; i++)
+     {
+        switch (shape->shape.commands[i])
+          {
+           case EFL_GFX_PATH_COMMAND_TYPE_MOVE_TO:
+              BUF_APPENDF("%sM%.10g,%.10g", i ? " " : "", p[0], p[1]);
+              p += 2;
+              break;
+
+           case EFL_GFX_PATH_COMMAND_TYPE_LINE_TO:
+              BUF_APPENDF(" L%.10g,%.10g", p[0], p[1]);
+              p += 2;
+              break;
+
+           case EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO:
+              BUF_APPENDF(" C%.10g,%.10g %.10g,%.10g %.10g,%.10g",
+                          p[0], p[1], p[2], p[3], p[4], p[5]);
+              p += 6;
+              break;
+
+           case EFL_GFX_PATH_COMMAND_TYPE_CLOSE:
+              BUF_APPEND(" Z");
+              break;
+
+           case EFL_GFX_PATH_COMMAND_TYPE_END:
+              goto path_end;
+
+           default:
+              ERR("Unknown vector path command %d", shape->shape.commands[i]);
+              return EINA_FALSE;
+          }
+     }
+path_end:
+   BUF_APPEND("\";\n");
+   return ret;
+}
+
+static Eina_Bool
+_edje_vg_emit_dash(Eina_Strbuf *buf, int indent, const char *prefix,
+                   const double *dash, unsigned int count)
+{
+   Eina_Bool ret = EINA_TRUE;
+   unsigned int i;
+
+   BUF_APPENDF("%*s%sdash:", indent, "", prefix);
+   for (i = 0; i < count; i++)
+     {
+        BUF_APPENDF(" %.10g", dash[i]);
+     }
+   BUF_APPEND(";\n");
+   return ret;
+}
+
+static Eina_Bool
+_edje_vg_emit_stops(Eina_Strbuf *buf, int indent, const Edje_Vg_Stop *stops,
+                    unsigned int count)
+{
+   Eina_Bool ret = EINA_TRUE;
+   unsigned int i;
+
+   for (i = 0; i < count; i++)
+     {
+        BUF_APPENDF("%*sstop {\n", indent, "");
+        BUF_APPENDF("%*soffset: %.10g;\n", indent + (int)strlen(I1), "", stops[i].offset);
+        ret &= _edje_vg_emit_color(buf, indent + (int)strlen(I1), "", &stops[i].color);
+        BUF_APPENDF("%*s}\n", indent, "");
+     }
+   return ret;
+}
+
+static Eina_Bool
+_edje_vg_emit_gradient_geometry(Eina_Strbuf *buf, int indent, Edje_Vg_Node_Type type,
+                                const Edje_Vg_Node *gradient)
+{
+   Eina_Bool ret = EINA_TRUE;
+
+   if (type == EDJE_VG_NODE_GRADIENT_RADIAL)
+     {
+        BUF_APPENDF("%*scenter: %.10g %.10g;\n", indent, "",
+                    gradient->gradient.x0, gradient->gradient.y0);
+        BUF_APPENDF("%*sfocal: %.10g %.10g;\n", indent, "",
+                    gradient->gradient.x1, gradient->gradient.y1);
+        BUF_APPENDF("%*sradius: %.10g;\n", indent, "", gradient->gradient.radius);
+     }
+   else
+     {
+        BUF_APPENDF("%*sstart: %.10g %.10g;\n", indent, "",
+                    gradient->gradient.x0, gradient->gradient.y0);
+        BUF_APPENDF("%*send: %.10g %.10g;\n", indent, "",
+                    gradient->gradient.x1, gradient->gradient.y1);
+     }
+   return ret;
+}
+
+static Eina_Bool
+_edje_vg_emit_shape(Eina_Strbuf *buf, int indent, const Edje_Vg_Node *n)
+{
+   Eina_Bool ret = EINA_TRUE;
+
+   if (n->shape.commands_count > 0)
+     ret &= _edje_vg_emit_path(buf, indent, "", n);
+
+   ret &= _edje_vg_emit_color(buf, indent, "fill.", &n->shape.fill);
+   if (n->shape.gradient_ref && *n->shape.gradient_ref)
+     BUF_APPENDF("%*sfill.gradient: \"%s\";\n", indent, "", n->shape.gradient_ref);
+
+   ret &= _edje_vg_emit_color(buf, indent, "stroke.", &n->shape.stroke_color);
+   if (EINA_DBL_NONZERO(n->shape.stroke_width))
+     BUF_APPENDF("%*sstroke.width: %.10g;\n", indent, "", n->shape.stroke_width);
+   if (n->shape.stroke_cap != EFL_GFX_CAP_BUTT)
+     BUF_APPENDF("%*sstroke.cap: %s;\n", indent, "", _vg_cap_str(n->shape.stroke_cap));
+   if (n->shape.stroke_join != EFL_GFX_JOIN_MITER)
+     BUF_APPENDF("%*sstroke.join: %s;\n", indent, "", _vg_join_str(n->shape.stroke_join));
+   if (n->shape.stroke_dash_count > 0)
+     ret &= _edje_vg_emit_dash(buf, indent, "stroke.", n->shape.stroke_dash,
+                               n->shape.stroke_dash_count);
+   if (n->shape.fill_rule != EFL_GFX_FILL_RULE_WINDING)
+     BUF_APPENDF("%*sfill_rule: %s;\n", indent, "", _vg_fill_rule_str(n->shape.fill_rule));
+   return ret;
+}
+
+static Eina_Bool
+_edje_vg_emit_gradient(Eina_Strbuf *buf, int indent, const Edje_Vg_Node *n)
+{
+   Eina_Bool ret = EINA_TRUE;
+
+   if (n->gradient.spread != EFL_GFX_GRADIENT_SPREAD_PAD)
+     BUF_APPENDF("%*sspread: %s;\n", indent, "", _vg_spread_str(n->gradient.spread));
+   ret &= _edje_vg_emit_gradient_geometry(buf, indent, n->type, n);
+   ret &= _edje_vg_emit_stops(buf, indent, n->gradient.stops, n->gradient.stops_count);
+   return ret;
+}
+
+static Eina_Bool
+_edje_vg_emit_node(Eina_Strbuf *buf, int indent, const Edje_Vg_Node *n)
+{
+   const char *keyword = _vg_node_keyword(n->type);
+   int inner = indent + (int)strlen(I1);
+   Eina_Bool ret = EINA_TRUE;
+   unsigned int i;
+
+   if (!keyword) return EINA_FALSE;
+
+   BUF_APPENDF("%*s%s {\n", indent, "", keyword);
+   if (n->name)
+     BUF_APPENDF("%*sname: \"%s\";\n", inner, "", n->name);
+   if (!n->visible)
+     BUF_APPENDF("%*svisible: 0;\n", inner, "");
+   ret &= _edje_vg_emit_color(buf, inner, "", &n->color);
+   ret &= _edje_vg_emit_xform(buf, inner, &n->xform);
+
+   switch (n->type)
+     {
+      case EDJE_VG_NODE_SHAPE:
+         ret &= _edje_vg_emit_shape(buf, inner, n);
+         break;
+
+      case EDJE_VG_NODE_CONTAINER:
+         for (i = 0; i < n->container.children_count; i++)
+           {
+              ret &= _edje_vg_emit_node(buf, inner, &n->container.children[i]);
+           }
+         break;
+
+      case EDJE_VG_NODE_GRADIENT_LINEAR:
+      case EDJE_VG_NODE_GRADIENT_RADIAL:
+         ret &= _edje_vg_emit_gradient(buf, inner, n);
+         break;
+     }
+
+   BUF_APPENDF("%*s}\n", indent, "");
+   return ret;
+}
+
+static Eina_Bool
+_edje_vg_emit_tree_body(Eina_Strbuf *buf, int indent, const Edje_Vg_Tree *t)
+{
+   Eina_Bool ret = EINA_TRUE;
+   unsigned int i;
+
+   BUF_APPENDF("%*sviewbox: %.10g %.10g %.10g %.10g;\n", indent, "",
+               t->vbx, t->vby, t->vbw, t->vbh);
+   for (i = 0; i < t->root->container.children_count; i++)
+     {
+        ret &= _edje_vg_emit_node(buf, indent, &t->root->container.children[i]);
+     }
+   return ret;
+}
+
+/* An override sets only the properties of its field mask, written with the
+ * same statements as the nodes of a tree and addressed with target. */
+static Eina_Bool
+_edje_vg_emit_override(Eina_Strbuf *buf, int indent, const Edje_Vg_Override *ovr)
+{
+   const Edje_Vg_Node *p = &ovr->payload;
+   const char *keyword = _vg_node_keyword(ovr->expected_type);
+   int inner = indent + (int)strlen(I1);
+   uint64_t mask = ovr->field_mask;
+   Eina_Bool ret = EINA_TRUE;
+
+   if (!keyword) return EINA_FALSE;
+
+   BUF_APPENDF("%*svector.%s {\n", indent, "", keyword);
+   BUF_APPENDF("%*starget: \"%s\";\n", inner, "", ovr->target_name);
+
+   if (mask & EDJE_VG_OVR_VISIBLE)
+     BUF_APPENDF("%*svisible: %d;\n", inner, "", p->visible);
+   if (mask & EDJE_VG_OVR_COLOR_RAW)
+     BUF_APPENDF("%*scolor: %d %d %d %d;\n", inner, "",
+                 p->color.r, p->color.g, p->color.b, p->color.a);
+   if (mask & EDJE_VG_OVR_COLOR_CLASS)
+     BUF_APPENDF("%*scolor_class: \"%s\";\n", inner, "",
+                 p->color.color_class ? p->color.color_class : "");
+   if (mask & EDJE_VG_OVR_TRANSFORM)
+     ret &= _edje_vg_emit_xform(buf, inner, &p->xform);
+
+   if (ovr->expected_type == EDJE_VG_NODE_SHAPE)
+     {
+        if (mask & EDJE_VG_OVR_PATH)
+          ret &= _edje_vg_emit_path(buf, inner, "", p);
+        if (mask & EDJE_VG_OVR_FILL_RAW)
+          {
+             BUF_APPENDF("%*sfill.color: %d %d %d %d;\n", inner, "",
+                         p->shape.fill.r, p->shape.fill.g, p->shape.fill.b, p->shape.fill.a);
+             if (p->shape.gradient_ref && *p->shape.gradient_ref)
+               BUF_APPENDF("%*sfill.gradient: \"%s\";\n", inner, "", p->shape.gradient_ref);
+          }
+        if (mask & EDJE_VG_OVR_FILL_CLASS)
+          BUF_APPENDF("%*sfill.color_class: \"%s\";\n", inner, "",
+                      p->shape.fill.color_class ? p->shape.fill.color_class : "");
+        if (mask & EDJE_VG_OVR_STROKE_RAW)
+          BUF_APPENDF("%*sstroke.color: %d %d %d %d;\n", inner, "",
+                      p->shape.stroke_color.r, p->shape.stroke_color.g,
+                      p->shape.stroke_color.b, p->shape.stroke_color.a);
+        if (mask & EDJE_VG_OVR_STROKE_CLASS)
+          BUF_APPENDF("%*sstroke.color_class: \"%s\";\n", inner, "",
+                      p->shape.stroke_color.color_class ? p->shape.stroke_color.color_class : "");
+        if (mask & EDJE_VG_OVR_STROKE_WIDTH)
+          BUF_APPENDF("%*sstroke.width: %.10g;\n", inner, "", p->shape.stroke_width);
+        if (mask & EDJE_VG_OVR_STROKE_CAP)
+          BUF_APPENDF("%*sstroke.cap: %s;\n", inner, "", _vg_cap_str(p->shape.stroke_cap));
+        if (mask & EDJE_VG_OVR_STROKE_JOIN)
+          BUF_APPENDF("%*sstroke.join: %s;\n", inner, "", _vg_join_str(p->shape.stroke_join));
+        if ((mask & EDJE_VG_OVR_STROKE_DASH) && (p->shape.stroke_dash_count > 0))
+          ret &= _edje_vg_emit_dash(buf, inner, "stroke.", p->shape.stroke_dash,
+                                    p->shape.stroke_dash_count);
+        if (mask & EDJE_VG_OVR_FILL_RULE)
+          BUF_APPENDF("%*sfill_rule: %s;\n", inner, "", _vg_fill_rule_str(p->shape.fill_rule));
+     }
+   else if (ovr->expected_type != EDJE_VG_NODE_CONTAINER)
+     {
+        if (mask & EDJE_VG_OVR_GRAD_SPREAD)
+          BUF_APPENDF("%*sspread: %s;\n", inner, "", _vg_spread_str(p->gradient.spread));
+        if (mask & EDJE_VG_OVR_GRAD_GEOM)
+          ret &= _edje_vg_emit_gradient_geometry(buf, inner, ovr->expected_type, p);
+        if (mask & EDJE_VG_OVR_GRAD_STOPS)
+          ret &= _edje_vg_emit_stops(buf, inner, p->gradient.stops, p->gradient.stops_count);
+     }
+
+   BUF_APPENDF("%*s}\n", indent, "");
+   return ret;
+}
+
+static Eina_Bool
+_edje_generate_source_of_vectors_block(const Edje_File *ef, Eina_Strbuf *buf)
+{
+   Eina_Bool ret = EINA_TRUE;
+   Eina_Bool any_named = EINA_FALSE;
+   unsigned int i;
+
+   if (!ef->vector_dir) return EINA_TRUE;
+
+   for (i = 0; i < ef->vector_dir->trees_count; i++)
+     {
+        if (ef->vector_dir->trees[i].name)
+          any_named = EINA_TRUE;
+     }
+   if (!any_named) return EINA_TRUE;
+
+   BUF_APPEND(I0 "vectors {\n");
+   for (i = 0; i < ef->vector_dir->trees_count; i++)
+     {
+        const Edje_Vg_Tree *t = &ef->vector_dir->trees[i];
+
+        if (!t->name) continue;
+        BUF_APPEND(I1 "vector {\n");
+        BUF_APPENDF(I2 "name: \"%s\";\n", t->name);
+        ret &= _edje_vg_emit_tree_body(buf, strlen(I2), t);
+        BUF_APPEND(I1 "}\n");
+     }
+   BUF_APPEND(I0 "}\n\n");
+   return ret;
+}
+
+static Eina_Bool
+_edje_generate_source_state_vector(Edje *ed, Edje_Part_Description_Common *pd,
+                                   Eina_Strbuf *buf)
+{
+   Edje_Part_Description_Vector *vd = (Edje_Part_Description_Vector *)pd;
+   const Edje_Vg_Directory *dir = ed->file->vector_dir;
+   const Edje_Vg_Override *ovr;
+   const Eina_List *l;
+   Eina_Bool ret = EINA_TRUE;
+
+   if (vd->vg.tree_id >= 0)
+     {
+        const Edje_Vg_Tree *t;
+
+        if (!dir || ((unsigned int)vd->vg.tree_id >= dir->trees_count))
+          {
+             ERR("Vector tree %d of the state does not exist", vd->vg.tree_id);
+             return EINA_FALSE;
+          }
+        t = &dir->trees[vd->vg.tree_id];
+        if (t->name)
+          {
+             BUF_APPENDF(I5 "vector.use: \"%s\";\n", t->name);
+          }
+        else
+          {
+             BUF_APPEND(I5 "vector {\n");
+             ret &= _edje_vg_emit_tree_body(buf, strlen(I6), t);
+             BUF_APPEND(I5 "}\n");
+          }
+     }
+
+   EINA_LIST_FOREACH(vd->vg.overrides, l, ovr)
+     ret &= _edje_vg_emit_override(buf, strlen(I5), ovr);
+
+   return ret;
+}
+
 static void
 _edje_generate_source_state_image(Edje_Edit *eed, Evas_Object *obj,
                                   const char *part, const char *state, double value,
@@ -15184,6 +15668,10 @@ _edje_generate_source_of_state_inherit(Edje_Edit *eed EINA_UNUSED, Edje_Part *ep
    if (EQ(pd->state.value, ZERO) && !strcmp(pd->state.name, "default"))
      return NULL;
 
+   /* The vector tree of a state is not part of the metric. */
+   if (ep->type == EDJE_PART_TYPE_VECTOR)
+     return NULL;
+
    /*calculate  metric of difference*/
    switch (ep->type)
      {
@@ -15478,6 +15966,10 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s
    if (rp->part->type == EDJE_PART_TYPE_IMAGE)
      _edje_generate_source_state_image(eed, obj, part, state, value, pd, inherit_pd, buf) ;
 
+   //Vector
+   if (rp->part->type == EDJE_PART_TYPE_VECTOR)
+     ret &= _edje_generate_source_state_vector(ed, pd, buf);
+
    //Proxy
    if (rp->part->type == EDJE_PART_TYPE_PROXY)
      _edje_generate_source_state_proxy(ed, pd, inherit_pd, buf);
@@ -16219,6 +16711,15 @@ _edje_generate_source(Evas_Object *obj)
           }
      }
 
+   /* Vectors */
+   ret &= _edje_generate_source_of_vectors_block(ed->file, buf);
+   if (!ret)
+     {
+        ERR("Generating EDC for Vectors");
+        eina_strbuf_free(buf);
+        return NULL;
+     }
+
    /* Styles */
    if ((ll = edje_edit_styles_list_get(obj)))
      {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to