check_arg_count(1);
if (!edje_file->external_dir)
- edje_file->external_dir = mem_alloc(SZ(Edje_External_Directory));
+ edje_file->external_dir = mem_alloc(SZ(Old_Edje_External_Directory));
ex = mem_alloc(SZ(External));
ex->name = parse_str(0);
int v;
if (!edje_file->image_dir)
- edje_file->image_dir = mem_alloc(SZ(Edje_Image_Directory));
+ edje_file->image_dir = mem_alloc(SZ(Old_Edje_Image_Directory));
img = mem_alloc(SZ(Edje_Image_Directory_Entry));
img->entry = parse_str(0);
{
{
if (!strcmp(limg->entry, img->entry))
{
- free(img->entry);
+ free((char*) img->entry);
free(img);
return;
}
Edje_Image_Directory_Set *set;
if (!edje_file->image_dir)
- edje_file->image_dir = mem_alloc(SZ(Edje_Image_Directory));
+ edje_file->image_dir = mem_alloc(SZ(Old_Edje_Image_Directory));
set = mem_alloc(SZ(Edje_Image_Directory_Set));
set->id = eina_list_count(edje_file->image_dir->sets);
edje_file->image_dir->sets = eina_list_append(edje_file->image_dir->sets, set);
check_arg_count(2);
if (!edje_file->font_dir)
- edje_file->font_dir = mem_alloc(SZ(Edje_Font_Directory));
+ edje_file->font_dir = mem_alloc(SZ(Old_Edje_Font_Directory));
fn = mem_alloc(SZ(Font));
fn->file = parse_str(0);
char *file_in = NULL;
char *file_out = NULL;
-Edje_File *edje_file = NULL;
+Old_Edje_File *edje_file = NULL;
SrcFile_List *srcfiles = NULL;
Font_List *fontlist = NULL;
}
if (!set)
- set = eina_list_nth(ed->file->image_dir->sets, id);
+ set = ed->file->image_dir->sets + id;
EINA_LIST_FOREACH(set->entries, l, entry)
{
Edje_Image_Directory_Entry *ie;
if (!ed->file->image_dir) ie = NULL;
- else ie = eina_list_nth(ed->file->image_dir->entries, (-image_id) - 1);
+ else ie = ed->file->image_dir->entries + (-image_id) - 1;
if ((ie) &&
(ie->source_type == EDJE_IMAGE_SOURCE_TYPE_EXTERNAL) &&
(ie->entry))
free(ce);
}
+static Eina_Bool
+_edje_file_convert_external(Edje_File *edf, Old_Edje_File *oedf)
+{
+ Edje_External_Directory_Entry *ede;
+ unsigned int max;
+ unsigned int i = 0;
+
+ edf->external_dir = calloc(1, sizeof (Edje_External_Directory));
+ if (!edf->external_dir) return EINA_FALSE;
+ if (!oedf->external_dir) return EINA_TRUE;
+
+ max = eina_list_count(oedf->external_dir->entries);
+ edf->external_dir->entries = calloc(1, sizeof (Edje_External_Directory_Entry) * max);
+ edf->external_dir->entries_count = max;
+
+ if (!edf->external_dir->entries && max)
+ return EINA_FALSE;
+
+ EINA_LIST_FREE(oedf->external_dir->entries, ede)
+ {
+ edf->external_dir->entries[i++].entry = ede->entry;
+ free(ede);
+ }
+
+ free(oedf->external_dir);
+ oedf->external_dir = NULL;
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool
+_edje_file_convert_images(Edje_File *edf, Old_Edje_File *oedf)
+{
+ Edje_Image_Directory_Entry *de;
+ Edje_Image_Directory_Set *ds;
+ Eina_List *l;
+ int max;
+
+ edf->image_dir = malloc(sizeof (Edje_Image_Directory));
+ if (!edf->image_dir) return EINA_FALSE;
+ if (!oedf->image_dir) return EINA_TRUE;
+
+ max = -1;
+ EINA_LIST_FOREACH(oedf->image_dir->entries, l, de)
+ if (max < de->id)
+ max = de->id;
+
+ edf->image_dir->entries = calloc(1, sizeof (Edje_Image_Directory_Entry) * (max + 1));
+ edf->image_dir->entries_count = max + 1;
+
+ if (!edf->image_dir->entries && edf->image_dir->entries_count)
+ return EINA_FALSE;
+
+ EINA_LIST_FREE(oedf->image_dir->entries, de)
+ {
+ memcpy(edf->image_dir->entries + de->id,
+ de,
+ sizeof (Edje_Image_Directory_Entry));
+ free(de);
+ }
+
+ max = -1;
+ EINA_LIST_FOREACH(oedf->image_dir->sets, l, ds)
+ if (max < ds->id)
+ max = ds->id;
+
+ edf->image_dir->sets = calloc(1, sizeof (Edje_Image_Directory_Set) * (max + 1));
+ edf->image_dir->sets_count = max + 1;
+
+ if (!edf->image_dir->sets && edf->image_dir->sets_count)
+ {
+ free(edf->image_dir->entries);
+ edf->image_dir->entries = NULL;
+ return EINA_FALSE;
+ }
+
+ EINA_LIST_FREE(oedf->image_dir->sets, ds)
+ {
+ memcpy(edf->image_dir->sets + ds->id,
+ ds,
+ sizeof (Edje_Image_Directory_Set));
+ free(ds);
+ }
+
+ return EINA_TRUE;
+}
+
Edje_File *
_edje_file_convert(Eet_File *file, Old_Edje_File *oedf)
{
Eina_List *l;
Edje_Data *ed;
- edf = malloc(sizeof (Edje_File));
+ edf = calloc(1, sizeof (Edje_File));
if (!edf) return NULL;
edf->free_strings = eet_dictionary_get(file) ? 0 : 1;
edf->data = eina_hash_string_small_new(NULL);
}
+ if (!edf->fonts || !edf->collection || !edf->data)
+ goto on_error;
+
EINA_LIST_FREE(oedf->data, ed)
{
eina_hash_direct_add(edf->data, ed->key, ed->value);
eina_hash_direct_add(edf->fonts, fnt->entry, fnt);
}
+ if (!_edje_file_convert_images(edf, oedf))
+ goto on_error;
+
+ if (!_edje_file_convert_external(edf, oedf))
+ goto on_error;
+
edf->oef = oedf;
- edf->external_dir = oedf->external_dir;
- edf->image_dir = oedf->image_dir;
edf->spectrum_dir = oedf->spectrum_dir;
edf->styles = oedf->styles;
edf->color_classes = oedf->color_classes;
edf->collection_patterns = NULL;
return edf;
+
+ on_error:
+ eina_hash_free(edf->fonts);
+ eina_hash_free(edf->collection);
+ eina_hash_free(edf->data);
+ free(edf->image_dir);
+ free(edf->external_dir);
+ free(edf);
+ return NULL;
}
Edje_Part_Collection *
#ifndef EDJE_CONVERT_H__
# define EDJE_CONVERT_H__
-typedef struct _Edje_Part_Collection Old_Edje_Part_Collection;
+typedef struct _Edje_Part_Collection Old_Edje_Part_Collection;
+typedef struct _Old_Edje_Image_Directory Old_Edje_Image_Directory;
+typedef struct _Old_Edje_Font_Directory Old_Edje_Font_Directory;
+typedef struct _Old_Edje_External_Directory Old_Edje_External_Directory;
+
+struct _Old_Edje_Font_Directory
+{
+ Eina_List *entries; /* a list of Edje_Font_Directory_Entry */
+};
+
+struct _Old_Edje_Image_Directory
+{
+ Eina_List *entries; /* a list of Edje_Image_Directory_Entry */
+ Eina_List *sets; /* a list of Edje_Image_Directory_Set */
+};
+
+struct _Old_Edje_External_Directory
+{
+ Eina_List *entries; /* a list of Edje_External_Directory_Entry */
+};
struct _Old_Edje_File
{
const char *path;
time_t mtime;
- Edje_External_Directory *external_dir;
- Edje_Font_Directory *font_dir;
- Edje_Image_Directory *image_dir;
+ Old_Edje_External_Directory *external_dir;
+ Old_Edje_Font_Directory *font_dir;
+ Old_Edje_Image_Directory *image_dir;
Edje_Spectrum_Directory *spectrum_dir;
Edje_Part_Collection_Directory *collection_dir;
Eina_List *data;
eet_data_descriptor_file_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_external_directory_entry, Edje_External_Directory_Entry, "entry", entry, EET_T_STRING);
- EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_External_Directory);
+ eet_eina_file_data_descriptor_class_set(&eddc, "Edje_External_Directory",
+ sizeof (Old_Edje_External_Directory));
_edje_edd_edje_external_directory =
eet_data_descriptor_file_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_external_directory, Edje_External_Directory, "entries", entries, _edje_edd_edje_external_directory_entry);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_font_directory_entry, Edje_Font_Directory_Entry, "entry", entry, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_font_directory_entry, Edje_Font_Directory_Entry, "file", file, EET_T_STRING);
- EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Font_Directory);
+ eet_eina_file_data_descriptor_class_set(&eddc, "Edje_Font_Directory",
+ sizeof (Old_Edje_Font_Directory));
_edje_edd_edje_font_directory =
eet_data_descriptor_file_new(&eddc);
- EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_font_directory, Edje_Font_Directory, "entries", entries, _edje_edd_edje_font_directory_entry);
+ EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_font_directory, Old_Edje_Font_Directory, "entries", entries, _edje_edd_edje_font_directory_entry);
/* image directory */
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory_Entry);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set, Edje_Image_Directory_Set, "id", id, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_image_directory_set, Edje_Image_Directory_Set, "entries", entries, _edje_edd_edje_image_directory_set_entry);
- EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory);
+ eet_eina_file_data_descriptor_class_set(&eddc, "Edje_Image_Directory",
+ sizeof (Old_Edje_Image_Directory));
_edje_edd_edje_image_directory =
eet_data_descriptor_file_new(&eddc);
- EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_image_directory, Edje_Image_Directory, "entries", entries, _edje_edd_edje_image_directory_entry);
- EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_image_directory, Edje_Image_Directory, "sets", sets, _edje_edd_edje_image_directory_set);
+ EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_image_directory, Old_Edje_Image_Directory, "entries", entries, _edje_edd_edje_image_directory_entry);
+ EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_image_directory, Old_Edje_Image_Directory, "sets", sets, _edje_edd_edje_image_directory_set);
/* spectrum directory */
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Spectrum_Color);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "a3", a3, EET_T_UCHAR);
/* the main file directory */
- EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_File);
+ eet_eina_file_data_descriptor_class_set(&eddc, "Edje_File", sizeof (Old_Edje_File));
_edje_edd_edje_file =
eet_data_descriptor_file_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_file, Old_Edje_File, "compiler", compiler, EET_T_STRING);
static int
_edje_image_id_find(Evas_Object *obj, const char *image_name)
{
- Edje_Image_Directory_Entry *i;
- Eina_List *l;
+ unsigned int i;
GET_ED_OR_RETURN(-1);
//printf("SEARCH IMAGE %s\n", image_name);
- EINA_LIST_FOREACH(ed->file->image_dir->entries, l, i)
- {
- if (strcmp(image_name, i->entry) == 0)
- {
- //printf(" Found id: %d \n", i->id);
- return i->id;
- }
- }
+ for (i = 0; i < ed->file->image_dir->entries_count; ++i)
+ if (ed->file->image_dir->entries[i].entry
+ && !strcmp(image_name, ed->file->image_dir->entries[i].entry))
+ return i;
return -1;
}
static const char *
_edje_image_name_find(Evas_Object *obj, int image_id)
{
- Edje_Image_Directory_Entry *i;
- Eina_List *l;
-
GET_ED_OR_RETURN(NULL);
if (!ed->file) return NULL;
if (!ed->file->image_dir) return NULL;
- //printf("SEARCH IMAGE ID %d\n", image_id);
-
- EINA_LIST_FOREACH(ed->file->image_dir->entries, l, i)
- if (image_id == i->id)
- return i->entry;
+ /* Special case for external image */
+ if (image_id < 0) image_id = -image_id - 1;
- return NULL;
+ //printf("SEARCH IMAGE ID %d\n", image_id);
+ if ((unsigned int) image_id >= ed->file->image_dir->entries_count) return NULL;
+ return ed->file->image_dir->entries[image_id].entry;
}
static void
static Edje_External_Directory_Entry *
_edje_edit_external_get(Edje *ed, const char *name)
{
- Eina_List *l;
- Edje_External_Directory_Entry *e;
+ unsigned int i;
if (!ed || !ed->file || !ed->file->external_dir || !name)
return NULL;
- EINA_LIST_FOREACH(ed->file->external_dir->entries, l, e)
- if (e->entry && !strcmp(e->entry, name))
- return e;
+ for (i = 0; i < ed->file->external_dir->entries_count; ++i)
+ if (ed->file->external_dir->entries[i].entry
+ && !strcmp(ed->file->external_dir->entries[i].entry, name))
+ return ed->file->external_dir->entries + i;
return NULL;
}
edje_edit_externals_list_get(Evas_Object *obj)
{
Eina_List *externals = NULL;
- Eina_List *l;
- Edje_External_Directory_Entry *e;
+ unsigned int i;
GET_ED_OR_RETURN(NULL);
if (!ed->file || !ed->file->external_dir)
return NULL;
//printf("GET STYLES LIST %d\n", eina_list_count(ed->file->styles));
- EINA_LIST_FOREACH(ed->file->external_dir->entries, l, e)
- externals = eina_list_append(externals, eina_stringshare_add(e->entry));
+ for (i = 0; i < ed->file->external_dir->entries_count; ++i)
+ externals = eina_list_append(externals,
+ eina_stringshare_add(ed->file->external_dir->entries[i].entry));
return externals;
}
edje_edit_external_add(Evas_Object *obj, const char *external)
{
Edje_External_Directory_Entry *e;
+ unsigned int freeid;
+ unsigned int i;
+
GET_ED_OR_RETURN(EINA_FALSE);
e = _edje_edit_external_get(ed, external);
if (e) return EINA_FALSE;
- e = _alloc(sizeof(Edje_External_Directory_Entry));
- if (!e) return EINA_FALSE;
- e->entry = (char*)eina_stringshare_add(external);
-
if (!ed->file->external_dir)
ed->file->external_dir = _alloc(sizeof(Edje_External_Directory));
- ed->file->external_dir->entries = \
- eina_list_append(ed->file->external_dir->entries, e);
+
+ for (i = 0; i < ed->file->external_dir->entries_count; ++i)
+ if (!ed->file->external_dir->entries[i].entry)
+ break ;
+
+ if (i == ed->file->external_dir->entries_count)
+ {
+ Edje_External_Directory_Entry *tmp;
+ unsigned int max;
+
+ max = ed->file->external_dir->entries_count + 1;
+ tmp = realloc(ed->file->external_dir->entries,
+ sizeof (Edje_External_Directory_Entry) * max);
+
+ if (!tmp) return EINA_FALSE;
+
+ ed->file->external_dir->entries = tmp;
+ freeid = ed->file->external_dir->entries_count;
+ ed->file->external_dir->entries_count = max;
+ }
+ else
+ freeid = i;
+
+ ed->file->external_dir->entries[freeid].entry = (char*)eina_stringshare_add(external);
+
return EINA_TRUE;
}
e = _edje_edit_external_get(ed, external);
if (!e) return EINA_FALSE;
- ed->file->external_dir->entries = \
- eina_list_remove(ed->file->external_dir->entries, e);
- if (!ed->file->external_dir->entries)
- {
- free(ed->file->external_dir);
- ed->file->external_dir = NULL;
- }
-
_edje_if_string_free(ed, e->entry);
- free(e);
+ e->entry = NULL;
return EINA_TRUE;
}
EAPI Eina_List *
edje_edit_images_list_get(Evas_Object *obj)
{
- Edje_Image_Directory_Entry *i;
Eina_List *images = NULL;
- Eina_List *l;
+ unsigned int i;
GET_ED_OR_RETURN(NULL);
if (!ed->file->image_dir) return NULL;
//printf("GET IMAGES LIST for %s\n", ed->file->path);
-
- EINA_LIST_FOREACH(ed->file->image_dir->entries, l, i)
- {
- images = eina_list_append(images, eina_stringshare_add(i->entry));
- //printf(" Image: %s (type: %d param: %d id: %d) \n",
- // i->entry, i->source_type, i->source_param, i->id);
- }
+ for (i = 0; i < ed->file->image_dir->entries_count; ++i)
+ images = eina_list_append(images,
+ eina_stringshare_add(ed->file->image_dir->entries[i].entry));
return images;
}
EAPI Eina_Bool
edje_edit_image_add(Evas_Object *obj, const char* path)
{
- Eina_List *l;
Edje_Image_Directory_Entry *de;
- int free_id = 0;
+ unsigned int i;
+ int free_id = -1;
char *name;
GET_ED_OR_RETURN(EINA_FALSE);
else name = (char *)path;
/* Loop trough image directory to find if image exist */
- EINA_LIST_FOREACH(ed->file->image_dir->entries, l, de)
+ for (i = 0; i < ed->file->image_dir->entries_count; ++i)
{
- if (!strcmp(name, de->entry))
+ de = ed->file->image_dir->entries + i;
+
+ if (!de->entry)
+ free_id = i;
+ else if (!strcmp(name, de->entry))
return EINA_FALSE;
- if (de->id >= free_id)
- free_id = de->id + 1; /*TODO search for free (hole) id*/
}
- /* Create Image Entry */
- de = _alloc(sizeof(Edje_Image_Directory_Entry));
- if (!de) return EINA_FALSE;
- de->entry = strdup(name);
+ if (free_id == -1)
+ {
+ Edje_Image_Directory_Entry *tmp;
+ unsigned int count;
+
+ count = ed->file->image_dir->entries_count + 1;
+
+ tmp = realloc(ed->file->image_dir->entries,
+ sizeof (Edje_Image_Directory_Entry) * count);
+ if (!tmp) return EINA_FALSE;
+
+ ed->file->image_dir->entries = tmp;
+ free_id = ed->file->image_dir->entries_count;
+ ed->file->image_dir->entries_count = count;
+ }
+
+ /* Set Image Entry */
+ de = ed->file->image_dir->entries + free_id;
+ de->entry = eina_stringshare_add(name);
de->id = free_id;
de->source_type = 1;
de->source_param = 1;
- /* Add image to Image Directory */
- ed->file->image_dir->entries =
- eina_list_append(ed->file->image_dir->entries, de);
-
/* Import image */
if (!_edje_import_image_file(ed, path, free_id))
{
- ed->file->image_dir->entries =
- eina_list_remove(ed->file->image_dir->entries, de);
- free(de->entry);
- free(de);
+ eina_stringshare_del(de->entry);
+ de->entry = NULL;
return EINA_FALSE;
}
EAPI Eina_Bool
edje_edit_image_del(Evas_Object *obj, const char* name)
{
- Eina_List *l;
Edje_Image_Directory_Entry *de;
+ unsigned int i;
GET_ED_OR_RETURN(EINA_FALSE);
if (!ed->file->image_dir)
return EINA_TRUE;
- EINA_LIST_FOREACH(ed->file->image_dir->entries, l, de)
+ for (i = 0; i < ed->file->image_dir->entries_count; ++i)
{
- if (!strcmp(name, de->entry))
- {
- ed->file->image_dir->entries = eina_list_remove_list(
- ed->file->image_dir->entries, l);
- break;
- }
- de = NULL;
+ de = ed->file->image_dir->entries + i;
+
+ if (de->entry
+ && !strcmp(name, de->entry))
+ break;
}
- if (!de)
+ if (i == ed->file->image_dir->entries_count)
{
WRN("Unable to find image entry part \"%s\"", name);
return EINA_TRUE;
if (!eetf)
{
ERR("Unable to open \"%s\" for writing output", ed->path);
- ed->file->image_dir->entries =
- eina_list_append(ed->file->image_dir->entries, de);
return EINA_FALSE;
}
{
ERR("Unable to delete \"%s\" font entry", entry);
eet_close(eetf);
- ed->file->image_dir->entries =
- eina_list_append(ed->file->image_dir->entries, de);
return EINA_FALSE;
}
if (!_edje_edit_edje_file_save(eetf, ed->file))
{
eet_close(eetf);
- ed->file->image_dir->entries =
- eina_list_append(ed->file->image_dir->entries, de);
return EINA_FALSE;
}
eet_close(eetf);
}
- free(de->entry);
- free(de);
+ _edje_if_string_free(ed, de->entry);
+ de->entry = NULL;
return EINA_TRUE;
}
EAPI Eina_Bool
edje_edit_image_data_add(Evas_Object *obj, const char *name, int id)
{
- Eina_List *l;
Edje_Image_Directory_Entry *de;
- Edje_Image_Directory_Entry *i, *t;
GET_ED_OR_RETURN(EINA_FALSE);
}
/* Loop trough image directory to find if image exist */
- t = NULL;
- EINA_LIST_FOREACH(ed->file->image_dir->entries, l, i)
- {
- if (!i) return EINA_FALSE;
- if (i->id == id) t = i;
- }
+ if (id < 0) id = - id - 1;
+ if ((unsigned int) id >= ed->file->image_dir->entries_count) return EINA_FALSE;
- /* Create Image Entry */
- if (!t)
- {
- de = _alloc(sizeof(Edje_Image_Directory_Entry));
- if (!de) return EINA_FALSE;
- }
- else
- {
- de = t;
- free(de->entry);
- }
- de->entry = strdup(name);
- de->id = id;
+ de = ed->file->image_dir->entries + id;
+ eina_stringshare_replace(&de->entry, name);
de->source_type = 1;
de->source_param = 1;
- /* Add image to Image Directory */
- if (!t)
- ed->file->image_dir->entries =
- eina_list_append(ed->file->image_dir->entries, de);
-
return EINA_TRUE;
}
EAPI Edje_Edit_Image_Comp
edje_edit_image_compression_type_get(Evas_Object *obj, const char *image)
{
- Edje_Image_Directory_Entry *i = NULL;
- Eina_List *l;
+ Edje_Image_Directory_Entry *de = NULL;
+ unsigned int i;
GET_ED_OR_RETURN(-1);
if (!ed->file) return -1;
if (!ed->file->image_dir) return -1;
- EINA_LIST_FOREACH(ed->file->image_dir->entries, l, i)
+ for (i = 0; i < ed->file->image_dir->entries_count; ++i)
{
- if (strcmp(i->entry, image) == 0)
+ de = ed->file->image_dir->entries + i;
+
+ if (de->entry
+ && !strcmp(image, de->entry))
break;
- i = NULL;
}
- if (!i) return -1;
+ if (i == ed->file->image_dir->entries_count) return -1;
- switch(i->source_type)
+ switch(de->source_type)
{
case EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT:
- if (i->source_param == 0) // RAW
+ if (de->source_param == 0) // RAW
return EDJE_EDIT_IMAGE_COMP_RAW;
else // COMP
return EDJE_EDIT_IMAGE_COMP_COMP;
EAPI int
edje_edit_image_compression_rate_get(Evas_Object *obj, const char *image)
{
- Eina_List *l;
- Edje_Image_Directory_Entry *i;
+ Edje_Image_Directory_Entry *de;
+ unsigned int i;
GET_ED_OR_RETURN(-1);
// Gets the Image Entry
- EINA_LIST_FOREACH(ed->file->image_dir->entries, l, i)
+ for (i = 0; i < ed->file->image_dir->entries_count; ++i)
{
- if (strcmp(i->entry, image) == 0) break;
- i = NULL;
+ de = ed->file->image_dir->entries + i;
+ if (de->entry
+ && !strcmp(de->entry, image))
+ break;
}
- if (!i) return -1;
- if (i->source_type != EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY) return -2;
+ if (i == ed->file->image_dir->entries_count) return -1;
+ if (de->source_type != EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY) return -2;
- return i->source_param;
+ return de->source_param;
}
EAPI const char *
if (ed->file && ed->file->external_dir)
{
- const Edje_External_Directory_Entry *ext;
- const Eina_List *n;
+ unsigned int i;
- EINA_LIST_FOREACH(ed->file->external_dir->entries, n, ext)
- {
- edje_module_load(ext->entry);
- }
+ for (i = 0; i < ed->file->external_dir->entries_count; ++i)
+ edje_module_load(ed->file->external_dir->entries[i].entry);
}
_edje_textblock_styles_add(ed);
if (edf->image_dir)
{
- Edje_Image_Directory_Entry *ie;
+ unsigned int i;
- EINA_LIST_FREE(edf->image_dir->entries, ie)
+ if (edf->free_strings)
{
- if (edf->free_strings && ie->entry) eina_stringshare_del(ie->entry);
- free(ie);
+ for (i = 0; i < edf->image_dir->entries_count; ++i)
+ eina_stringshare_del(edf->image_dir->entries[i].entry);
}
+
+ /* Sets have been added after edje received eet dictionnary support */
+ for (i = 0; i < edf->image_dir->sets_count; ++i)
+ {
+ Edje_Image_Directory_Set_Entry *se;
+
+ EINA_LIST_FREE(edf->image_dir->sets[i].entries, se)
+ free(se);
+
+ }
+
+ free(edf->image_dir->entries);
+ free(edf->image_dir->sets);
free(edf->image_dir);
}
if (edf->spectrum_dir)
typedef struct _Edje_Data Edje_Data;
typedef struct _Edje_External_Directory Edje_External_Directory;
typedef struct _Edje_External_Directory_Entry Edje_External_Directory_Entry;
-typedef struct _Edje_Font_Directory Edje_Font_Directory;
typedef struct _Edje_Font_Directory_Entry Edje_Font_Directory_Entry;
typedef struct _Edje_Image_Directory Edje_Image_Directory;
typedef struct _Edje_Image_Directory_Entry Edje_Image_Directory_Entry;
/*----------*/
-struct _Edje_Font_Directory
-{
- Eina_List *entries; /* a list of Edje_Font_Directory_Entry */
-};
-
struct _Edje_Font_Directory_Entry
{
const char *entry; /* the name of the font */
struct _Edje_External_Directory
{
- Eina_List *entries; /* a list of Edje_External_Directory_Entry */
+ Edje_External_Directory_Entry *entries; /* a list of Edje_External_Directory_Entry */
+ unsigned int entries_count;
};
struct _Edje_External_Directory_Entry
struct _Edje_Image_Directory
{
- Eina_List *entries; /* a list of Edje_Image_Directory_Entry */
- Eina_List *sets; /* a list of Edje_Image_Directory_Set */
+ Edje_Image_Directory_Entry *entries; /* an array of Edje_Image_Directory_Entry */
+ unsigned int entries_count;
+
+ Edje_Image_Directory_Set *sets;
+ unsigned int sets_count; /* an array of Edje_Image_Directory_Set */
};
struct _Edje_Image_Directory_Entry
{
- char *entry; /* the nominal name of the image - if any */
+ const char *entry; /* the nominal name of the image - if any */
int source_type; /* alternate source mode. 0 = none */
int source_param; /* extra params on encoding */
int id; /* the id no. of the image */
struct _Edje_Image_Directory_Set_Entry
{
- char *name;
+ const char *name;
int id;
struct {