Use right key to find stuff in the eet file. By Fidencio

Store filename for the fonts when adding eith Edje_Edit. By Fidencio
Use the hash in edje_file to dump fonts with edje_decc, avoiding the
need for the fontmap, which should probably be taken out entirely later.


SVN revision: 51095
This commit is contained in:
Iván Briano 2010-08-13 20:07:12 +00:00
parent ccc497b492
commit 8b2e29dc75
3 changed files with 25 additions and 7 deletions

View File

@ -216,7 +216,7 @@ output(void)
ERR("Cannot create image object for save.");
exit(-1);
}
snprintf(buf, sizeof(buf), "images/%i", ei->id);
snprintf(buf, sizeof(buf), "edje/images/%i", ei->id);
evas_object_image_file_set(im, file_in, buf);
snprintf(out, sizeof(out), "%s/%s", outdir, ei->entry);
printf("Output Image: %s\n", out);
@ -279,17 +279,19 @@ output(void)
if (sf->file) fputs(sf->file, f);
fclose(f);
}
if (fontlist)
if (edje_file->fonts)
{
Font *fn;
Edje_Font_Directory_Entry *fn;
Eina_Iterator *it;
EINA_LIST_FOREACH(fontlist->list, l, fn)
it = eina_hash_iterator_data_new(edje_file->fonts);
EINA_ITERATOR_FOREACH(it, fn)
{
void *font;
int fontsize;
char out[4096];
snprintf(out, sizeof(out), "fonts/%s", fn->name);
snprintf(out, sizeof(out), "edje/fonts/%s", fn->entry);
font = eet_read(ef, out, &fontsize);
if (font)
{
@ -321,6 +323,7 @@ output(void)
free(font);
}
}
eina_iterator_free(it);
}
{
char out[4096];

View File

@ -3946,6 +3946,7 @@ EAPI Eina_Bool
edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias)
{
char entry[PATH_MAX];
char *new_path;
struct stat st;
Edje_Font_Directory_Entry *fnt;
@ -3959,13 +3960,26 @@ edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias)
if (!ed->path) return EINA_FALSE;
/* Alias */
if (!alias)
if (alias)
{
if ((new_path = strrchr(path, '/'))) new_path ++;
else new_path = (char *)path;
}
else
{
if ((alias = strrchr(path, '/'))) alias ++;
else alias = (char *)path;
new_path = (char *)alias;
}
snprintf(entry, sizeof(entry), "edje/fonts/%s", alias);
/* Initializing a new font hash, if no exist */
if (!ed->file->fonts)
{
ed->file->fonts = eina_hash_string_small_new(NULL);
if (!ed->file->fonts) return EINA_FALSE;
}
/* Check if exists */
fnt = eina_hash_find(ed->file->fonts, alias);
if (fnt)
@ -3978,6 +3992,7 @@ edje_edit_font_add(Evas_Object *obj, const char* path, const char* alias)
ERR("Unable to alloc font entry part \"%s\"", alias);
return EINA_FALSE;
}
fnt->file = eina_stringshare_add(new_path);
fnt->entry = eina_stringshare_add(alias);
eina_hash_direct_add(ed->file->fonts, fnt->entry, fnt);

View File

@ -2163,7 +2163,7 @@ _edje_lua_image_set_file(lua_State *L)
Edje_Lua_Evas_Object *obj = _edje_lua_checkudata(L, 1, &mImage);
int id = edje_edit_image_id_get(obj->ed->obj, luaL_checkstring(L, 2));
char buf[256];
sprintf(buf, "images/%i", id);
sprintf(buf, "edje/images/%i", id);
evas_object_image_file_set(obj->eo, obj->ed->path, buf);
return 0;
}