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 771fbf1590c80d1207757ba1e15a8278c00629c3
Author: Cedric BAIL <[email protected]>
AuthorDate: Thu Nov 26 13:14:02 2026 -0600
edje_edit: list, add, delete and bind vector trees
Editors built on edje_edit need to see which vector trees a file has,
which tree a state uses and which overrides it carries, and to change
the binding and the color class of a node. That is what this adds,
under the edje_edit_vector_tree_* and edje_edit_state_vector_* names
that follow the existing file-level and per-state functions.
It does not add node or override property setters: a new tree only
has its root container and a new override sets nothing. Writing nodes
is left to edje_cc until an editor needs it, rather than growing the
API ahead of a user. Edje_Edit.h stays behind
EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT.
Deleting a tree shifts the index of the trees after it, so every
group that refers to them is renumbered and written back, including
groups that are not loaded, like edje_edit_vector_del does for vector
images. A renumbered group stays loaded until the edit object is
deleted: Eet keeps serving the old copy of a group written while the
file is open. Every call that changes what a part draws refreshes the
live object.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/lib/edje/Edje_Edit.h | 244 +++++++++++++++++++++++
src/lib/edje/edje_cache.c | 2 +-
src/lib/edje/edje_edit.c | 462 ++++++++++++++++++++++++++++++++++++++++++++
src/lib/edje/edje_private.h | 1 +
4 files changed, 708 insertions(+), 1 deletion(-)
diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h
index e3761f3d70..e1d43f1b17 100644
--- a/src/lib/edje/Edje_Edit.h
+++ b/src/lib/edje/Edje_Edit.h
@@ -8946,6 +8946,250 @@ EAPI extern Eina_Error EDJE_EDIT_ERROR_GROUP_REFERENCED;
EAPI extern Eina_Error EDJE_EDIT_ERROR_GROUP_DOES_NOT_EXIST;
+/******************************************************************************/
+/************************** VECTOR TREE API ******************************/
+/******************************************************************************/
+/**
+ * @name Vector Tree API
+ * Functions for the vector trees of the file and the way VECTOR part states
+ * use them.
+ *
+ * A vector tree is a named tree of shapes, gradients and containers declared
+ * in the toplevel @c vectors {} block of an EDC file. A VECTOR part state
+ * shows one with its @c vector.use: statement, and can override properties
+ * of the nodes of the tree with @c vector.shape {} blocks.
+ *
+ * These trees are not the vector images of the image directory, which are
+ * edited with edje_edit_vector_add(), edje_edit_vector_del(),
+ * edje_edit_vectors_list_get() and edje_edit_state_vector_get().
+ *
+ * The edits show on the edited object at once. Use edje_edit_save() to write
+ * them to the file.
+ *
+ * See also: @ref tutorial_edje_vector_states
+ */ //@{
+
+/**
+ * @brief Gets the names of the vector trees of the file.
+ *
+ * @param obj Object being edited.
+ *
+ * @return A list of Eina_Stringshare names, to free with
+ * edje_edit_string_list_free(), or @c NULL if the file has no named
+ * vector tree.
+ *
+ * @since 1.30
+ * @see edje_edit_vector_tree_exists()
+ */
+EAPI Eina_List *edje_edit_vector_trees_list_get(Evas_Object *obj);
+
+/**
+ * @brief Checks if the file has a vector tree.
+ *
+ * @param obj Object being edited.
+ * @param name The name of the vector tree.
+ *
+ * @return @c EINA_TRUE if the file has a vector tree called @p name,
+ * @c EINA_FALSE otherwise.
+ *
+ * @since 1.30
+ * @see edje_edit_vector_trees_list_get()
+ */
+EAPI Eina_Bool edje_edit_vector_tree_exists(Evas_Object *obj, const char *name);
+
+/**
+ * @brief Adds an empty vector tree to the file.
+ *
+ * The tree has no node and a viewbox of size 0, and the API cannot add nodes
+ * to it yet.
+ *
+ * @param obj Object being edited.
+ * @param name The name of the new vector tree.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE if @p name is
+ * already used or on error.
+ *
+ * @since 1.30
+ * @see edje_edit_vector_tree_del()
+ */
+EAPI Eina_Bool edje_edit_vector_tree_add(Evas_Object *obj, const char *name);
+
+/**
+ * @brief Removes a vector tree from the file.
+ *
+ * The trees after it move up by one, so the groups of the file that are not
+ * loaded are rewritten in the file with the new numbers.
+ *
+ * @param obj Object being edited.
+ * @param name The name of the vector tree.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE if the tree does not
+ * exist, if a state of any group still uses it (see
+ * edje_edit_state_vector_tree_set()), or on error.
+ *
+ * @since 1.30
+ * @see edje_edit_vector_tree_add()
+ */
+EAPI Eina_Bool edje_edit_vector_tree_del(Evas_Object *obj, const char *name);
+
+/**
+ * @brief Gets the color class of a node of a vector tree.
+ *
+ * @param obj Object being edited.
+ * @param tree The name of the vector tree.
+ * @param node The name of the node in the tree.
+ *
+ * @return The Eina_Stringshare name of the color class of the node, to free
+ * with edje_edit_string_free(), or @c NULL if the node has none or
+ * does not exist. The color classes of the fill and of the stroke
+ * of a shape are not the one of the node.
+ *
+ * @since 1.30
+ * @see edje_edit_vector_tree_node_color_class_set()
+ */
+EAPI const char *edje_edit_vector_tree_node_color_class_get(Evas_Object *obj,
+ const char *tree,
+ const char *node);
+
+/**
+ * @brief Sets the color class of a node of a vector tree.
+ *
+ * The color of the node is multiplied by the color of the class, which can
+ * then be changed at runtime with edje_color_class_set().
+ *
+ * @param obj Object being edited.
+ * @param tree The name of the vector tree.
+ * @param node The name of the node in the tree.
+ * @param class_name The name of the color class, or @c NULL to remove it.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE if the tree or the
+ * node does not exist.
+ *
+ * @since 1.30
+ * @see edje_edit_vector_tree_node_color_class_get()
+ */
+EAPI Eina_Bool edje_edit_vector_tree_node_color_class_set(Evas_Object *obj,
+ const char *tree,
+ const char *node,
+ const char *class_name);
+
+/**
+ * @brief Gets the vector tree used by a part state.
+ *
+ * Part should be of type VECTOR.
+ *
+ * @param obj Object being edited.
+ * @param part Part that contain state.
+ * @param state The name of the state (not including the state value).
+ * @param value The state value.
+ *
+ * @return The Eina_Stringshare name of the vector tree, to free with
+ * edje_edit_string_free(), or @c NULL if the state uses none.
+ *
+ * @since 1.30
+ * @see edje_edit_state_vector_tree_set()
+ */
+EAPI const char *edje_edit_state_vector_tree_get(Evas_Object *obj,
+ const char *part,
+ const char *state,
+ double value);
+
+/**
+ * @brief Sets the vector tree used by a part state.
+ *
+ * Part should be of type VECTOR.
+ *
+ * @param obj Object being edited.
+ * @param part Part that contain state.
+ * @param state The name of the state (not including the state value).
+ * @param value The state value.
+ * @param tree The name of the vector tree, or @c NULL to use none.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE if the part is not
+ * a VECTOR part or if @p tree does not exist.
+ *
+ * @since 1.30
+ * @see edje_edit_state_vector_tree_get()
+ */
+EAPI Eina_Bool edje_edit_state_vector_tree_set(Evas_Object *obj,
+ const char *part,
+ const char *state,
+ double value,
+ const char *tree);
+
+/**
+ * @brief Gets the nodes a part state overrides.
+ *
+ * Part should be of type VECTOR.
+ *
+ * @param obj Object being edited.
+ * @param part Part that contain state.
+ * @param state The name of the state (not including the state value).
+ * @param value The state value.
+ *
+ * @return A list of Eina_Stringshare names of the nodes of the vector tree of
+ * the state, to free with edje_edit_string_list_free(), or @c NULL if
+ * the state overrides none.
+ *
+ * @since 1.30
+ * @see edje_edit_state_vector_override_add()
+ */
+EAPI Eina_List *edje_edit_state_vector_overrides_list_get(Evas_Object *obj,
+ const char *part,
+ const char *state,
+ double value);
+
+/**
+ * @brief Adds an override of a node to a part state.
+ *
+ * The override has no property set, and the API cannot set any yet: it only
+ * exists to be listed and removed.
+ *
+ * Part should be of type VECTOR.
+ *
+ * @param obj Object being edited.
+ * @param part Part that contain state.
+ * @param state The name of the state (not including the state value).
+ * @param value The state value.
+ * @param target The name of the node to override.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE if the state
+ * already overrides @p target or on error.
+ *
+ * @since 1.30
+ * @see edje_edit_state_vector_override_del()
+ */
+EAPI Eina_Bool edje_edit_state_vector_override_add(Evas_Object *obj,
+ const char *part,
+ const char *state,
+ double value,
+ const char *target);
+
+/**
+ * @brief Removes the override of a node from a part state.
+ *
+ * Part should be of type VECTOR.
+ *
+ * @param obj Object being edited.
+ * @param part Part that contain state.
+ * @param state The name of the state (not including the state value).
+ * @param value The state value.
+ * @param target The name of the overridden node.
+ *
+ * @return @c EINA_TRUE in case of success, @c EINA_FALSE if the state does
+ * not override @p target.
+ *
+ * @since 1.30
+ * @see edje_edit_state_vector_override_add()
+ */
+EAPI Eina_Bool edje_edit_state_vector_override_del(Evas_Object *obj,
+ const char *part,
+ const char *state,
+ double value,
+ const char *target);
+
+//@}
+
#ifdef __cplusplus
}
#endif
diff --git a/src/lib/edje/edje_cache.c b/src/lib/edje/edje_cache.c
index 9d2cbbd210..8604d19dda 100644
--- a/src/lib/edje/edje_cache.c
+++ b/src/lib/edje/edje_cache.c
@@ -245,7 +245,7 @@ _edje_part_collection_fix(Edje_Part_Collection *edc)
eina_array_flush(&hist);
}
-static Edje_Part_Collection *
+Edje_Part_Collection *
_edje_file_coll_open(Edje_File *edf, const char *coll)
{
Edje_Part_Collection *edc = NULL;
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 9b057c3ed3..2f153e67b0 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -104,6 +104,7 @@ struct _Edje_Edit
Eina_Hash *program_scripts;
Eina_List *errors;
+ Eina_List *renumbered; /* Edje_Part_Collection, kept loaded by edje_edit_vector_tree_del() */
Eina_Bool bytecode_dirty : 1;
Eina_Bool embryo_source_dirty : 1;
@@ -156,6 +157,12 @@ _edje_edit_data_clean(Edje_Edit *eed)
EOLIAN static void
_edje_edit_efl_canvas_group_group_del(Eo *obj, Edje_Edit *eed)
{
+ Edje_Part_Collection *col;
+
+ EINA_LIST_FREE(eed->renumbered, col)
+ {
+ _edje_cache_coll_unref(eed->base->file, col);
+ }
_edje_edit_data_clean(eed);
efl_canvas_group_del(efl_super(obj, MY_CLASS));
@@ -17280,6 +17287,461 @@ edje_edit_print_internal_status(Evas_Object *obj)
*/
}
+static int
+_edje_edit_vector_tree_find(const Edje *ed, const char *name)
+{
+ unsigned int i;
+
+ if (!ed->file || !ed->file->vector_dir) return -1;
+ for (i = 0; i < ed->file->vector_dir->trees_count; i++)
+ {
+ if (eina_streq(ed->file->vector_dir->trees[i].name, name))
+ return (int)i;
+ }
+ return -1;
+}
+
+static Edje_Part_Description_Vector *
+_edje_edit_vector_desc_nth(const Edje_Part *ep, unsigned int n)
+{
+ return (Edje_Part_Description_Vector *)((n == 0) ? ep->default_desc : ep->other.desc[n - 1]);
+}
+
+static Eina_Bool
+_edje_edit_collection_uses_vector_tree(const Edje_Part_Collection *col, int tree_id)
+{
+ unsigned int i, n;
+
+ for (i = 0; i < col->parts_count; i++)
+ {
+ const Edje_Part *ep = col->parts[i];
+
+ if (ep->type != EDJE_PART_TYPE_VECTOR) continue;
+ for (n = 0; n <= ep->other.desc_count; n++)
+ {
+ if (_edje_edit_vector_desc_nth(ep, n)->vg.tree_id == tree_id)
+ return EINA_TRUE;
+ }
+ }
+ return EINA_FALSE;
+}
+
+/* Returns whether a tree index of the collection changed. */
+static Eina_Bool
+_edje_edit_collection_vector_tree_removed(Edje_Part_Collection *col, int removed_id)
+{
+ Eina_Bool changed = EINA_FALSE;
+ unsigned int i, n;
+
+ for (i = 0; i < col->parts_count; i++)
+ {
+ const Edje_Part *ep = col->parts[i];
+
+ if (ep->type != EDJE_PART_TYPE_VECTOR) continue;
+ for (n = 0; n <= ep->other.desc_count; n++)
+ {
+ Edje_Part_Description_Vector *vd = _edje_edit_vector_desc_nth(ep, n);
+
+ if (vd->vg.tree_id > removed_id)
+ {
+ vd->vg.tree_id--;
+ changed = EINA_TRUE;
+ }
+ }
+ }
+ return changed;
+}
+
+/* The color classes a tree refers to are observed by the objects showing a
+ * description that uses it, so the observers follow the edits of the tree. */
+static void
+_edje_edit_vector_tree_users_observe(Edje *ed, int tree_id, Eina_Bool observe)
+{
+ unsigned int i, n;
+
+ for (i = 0; i < ed->collection->parts_count; i++)
+ {
+ const Edje_Part *ep = ed->collection->parts[i];
+
+ if (ep->type != EDJE_PART_TYPE_VECTOR) continue;
+ for (n = 0; n <= ep->other.desc_count; n++)
+ {
+ Edje_Part_Description_Vector *vd = _edje_edit_vector_desc_nth(ep, n);
+
+ if (vd->vg.tree_id == tree_id)
+ _edje_vg_desc_color_classes_observe(ed, vd, observe);
+ }
+ }
+}
+
+static void
+_edje_edit_vector_refresh(Evas_Object *obj, Edje *ed)
+{
+ _edje_vg_color_class_invalidate(ed, NULL);
+ edje_object_calc_force(obj);
+}
+
+EAPI Eina_List *
+edje_edit_vector_trees_list_get(Evas_Object *obj)
+{
+ Eina_List *trees = NULL;
+ unsigned int i;
+
+ GET_ED_OR_RETURN(NULL);
+
+ if (!ed->file || !ed->file->vector_dir) return NULL;
+
+ for (i = 0; i < ed->file->vector_dir->trees_count; i++)
+ {
+ if (ed->file->vector_dir->trees[i].name)
+ trees = eina_list_append(trees,
+ eina_stringshare_add(ed->file->vector_dir->trees[i].name));
+ }
+ return trees;
+}
+
+EAPI Eina_Bool
+edje_edit_vector_tree_exists(Evas_Object *obj, const char *name)
+{
+ GET_ED_OR_RETURN(EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
+
+ return _edje_edit_vector_tree_find(ed, name) >= 0;
+}
+
+EAPI Eina_Bool
+edje_edit_vector_tree_add(Evas_Object *obj, const char *name)
+{
+ Edje_Vg_Directory *dir;
+ Edje_Vg_Tree *trees;
+ Edje_Vg_Tree *tree;
+
+ GET_EED_OR_RETURN(EINA_FALSE);
+ GET_ED_OR_RETURN(EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
+
+ if (!ed->file) return EINA_FALSE;
+ if (_edje_edit_vector_tree_find(ed, name) >= 0) return EINA_FALSE;
+
+ if (!ed->file->vector_dir)
+ {
+ ed->file->vector_dir = _alloc(sizeof(Edje_Vg_Directory));
+ if (!ed->file->vector_dir) return EINA_FALSE;
+ }
+ dir = ed->file->vector_dir;
+
+ trees = realloc(dir->trees, sizeof(Edje_Vg_Tree) * (dir->trees_count + 1));
+ if (!trees) return EINA_FALSE;
+ dir->trees = trees;
+
+ tree = &dir->trees[dir->trees_count];
+ memset(tree, 0, sizeof(Edje_Vg_Tree));
+ tree->root = _edje_vg_node_new(EDJE_VG_NODE_CONTAINER);
+ if (!tree->root) return EINA_FALSE;
+ _edje_if_string_replace(ed, &tree->name, name);
+ dir->trees_count++;
+
+ _edje_edit_flag_script_dirty(eed, EINA_TRUE);
+ return EINA_TRUE;
+}
+
+EAPI Eina_Bool
+edje_edit_vector_tree_del(Evas_Object *obj, const char *name)
+{
+ Edje_Part_Collection_Directory_Entry *ce;
+ Edje_Vg_Directory *dir;
+ Edje_Vg_Tree *tree;
+ Eina_Iterator *it;
+ Eet_File *eetf;
+ Eina_Bool ret = EINA_TRUE;
+ int tree_id;
+
+ GET_EED_OR_RETURN(EINA_FALSE);
+ GET_ED_OR_RETURN(EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
+
+ if (!ed->file) return EINA_FALSE;
+ tree_id = _edje_edit_vector_tree_find(ed, name);
+ if (tree_id < 0) return EINA_FALSE;
+
+ it = eina_hash_iterator_data_new(ed->file->collection);
+ EINA_ITERATOR_FOREACH(it, ce)
+ {
+ Edje_Part_Collection *col;
+ Eina_Bool used;
+
+ if (ce->group_alias) continue;
+ col = _edje_file_coll_open(ed->file, ce->entry);
+ if (!col)
+ {
+ ERR("Unable to open group \"%s\" to look for the users of vector tree \"%s\"",
+ ce->entry, name);
+ eina_iterator_free(it);
+ return EINA_FALSE;
+ }
+ used = _edje_edit_collection_uses_vector_tree(col, tree_id);
+ _edje_cache_coll_unref(ed->file, col);
+ if (used)
+ {
+ WRN("Vector tree \"%s\" is used by group \"%s\"", name, ce->entry);
+ eina_iterator_free(it);
+ return EINA_FALSE;
+ }
+ }
+ eina_iterator_free(it);
+
+ dir = ed->file->vector_dir;
+ tree = &dir->trees[tree_id];
+ if ((unsigned int)tree_id == (dir->trees_count - 1))
+ {
+ _edje_if_string_free(ed, &tree->name);
+ _edje_vg_tree_free_fields(tree, EINA_FALSE);
+ dir->trees_count--;
+ _edje_edit_flag_script_dirty(eed, EINA_TRUE);
+ _edje_edit_vector_refresh(obj, ed);
+ return EINA_TRUE;
+ }
+
+ /* The groups that are not loaded are rewritten in the file with the
+ * renumbered trees, as nothing else would keep their changes. The file
+ * handle of ed->file keeps reading the file as it was before the write, so
+ * a renumbered group stays loaded until obj is deleted: reading it back
+ * would undo the change. */
+ eetf = _edje_edit_eet_open(ed, EET_FILE_MODE_READ_WRITE);
+ if (!eetf) return EINA_FALSE;
+
+ _edje_if_string_free(ed, &tree->name);
+ _edje_vg_tree_free_fields(tree, EINA_FALSE);
+ memmove(tree, tree + 1, sizeof(Edje_Vg_Tree) * (dir->trees_count - tree_id - 1));
+ dir->trees_count--;
+
+ it = eina_hash_iterator_data_new(ed->file->collection);
+ EINA_ITERATOR_FOREACH(it, ce)
+ {
+ Edje_Part_Collection *col;
+ Eina_Bool loaded;
+
+ if (ce->group_alias) continue;
+ loaded = !!ce->ref;
+ col = _edje_file_coll_open(ed->file, ce->entry);
+ if (!col)
+ {
+ ERR("Unable to open group \"%s\" to renumber its vector trees", ce->entry);
+ ret = EINA_FALSE;
+ continue;
+ }
+ if (_edje_edit_collection_vector_tree_removed(col, tree_id))
+ {
+ ret &= _edje_edit_collection_save(eetf, col);
+ if (!loaded)
+ {
+ eed->renumbered = eina_list_append(eed->renumbered, col);
+ continue;
+ }
+ }
+ _edje_cache_coll_unref(ed->file, col);
+ }
+ eina_iterator_free(it);
+
+ ret &= _edje_edit_edje_file_save(eetf, ed->file);
+ _edje_edit_eet_close(eetf);
+
+ _edje_edit_flag_script_dirty(eed, EINA_TRUE);
+ _edje_edit_vector_refresh(obj, ed);
+ return ret;
+}
+
+EAPI const char *
+edje_edit_state_vector_tree_get(Evas_Object *obj, const char *part,
+ const char *state, double value)
+{
+ Edje_Part_Description_Vector *vd;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(state, NULL);
+
+ GET_PD_OR_RETURN(NULL);
+
+ if (rp->part->type != EDJE_PART_TYPE_VECTOR) return NULL;
+ vd = (Edje_Part_Description_Vector *)pd;
+
+ if (!ed->file || !ed->file->vector_dir || (vd->vg.tree_id < 0) ||
+ ((unsigned int)vd->vg.tree_id >= ed->file->vector_dir->trees_count))
+ return NULL;
+ return eina_stringshare_add(ed->file->vector_dir->trees[vd->vg.tree_id].name);
+}
+
+EAPI Eina_Bool
+edje_edit_state_vector_tree_set(Evas_Object *obj, const char *part,
+ const char *state, double value,
+ const char *tree)
+{
+ Edje_Part_Description_Vector *vd;
+ int tree_id = -1;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(part, EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(state, EINA_FALSE);
+
+ GET_PD_OR_RETURN(EINA_FALSE);
+
+ if (rp->part->type != EDJE_PART_TYPE_VECTOR) return EINA_FALSE;
+ vd = (Edje_Part_Description_Vector *)pd;
+
+ if (tree)
+ {
+ tree_id = _edje_edit_vector_tree_find(ed, tree);
+ if (tree_id < 0) return EINA_FALSE;
+ }
+
+ _edje_vg_desc_color_classes_observe(ed, vd, EINA_FALSE);
+ vd->vg.tree_id = tree_id;
+ _edje_vg_desc_color_classes_observe(ed, vd, EINA_TRUE);
+
+ _edje_edit_flag_script_dirty(eed, EINA_TRUE);
+ _edje_edit_vector_refresh(obj, ed);
+ return EINA_TRUE;
+}
+
+EAPI Eina_List *
+edje_edit_state_vector_overrides_list_get(Evas_Object *obj, const char *part,
+ const char *state, double value)
+{
+ Edje_Part_Description_Vector *vd;
+ Edje_Vg_Override *ovr;
+ Eina_List *targets = NULL;
+ Eina_List *l;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(state, NULL);
+
+ GET_PD_OR_RETURN(NULL);
+
+ if (rp->part->type != EDJE_PART_TYPE_VECTOR) return NULL;
+ vd = (Edje_Part_Description_Vector *)pd;
+
+ EINA_LIST_FOREACH(vd->vg.overrides, l, ovr)
+ targets = eina_list_append(targets, eina_stringshare_add(ovr->target_name));
+ return targets;
+}
+
+EAPI Eina_Bool
+edje_edit_state_vector_override_add(Evas_Object *obj, const char *part,
+ const char *state, double value,
+ const char *target)
+{
+ Edje_Part_Description_Vector *vd;
+ Edje_Vg_Override *ovr;
+ Eina_List *l;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(part, EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(state, EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(target, EINA_FALSE);
+
+ GET_PD_OR_RETURN(EINA_FALSE);
+
+ if (rp->part->type != EDJE_PART_TYPE_VECTOR) return EINA_FALSE;
+ vd = (Edje_Part_Description_Vector *)pd;
+
+ EINA_LIST_FOREACH(vd->vg.overrides, l, ovr)
+ {
+ if (eina_streq(ovr->target_name, target)) return EINA_FALSE;
+ }
+
+ ovr = _alloc(sizeof(Edje_Vg_Override));
+ if (!ovr) return EINA_FALSE;
+ _edje_if_string_replace(ed, &ovr->target_name, target);
+ vd->vg.overrides = eina_list_append(vd->vg.overrides, ovr);
+
+ _edje_edit_flag_script_dirty(eed, EINA_TRUE);
+ _edje_edit_vector_refresh(obj, ed);
+ return EINA_TRUE;
+}
+
+EAPI Eina_Bool
+edje_edit_state_vector_override_del(Evas_Object *obj, const char *part,
+ const char *state, double value,
+ const char *target)
+{
+ Edje_Part_Description_Vector *vd;
+ Edje_Vg_Override *ovr;
+ Eina_List *l;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(part, EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(state, EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(target, EINA_FALSE);
+
+ GET_PD_OR_RETURN(EINA_FALSE);
+
+ if (rp->part->type != EDJE_PART_TYPE_VECTOR) return EINA_FALSE;
+ vd = (Edje_Part_Description_Vector *)pd;
+
+ EINA_LIST_FOREACH(vd->vg.overrides, l, ovr)
+ {
+ if (!eina_streq(ovr->target_name, target)) continue;
+
+ _edje_vg_desc_color_classes_observe(ed, vd, EINA_FALSE);
+ vd->vg.overrides = eina_list_remove_list(vd->vg.overrides, l);
+ _edje_vg_desc_color_classes_observe(ed, vd, EINA_TRUE);
+
+ _edje_if_string_free(ed, &ovr->target_name);
+ _edje_vg_override_free(ovr, EINA_FALSE);
+
+ _edje_edit_flag_script_dirty(eed, EINA_TRUE);
+ _edje_edit_vector_refresh(obj, ed);
+ return EINA_TRUE;
+ }
+ return EINA_FALSE;
+}
+
+EAPI const char *
+edje_edit_vector_tree_node_color_class_get(Evas_Object *obj, const char *tree,
+ const char *node)
+{
+ Edje_Vg_Node *n;
+ int tree_id;
+
+ GET_ED_OR_RETURN(NULL);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(tree, NULL);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(node, NULL);
+
+ tree_id = _edje_edit_vector_tree_find(ed, tree);
+ if (tree_id < 0) return NULL;
+
+ n = _edje_vg_tree_node_by_name(&ed->file->vector_dir->trees[tree_id], node);
+ if (!n || !n->color.color_class) return NULL;
+ return eina_stringshare_add(n->color.color_class);
+}
+
+EAPI Eina_Bool
+edje_edit_vector_tree_node_color_class_set(Evas_Object *obj, const char *tree,
+ const char *node, const char *class_name)
+{
+ Edje_Vg_Node *n;
+ int tree_id;
+
+ GET_EED_OR_RETURN(EINA_FALSE);
+ GET_ED_OR_RETURN(EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(tree, EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(node, EINA_FALSE);
+
+ tree_id = _edje_edit_vector_tree_find(ed, tree);
+ if (tree_id < 0) return EINA_FALSE;
+
+ n = _edje_vg_tree_node_by_name(&ed->file->vector_dir->trees[tree_id], node);
+ if (!n) return EINA_FALSE;
+
+ _edje_edit_vector_tree_users_observe(ed, tree_id, EINA_FALSE);
+ if (class_name)
+ _edje_if_string_replace(ed, &n->color.color_class, class_name);
+ else
+ _edje_if_string_free(ed, &n->color.color_class);
+ _edje_edit_vector_tree_users_observe(ed, tree_id, EINA_TRUE);
+
+ _edje_edit_flag_script_dirty(eed, EINA_TRUE);
+ _edje_edit_vector_refresh(obj, ed);
+ return EINA_TRUE;
+}
+
/* Internal EO APIs and hidden overrides */
#define EDJE_EDIT_EXTRA_OPS \
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index f444bb7c4d..aaf8a02e62 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -2841,6 +2841,7 @@ Edje_File *_edje_file_cache_find(const Eina_File *file);
void _edje_cache_coll_clean(Edje_File *edf);
void _edje_cache_coll_flush(Edje_File *edf);
void _edje_cache_coll_unref(Edje_File *edf, Edje_Part_Collection *edc);
+Edje_Part_Collection *_edje_file_coll_open(Edje_File *edf, const char *coll);
EAPI void edje_cache_emp_alloc(Edje_Part_Collection_Directory_Entry *ce);
EAPI void edje_cache_emp_free(Edje_Part_Collection_Directory_Entry *ce);
EAPI void _edje_cache_file_unref(Edje_File *edf);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.