and actually allow "USER" images (ie don't encode them into the .edj - use an

external path to them)


SVN revision: 27156
This commit is contained in:
Carsten Haitzler 2006-11-17 14:47:30 +00:00
parent e22ae28a41
commit 1cfed3e3c0
2 changed files with 63 additions and 41 deletions

View File

@ -107,6 +107,7 @@ check_image_part_desc (Edje_Part_Collection *pc, Edje_Part *ep,
{ {
Evas_List *l; Evas_List *l;
return;
if (epd->image.id == -1) if (epd->image.id == -1)
{ {
fprintf(stderr, "%s: Error. collection %i: image attributes missing " fprintf(stderr, "%s: Error. collection %i: image attributes missing "
@ -362,7 +363,10 @@ data_write(void)
Edje_Image_Directory_Entry *img; Edje_Image_Directory_Entry *img;
img = l->data; img = l->data;
if (img->source_type != EDJE_IMAGE_SOURCE_TYPE_EXTERNAL) if (img->source_type == EDJE_IMAGE_SOURCE_TYPE_EXTERNAL)
{
}
else
{ {
Evas_Object *im; Evas_Object *im;
Evas_List *ll; Evas_List *ll;
@ -928,7 +932,10 @@ data_process_lookups(void)
if ((de->entry) && (!strcmp(de->entry, il->name))) if ((de->entry) && (!strcmp(de->entry, il->name)))
{ {
handle_slave_lookup(image_slave_lookups, il->dest, de->id); handle_slave_lookup(image_slave_lookups, il->dest, de->id);
*(il->dest) = de->id; if (de->source_type == EDJE_IMAGE_SOURCE_TYPE_EXTERNAL)
*(il->dest) = -de->id - 1;
else
*(il->dest) = de->id;
break; break;
} }
} }

View File

@ -1243,51 +1243,66 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
evas_object_image_border_set(ep->object, p3.border.l, p3.border.r, p3.border.t, p3.border.b); evas_object_image_border_set(ep->object, p3.border.l, p3.border.r, p3.border.t, p3.border.b);
evas_object_image_border_center_fill_set(ep->object, !(chosen_desc->border.no_fill)); evas_object_image_border_center_fill_set(ep->object, !(chosen_desc->border.no_fill));
image_id = ep->param1.description->image.id; image_id = ep->param1.description->image.id;
image_count = 2;
if (ep->param2.description)
image_count += evas_list_count(ep->param2.description->image.tween_list);
image_num = (pos * ((double)image_count - 0.5));
if (image_num > (image_count - 1))
image_num = image_count - 1;
if (image_num == 0)
image_id = ep->param1.description->image.id;
else if (image_num == (image_count - 1))
image_id = ep->param2.description->image.id;
else
{
Edje_Part_Image_Id *imid;
imid = evas_list_nth(ep->param2.description->image.tween_list, image_num - 1);
if (imid) image_id = imid->id;
}
if (image_id < 0) if (image_id < 0)
{ {
printf("EDJE ERROR: part \"%s\" has description, \"%s\" %3.3f with a missing image id!!!\n", Edje_Image_Directory_Entry *ie;
ep->part->name,
ep->param1.description->state.name, ie = evas_list_nth(ed->file->image_dir->entries, (-image_id) - 1);
ep->param1.description->state.value if ((ie) &&
); (ie->source_type == EDJE_IMAGE_SOURCE_TYPE_EXTERNAL) &&
(ie->entry))
{
evas_object_image_file_set(ep->object, ie->entry, NULL);
}
} }
else else
{ {
snprintf(buf, sizeof(buf), "images/%i", image_id); image_count = 2;
evas_object_image_file_set(ep->object, ed->file->path, buf); if (ep->param2.description)
if (evas_object_image_load_error_get(ep->object) != EVAS_LOAD_ERROR_NONE) image_count += evas_list_count(ep->param2.description->image.tween_list);
image_num = (pos * ((double)image_count - 0.5));
if (image_num > (image_count - 1))
image_num = image_count - 1;
if (image_num == 0)
image_id = ep->param1.description->image.id;
else if (image_num == (image_count - 1))
image_id = ep->param2.description->image.id;
else
{ {
printf("EDJE: Error loading image collection \"%s\" from file \"%s\". Missing EET Evas loader module?\n", Edje_Part_Image_Id *imid;
buf, ed->file->path);
if (evas_object_image_load_error_get(ep->object) == EVAS_LOAD_ERROR_GENERIC) imid = evas_list_nth(ep->param2.description->image.tween_list, image_num - 1);
printf("Error type: EVAS_LOAD_ERROR_GENERIC\n"); if (imid) image_id = imid->id;
else if (evas_object_image_load_error_get(ep->object) == EVAS_LOAD_ERROR_DOES_NOT_EXIST) }
printf("Error type: EVAS_LOAD_ERROR_DOES_NOT_EXIST\n"); if (image_id < 0)
else if (evas_object_image_load_error_get(ep->object) == EVAS_LOAD_ERROR_PERMISSION_DENIED) {
printf("Error type: EVAS_LOAD_ERROR_PERMISSION_DENIED\n"); printf("EDJE ERROR: part \"%s\" has description, \"%s\" %3.3f with a missing image id!!!\n",
else if (evas_object_image_load_error_get(ep->object) == EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED) ep->part->name,
printf("Error type: EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED\n"); ep->param1.description->state.name,
else if (evas_object_image_load_error_get(ep->object) == EVAS_LOAD_ERROR_CORRUPT_FILE) ep->param1.description->state.value
printf("Error type: EVAS_LOAD_ERROR_CORRUPT_FILE\n"); );
else if (evas_object_image_load_error_get(ep->object) == EVAS_LOAD_ERROR_UNKNOWN_FORMAT) }
printf("Error type: EVAS_LOAD_ERROR_UNKNOWN_FORMAT\n"); else
{
snprintf(buf, sizeof(buf), "images/%i", image_id);
evas_object_image_file_set(ep->object, ed->file->path, buf);
if (evas_object_image_load_error_get(ep->object) != EVAS_LOAD_ERROR_NONE)
{
printf("EDJE: Error loading image collection \"%s\" from file \"%s\". Missing EET Evas loader module?\n",
buf, ed->file->path);
if (evas_object_image_load_error_get(ep->object) == EVAS_LOAD_ERROR_GENERIC)
printf("Error type: EVAS_LOAD_ERROR_GENERIC\n");
else if (evas_object_image_load_error_get(ep->object) == EVAS_LOAD_ERROR_DOES_NOT_EXIST)
printf("Error type: EVAS_LOAD_ERROR_DOES_NOT_EXIST\n");
else if (evas_object_image_load_error_get(ep->object) == EVAS_LOAD_ERROR_PERMISSION_DENIED)
printf("Error type: EVAS_LOAD_ERROR_PERMISSION_DENIED\n");
else if (evas_object_image_load_error_get(ep->object) == EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED)
printf("Error type: EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED\n");
else if (evas_object_image_load_error_get(ep->object) == EVAS_LOAD_ERROR_CORRUPT_FILE)
printf("Error type: EVAS_LOAD_ERROR_CORRUPT_FILE\n");
else if (evas_object_image_load_error_get(ep->object) == EVAS_LOAD_ERROR_UNKNOWN_FORMAT)
printf("Error type: EVAS_LOAD_ERROR_UNKNOWN_FORMAT\n");
}
} }
} }
evas_object_color_set(ep->object, evas_object_color_set(ep->object,