Evas_Object *obj ///< The edje object
);
-/**Create a new data object in the given edje
- * If another data with the same name exists nothing is created and FALSE is returned.
+/** Create a new *global* data object in the given edje file. If
+ * another data entry with the same name exists, nothing is created and
+ * FALSE is returned.
*/
+
EAPI Eina_Bool ///@return TRUE on success
edje_edit_data_add(
Evas_Object *obj, ///< The edje object
const char *newname ///< The new name to set
);
+/** Create a new data object in the given edje file *belonging to the
+ * current group*. If another data entry with the same name exists,
+ * nothing is created and FALSE is returned.
+ */
+
+/** Retrieves a list with the item names inside the data block **/
+EAPI Eina_List * ///@return An Eina_List* of string (char *) containing all the data names.
+edje_edit_group_data_list_get(
+ Evas_Object *obj ///< The edje object
+);
+
+EAPI Eina_Bool ///@return EINA_TRUE on success
+edje_edit_group_data_add(
+ Evas_Object *obj, ///< The edje object
+ const char *itemname, ///< The name for the new data
+ const char *value ///< The value for the new data
+);
+
+/** Delete the given data object from edje */
+EAPI Eina_Bool ///@return EINA_TRUE on success
+edje_edit_group_data_del(
+ Evas_Object *obj, ///< The edje object
+ const char *itemname ///< The name of the data to remove
+);
+
+/** Get the data associated with the given itemname **/
+EAPI const char * ///@return The data value
+edje_edit_group_data_value_get(
+ Evas_Object * obj, ///< The edje object
+ char *itemname ///< The name of the data item
+);
+
+/** Set the data associated with the given itemname **/
+EAPI Eina_Bool ///@return EINA_TRUE on success
+edje_edit_group_data_value_set(
+ Evas_Object * obj, ///< The edje object
+ const char *itemname, ///< The name of the data item
+ const char *value ///< The new value to set
+);
+
+/** Change the name of the given data object */
+EAPI Eina_Bool ///@return EINA_TRUE on success
+edje_edit_group_data_name_set(
+ Evas_Object *obj, ///< The edje object
+ const char *itemname, ///< The name of the data item
+ const char *newname ///< The new name to set
+);
+
//@}
/******************************************************************************/
/*********************** COLOR CLASSES API ********************************/
return NULL;
s = _edje_edit_style_get(ed, style);
-
+
EINA_LIST_FOREACH(s->tags, l, t)
if (t->key && !strcmp(t->key, name))
return t;
/***************/
EAPI Eina_List *
+edje_edit_group_data_list_get(Evas_Object * obj)
+{
+ Eina_List *datas;
+ Eina_List *l;
+ Edje_Data *d;
+
+ GET_ED_OR_RETURN(NULL);
+
+ if (!ed->file || !ed->collection)
+ return NULL;
+
+ datas = NULL;
+ EINA_LIST_FOREACH(ed->collection->data, l, d)
+ datas = eina_list_append(datas, eina_stringshare_add(d->key));
+
+ return datas;
+}
+
+EAPI Eina_List *
edje_edit_data_list_get(Evas_Object * obj)
{
Eina_List *datas = NULL;
}
EAPI Eina_Bool
+edje_edit_group_data_add(Evas_Object *obj, const char *key, const char *value)
+{
+ Edje_Data *new;
+ Edje_Data *d;
+ Eina_List *l;
+ int len;
+
+ GET_ED_OR_RETURN(EINA_FALSE);
+
+ if (!key || !ed->file || !ed->collection)
+ return EINA_FALSE;
+
+ len = strlen(key);
+ EINA_LIST_FOREACH(ed->collection->data, l, d)
+ if ((d->key) && (!strncmp(d->key, key, len)))
+ return EINA_FALSE;
+
+ new = _alloc(sizeof(Edje_Data));
+ if (!new) return EINA_FALSE;
+
+ new->key = (char*)eina_stringshare_add(key);
+ if (value) new->value = (char*)eina_stringshare_add(value);
+ else new->value = NULL;
+
+ ed->collection->data = eina_list_append(ed->collection->data, new);
+
+ return EINA_TRUE;
+}
+
+EAPI Eina_Bool
edje_edit_data_add(Evas_Object *obj, const char *itemname, const char *value)
{
Eina_List *l;
}
EAPI Eina_Bool
+edje_edit_group_data_del(Evas_Object *obj, const char *key)
+{
+ Eina_List *l;
+ Edje_Data *d;
+ int len;
+
+ GET_ED_OR_RETURN(EINA_FALSE);
+
+ if (!key || !ed->file || !ed->collection)
+ return EINA_FALSE;
+
+ len = strlen(key);
+ EINA_LIST_FOREACH(ed->collection->data, l, d)
+ {
+ if (strncmp(d->key, key, len) == 0)
+ {
+ _edje_if_string_free(ed, d->key);
+ _edje_if_string_free(ed, d->value);
+ ed->collection->data = eina_list_remove(ed->collection->data, d);
+ free(d);
+ return EINA_TRUE;
+ }
+ }
+
+ return EINA_FALSE;
+}
+
+EAPI Eina_Bool
edje_edit_data_del(Evas_Object *obj, const char *itemname)
{
Eina_List *l;
}
EAPI const char *
+edje_edit_group_data_value_get(Evas_Object * obj, char *key)
+{
+ Eina_List *l;
+ Edje_Data *d;
+ int len;
+
+ GET_ED_OR_RETURN(NULL);
+
+ if (!key || !ed->file || !ed->collection)
+ return NULL;
+
+ len = strlen(key);
+ EINA_LIST_FOREACH(ed->collection->data, l, d)
+ if (strncmp(d->key, key, len) == 0)
+ return eina_stringshare_add(d->value);
+
+ return NULL;
+}
+
+EAPI const char *
edje_edit_data_value_get(Evas_Object * obj, char *itemname)
{
Eina_List *l;
}
EAPI Eina_Bool
+edje_edit_group_data_value_set(Evas_Object *obj, const char *key, const char *value)
+{
+ Eina_List *l;
+ Edje_Data *d;
+ int len;
+
+ GET_ED_OR_RETURN(EINA_FALSE);
+
+ if (!key || !value || !ed->file || !ed->collection)
+ return EINA_FALSE;
+
+ len = strlen(key);
+ EINA_LIST_FOREACH(ed->collection->data, l, d)
+ if (strncmp(d->key, key, len) == 0)
+ {
+ _edje_if_string_free(ed, d->value);
+ d->value = (char*)eina_stringshare_add(value);
+ return EINA_TRUE;
+ }
+
+ return EINA_FALSE;
+}
+
+EAPI Eina_Bool
edje_edit_data_value_set(Evas_Object *obj, const char *itemname, const char *value)
{
Eina_List *l;
}
EAPI Eina_Bool
+edje_edit_group_data_name_set(Evas_Object *obj, const char *key, const char *new_key)
+{
+ Eina_List *l;
+ Edje_Data *d;
+ int len;
+
+ GET_ED_OR_RETURN(EINA_FALSE);
+
+ if (!key || !new_key || !ed->file || !ed->collection) {
+ return EINA_FALSE;
+ }
+
+ len = strlen(key);
+ EINA_LIST_FOREACH(ed->collection->data, l, d) {
+ if (strncmp(d->key, key, len) == 0)
+ {
+ _edje_if_string_free(ed, d->key);
+ d->key = (char*)eina_stringshare_add(new_key);
+ return EINA_TRUE;
+ }
+ }
+
+ return EINA_FALSE;
+}
+
+EAPI Eina_Bool
edje_edit_data_name_set(Evas_Object *obj, const char *itemname, const char *newname)
{
Eina_List *l;
edje_edit_style_del(Evas_Object * obj, const char* style)
{
Edje_Style *s;
-
+
GET_ED_OR_RETURN();
//printf("DEL STYLE '%s'\n", style);
-
+
s = _edje_edit_style_get(ed, style);
if (!s) return;
-
+
ed->file->styles = eina_list_remove(ed->file->styles, s);
-
+
_edje_if_string_free(ed, s->name);
//~ //s->style HOWTO FREE ???
while (s->tags)
Edje_Style_Tag *t;
t = s->tags->data;
-
+
s->tags = eina_list_remove(s->tags, t);
_edje_if_string_free(ed, t->key);
_edje_if_string_free(ed, t->value);
if (!ed->file || !ed->file->styles || !style || !tag)
return;
-
+
t = _edje_edit_style_tag_get(ed, style, tag);
if (!t) return;
_edje_if_string_free(ed, t->key);
if (!ed->file || !ed->file->styles || !style || !tag)
return;
-
+
t = _edje_edit_style_tag_get(ed, style, tag);
if (!t) return;
_edje_if_string_free(ed, t->value);
{
Edje_Style *s;
Edje_Style_Tag *t;
-
+
GET_ED_OR_RETURN(0);
//printf("ADD TAG '%s' IN STYLE '%s'\n", tag_name, style);
{
Edje_Style *s;
Edje_Style_Tag *t;
-
+
GET_ED_OR_RETURN();
//printf("DEL TAG '%s' IN STYLE '%s'\n", tag, style);
-
+
s = _edje_edit_style_get(ed, style);
t = _edje_edit_style_tag_get(ed, style, tag);
if ((rp->part->type == EDJE_PART_TYPE_EXTERNAL) && (rp->part->source))
{
Edje_External_Param_Info *pi;
-
+
pi = (Edje_External_Param_Info *)edje_external_param_info_get(rp->part->source);
while (pi && pi->name)
{
Eina_List *l, *ll;
Edje_Real_Part *rp;
const char *str;
-
+
GET_PD_OR_RETURN();
-
+
rp = _edje_real_part_get(ed, part);
if (!rp) return;
-
+
fprintf(f, I4"description { state: \"%s\" %g;\n", pd->state.name, pd->state.value);
//TODO Support inherit
-
+
if (!pd->visible)
fprintf(f, I5"visible: 0;\n");
-
+
if (pd->align.x != 0.5 || pd->align.y != 0.5)
fprintf(f, I5"align: %g %g;\n", TO_DOUBLE(pd->align.x), TO_DOUBLE(pd->align.y));
-
+
//TODO Support fixed
-
+
if (pd->min.w || pd->min.h)
fprintf(f, I5"min: %d %d;\n", pd->min.w, pd->min.h);
if (pd->max.w != -1 || pd->max.h != -1)
fprintf(f, I5"max: %d %d;\n", pd->max.w, pd->max.h);
-
+
//TODO Support step
-
+
if (pd->aspect.min || pd->aspect.max)
fprintf(f, I5"aspect: %g %g;\n", TO_DOUBLE(pd->aspect.min), TO_DOUBLE(pd->aspect.max));
if (pd->aspect.prefer)
fprintf(f, I5"aspect_preference: %s;\n", prefers[pd->aspect.prefer]);
-
+
if (pd->color_class)
fprintf(f, I5"color_class: \"%s\";\n", pd->color_class);
-
+
if (pd->color.r != 255 || pd->color.g != 255 ||
pd->color.b != 255 || pd->color.a != 255)
fprintf(f, I5"color: %d %d %d %d;\n",
pd->color3.b != 0 || pd->color3.a != 128)
fprintf(f, I5"color3: %d %d %d %d;\n",
pd->color3.r, pd->color3.g, pd->color3.b, pd->color3.a);
-
+
//Rel1
if (pd->rel1.relative_x || pd->rel1.relative_y || pd->rel1.offset_x ||
pd->rel1.offset_y || pd->rel1.id_x != -1 || pd->rel1.id_y != -1)
}
fprintf(f, I5"}\n");//rel1
}
-
+
//Rel2
if (pd->rel2.relative_x != 1.0 || pd->rel2.relative_y != 1.0 ||
pd->rel2.offset_x != -1 || pd->rel2.offset_y != -1 ||
}
fprintf(f, I5"}\n");//rel2
}
-
+
//Image
if (rp->part->type == EDJE_PART_TYPE_IMAGE)
{
EINA_LIST_FOREACH(ll, l, data)
fprintf(f, I6"tween: \"%s\";\n", data);
edje_edit_string_list_free(ll);
-
+
if (pd->border.l || pd->border.r || pd->border.t || pd->border.b)
fprintf(f, I6"border: %d %d %d %d;\n", pd->border.l, pd->border.r, pd->border.t, pd->border.b);
if (pd->border.no_fill == 1)
fprintf(f, I5"}\n");//image
}
-
+
//Fill
if (rp->part->type == EDJE_PART_TYPE_IMAGE ||
rp->part->type == EDJE_PART_TYPE_GRADIENT)
if (rp->part->type == EDJE_PART_TYPE_GRADIENT && pd->fill.angle)
fprintf(f, I6"angle: %d;\n", pd->fill.angle);
//TODO Support type
-
+
if (pd->fill.pos_rel_x || pd->fill.pos_rel_y ||
pd->fill.pos_abs_x || pd->fill.pos_abs_y)
{
fprintf(f, I7"offset: %d %d;\n", pd->fill.abs_x, pd->fill.abs_y);
fprintf(f, I6"}\n");
}
-
+
fprintf(f, I5"}\n");
}
-
+
//Text
if (rp->part->type == EDJE_PART_TYPE_TEXT)
{
fprintf(f, I5"}\n");
}
}
-
+
fprintf(f, I4"}\n");//description
}
EINA_LIST_FOREACH(ll, l, data)
_edje_generate_source_of_state(obj, part, data, f);
edje_edit_string_list_free(ll);
-
+
fprintf(f, I3"}\n");//part
}
obj = edje_object_add(ed->evas);
if (!edje_object_file_set(obj, ed->file->path, group)) return;
-
+
fprintf(f, I1"group { name: \"%s\";\n", group);
//TODO Support alias:
w = edje_edit_group_min_w_get(obj);
h = edje_edit_group_max_h_get(obj);
if ((w > -1) || (h > -1))
fprintf(f, I2"max: %d %d;\n", w, h);
- //TODO Support data
+
+ /* Data */
+ if ((ll = edje_edit_group_data_list_get(obj)))
+ {
+ fprintf(f, I2"data {\n");
+
+ EINA_LIST_FOREACH(ll, l, data)
+ {
+ fprintf(f, I3"item: \"%s\" \"%s\";\n", data,
+ edje_edit_group_data_value_get(obj, data));
+ }
+
+ fprintf(f, I2"}\n\n");
+ edje_edit_string_list_free(ll);
+ }
+
//TODO Support script
/* Parts */
fprintf(f, I2 "}\n");
edje_edit_string_list_free(ll);
}
-
-
+
+
fprintf(f, " }\n");//group
-
-
+
+
evas_object_del(obj);
}
Edje_Font_Directory_Entry *fnt;
GET_ED_OR_RETURN(NULL);
-
+
/* Open a temp file */
#ifdef HAVE_EVIL
snprintf(tmpn, PATH_MAX, "%s/edje_edit.edc-tmp-XXXXXX", evil_tmpdir_get());
/* Write edc into file */
//TODO Probably we need to save the file before generation
-
+
/* Images */
if ((ll = edje_edit_images_list_get(obj)))
{
fprintf(f, I0 "}\n\n");
edje_edit_string_list_free(ll);
}
-
+
/* Spectrum */
if ((ll = edje_edit_spectrum_list_get(obj)))
{
if (strcmp(ef->compiler, "edje_edit"))
{
_edje_if_string_free(ed, ef->compiler);
- ef->compiler = eina_stringshare_add("edje_edit");
+ ef->compiler = (char *)eina_stringshare_add("edje_edit");
}
if (!_edje_edit_edje_file_save(eetf, ef))
_edje_generate_source(obj);
return;
-
+
INF("\n****** CHECKIN' INTERNAL STRUCTS STATUS *********");
INF("*** Edje\n");