diff --git a/legacy/edje/src/lib/edje_edit.c b/legacy/edje/src/lib/edje_edit.c index 9fa3566a21..c0cef9a82c 100644 --- a/legacy/edje/src/lib/edje_edit.c +++ b/legacy/edje/src/lib/edje_edit.c @@ -224,8 +224,13 @@ _edje_real_part_free(Edje_Real_Part *rp) static unsigned char _edje_import_image_file(Edje *ed, const char *path, int id) { + char buf[256]; Evas_Object *im; Eet_File *eetf; + void *im_data; + int im_w, im_h; + int im_alpha; + int bytes; /* Try to load the file */ im = evas_object_image_add(ed->evas); @@ -245,11 +250,6 @@ _edje_import_image_file(Edje *ed, const char *path, int id) if (!im) return 0; /* Write the loaded image to the edje file */ - void *im_data; - int im_w, im_h; - int im_alpha; - int bytes; - char buf[256]; evas_object_image_size_get(im, &im_w, &im_h); im_alpha = evas_object_image_alpha_get(im); @@ -308,9 +308,11 @@ static int _edje_part_id_find(Edje *ed, const char *part) { int id; + for (id = 0; id < ed->table_parts_size; id++) { Edje_Real_Part *rp = ed->table_parts[id]; + if (!strcmp(rp->part->name, part)) return id; } @@ -346,13 +348,14 @@ _edje_part_id_set(Edje *ed, Edje_Real_Part *rp, int new_id) for (l = ed->collection->parts; l; l = l->next) { Edje_Part *p; + Edje_Part_Description *d; + p = l->data; //printf(" search id: %d in %s\n", old_id, p->name); if (p->clip_to_id == old_id) p->clip_to_id = new_id; if (p->dragable.confine_id == old_id) p->dragable.confine_id = new_id; /* ...in default description */ - Edje_Part_Description *d; d = p->default_desc; //printf(" search in %s (%s)\n", p->name, d->state.name); if (d->rel1.id_x == old_id) d->rel1.id_x = new_id; @@ -436,6 +439,9 @@ _edje_parts_id_switch(Edje *ed, Edje_Real_Part *rp1, Edje_Real_Part *rp2) for (l = ed->collection->parts; l; l = l->next) { Edje_Part *p; + Evas_List *ll; + Edje_Part_Description *d; + p = l->data; //printf(" search id: %d in %s\n", old_id, p->name); if (p->clip_to_id == id1) p->clip_to_id = id2; @@ -444,8 +450,6 @@ _edje_parts_id_switch(Edje *ed, Edje_Real_Part *rp1, Edje_Real_Part *rp2) else if (p->dragable.confine_id == id2) p->dragable.confine_id = id1; // ...in default description - Evas_List *ll; - Edje_Part_Description *d; d = p->default_desc; // printf(" search in %s (%s)\n", p->name, d->state.name); if (d->rel1.id_x == id1) d->rel1.id_x = id2; @@ -510,6 +514,7 @@ _edje_fix_parts_id(Edje *ed) Evas_List *l; int correct_id; int count; + printf("FIXING PARTS ID \n"); //TODO order the list first to be more robust @@ -580,15 +585,17 @@ edje_edit_string_free(const char *str) EAPI unsigned char edje_edit_group_add(Evas_Object *obj, const char *name) { - printf("ADD GROUP: %s \n", name); - - GET_ED_OR_RETURN(0); - Edje_Part_Collection_Directory_Entry *de; Edje_Part_Collection *pc; Evas_List *l; + int id; + int search; //Code *cd; + GET_ED_OR_RETURN(0); + + printf("ADD GROUP: %s \n", name); + /* check if a group with the same name already exists */ for (l = ed->file->collection_dir->entries; l; l = l->next) { @@ -609,14 +616,16 @@ edje_edit_group_add(Evas_Object *obj, const char *name) } /* Search first free id */ - int id = 0; - int search = 0; + id = 0; + search = 0; while (!id) { unsigned char found = 0; + for (l = ed->file->collection_dir->entries; l; l = l->next) { Edje_Part_Collection_Directory_Entry *d = l->data; + // printf("search if %d is free [id %d]\n", search, d->id); if (search == d->id) { @@ -657,11 +666,14 @@ edje_edit_group_add(Evas_Object *obj, const char *name) EAPI unsigned char edje_edit_group_del(Evas_Object *obj) { - GET_ED_OR_RETURN(0); - + char buf[32]; Evas_List *l; int i; Edje_Part_Collection *g; + Eet_File *eetf; + + GET_ED_OR_RETURN(0); + g = ed->collection; printf("REMOVE GROUP: %s [id: %d]\n", g->part, g->id); @@ -670,8 +682,6 @@ edje_edit_group_del(Evas_Object *obj) return 0; /* Remove collection/id from eet file */ - Eet_File *eetf; - char buf[32]; eetf = eet_open(ed->file->path, EET_FILE_MODE_READ_WRITE); if (!eetf) { @@ -697,6 +707,7 @@ edje_edit_group_del(Evas_Object *obj) for (l = ed->file->collection_dir->entries; l; l = l->next) { Edje_Part_Collection_Directory_Entry *e; + e = l->data; printf(" id: %d entry: %s\n", e->id, e->entry); if (e->id == g->id) @@ -726,7 +737,9 @@ EAPI unsigned char edje_edit_group_exist(Evas_Object *obj, const char *group) { Evas_List *l; + GET_ED_OR_RETURN(0); + for (l = ed->file->collection_dir->entries; l; l = l->next) { Edje_Part_Collection_Directory_Entry *e; @@ -742,12 +755,13 @@ EAPI unsigned char edje_edit_group_name_set(Evas_Object *obj, const char *new_name) { Evas_List *l; + Edje_Part_Collection *pc; GET_ED_OR_RETURN(0); + if (!new_name) return 0; if (edje_edit_group_exist(obj, new_name)) return 0; - Edje_Part_Collection *pc; pc = ed->collection; printf("Set name of current group: %s [id: %d][new name: %s]\n", @@ -759,6 +773,7 @@ edje_edit_group_name_set(Evas_Object *obj, const char *new_name) for (l = ed->file->collection_dir->entries; l; l = l->next) { Edje_Part_Collection_Directory_Entry *pce = l->data; + if (pc->id == pce->id) { ed->file->collection_hash = evas_hash_del(ed->file->collection_hash, @@ -863,6 +878,7 @@ edje_edit_parts_list_get(Evas_Object *obj) for (i = 0; i < ed->table_parts_size; i++) { Edje_Real_Part *rp; + rp = ed->table_parts[i]; parts = evas_list_append(parts, evas_stringshare_add(rp->part->name)); } @@ -874,6 +890,7 @@ EAPI unsigned char edje_edit_part_name_set(Evas_Object *obj, const char* part, const char* new_name) { GET_RP_OR_RETURN(0); + if (!new_name) return 0; if (_edje_real_part_get(ed, new_name)) return 0; @@ -888,14 +905,14 @@ edje_edit_part_name_set(Evas_Object *obj, const char* part, const char* new_name EAPI unsigned char edje_edit_part_add(Evas_Object *obj, const char* name, unsigned char type) { - printf("ADD PART: %s [type: %d]\n", name, type); - Edje_Part_Collection *pc; Edje_Part *ep; Edje_Real_Part *rp; GET_ED_OR_RETURN(0); + printf("ADD PART: %s [type: %d]\n", name, type); + /* Check if part already exists */ if (_edje_real_part_get(ed, name)) return FALSE; @@ -1013,11 +1030,14 @@ edje_edit_part_add(Evas_Object *obj, const char* name, unsigned char type) EAPI unsigned char edje_edit_part_del(Evas_Object *obj, const char* part) { - printf("REMOVE PART: %s\n", part); Edje_Part *ep; + Edje_Part_Collection *pc; int id; GET_RP_OR_RETURN(0); + + printf("REMOVE PART: %s\n", part); + ep = rp->part; id = ep->id; @@ -1027,8 +1047,9 @@ edje_edit_part_del(Evas_Object *obj, const char* part) int i; for (i = 0; i < ed->table_parts_size; i++) { - if (i == id) continue; //don't check the deleted id Edje_Real_Part *real; + + if (i == id) continue; //don't check the deleted id real = ed->table_parts[i % ed->table_parts_size]; if (real->text.source == rp) real->text.source = NULL; @@ -1061,7 +1082,6 @@ edje_edit_part_del(Evas_Object *obj, const char* part) _edje_part_id_set(ed, rp, -1); /* Remove part from parts list */ - Edje_Part_Collection *pc; pc = ed->collection; pc->parts = evas_list_remove(pc->parts, ep); _edje_fix_parts_id(ed); @@ -1101,15 +1121,17 @@ edje_edit_part_exist(Evas_Object *obj, const char *part) EAPI unsigned char edje_edit_part_restack_below(Evas_Object *obj, const char* part) { - printf("RESTACK PART: %s BELOW\n", part); + Edje_Part_Collection *group; + Edje_Real_Part *prev; + GET_RP_OR_RETURN(0); + printf("RESTACK PART: %s BELOW\n", part); + if (rp->part->id < 1) return 0; - Edje_Part_Collection *group; group = ed->collection; /* update parts list */ - Edje_Real_Part *prev; prev = ed->table_parts[(rp->part->id - 1) % ed->table_parts_size]; group->parts = evas_list_remove(group->parts, rp->part); group->parts = evas_list_prepend_relative(group->parts, rp->part, prev->part); @@ -1124,16 +1146,18 @@ edje_edit_part_restack_below(Evas_Object *obj, const char* part) EAPI unsigned char edje_edit_part_restack_above(Evas_Object *obj, const char* part) { - printf("RESTACK PART: %s ABOVE\n", part); + Edje_Part_Collection *group; + Edje_Real_Part *next; + GET_RP_OR_RETURN(0); + printf("RESTACK PART: %s ABOVE\n", part); + if (rp->part->id >= ed->table_parts_size - 1) return 0; - Edje_Part_Collection *group; group = ed->collection; /* update parts list */ - Edje_Real_Part *next; next = ed->table_parts[(rp->part->id + 1) % ed->table_parts_size]; group->parts = evas_list_remove(group->parts, rp->part); group->parts = evas_list_append_relative(group->parts, rp->part, next->part); @@ -1191,9 +1215,10 @@ edje_edit_part_selected_state_set(Evas_Object *obj, const char *part, const char EAPI const char * edje_edit_part_clip_to_get(Evas_Object *obj, const char *part) { - GET_RP_OR_RETURN(NULL); Edje_Real_Part *clip = NULL; + GET_RP_OR_RETURN(NULL); + printf("Get clip_to for part: %s [to_id: %d]\n", part, rp->part->clip_to_id); if (rp->part->clip_to_id < 0) return NULL; @@ -1206,9 +1231,10 @@ edje_edit_part_clip_to_get(Evas_Object *obj, const char *part) EAPI unsigned char edje_edit_part_clip_to_set(Evas_Object *obj, const char *part, const char *clip_to) { - GET_RP_OR_RETURN(0); Edje_Real_Part *clip; + GET_RP_OR_RETURN(0); + /* unset clipping */ if (!clip_to) { @@ -1260,7 +1286,9 @@ EAPI void edje_edit_part_mouse_events_set(Evas_Object *obj, const char *part, unsigned char mouse_events) { GET_RP_OR_RETURN(); + if (!rp->object) return; + printf("Set mouse_events for part: %s [%d]\n", part, mouse_events); rp->part->mouse_events = mouse_events ? 1 : 0; @@ -1281,6 +1309,7 @@ EAPI unsigned char edje_edit_part_repeat_events_get(Evas_Object *obj, const char *part) { GET_RP_OR_RETURN(0); + //printf("Get repeat_events for part: %s [%d]\n", part, rp->part->repeat_events); return rp->part->repeat_events; } @@ -1289,7 +1318,9 @@ EAPI void edje_edit_part_repeat_events_set(Evas_Object *obj, const char *part, unsigned char repeat_events) { GET_RP_OR_RETURN(); + if (!rp->object) return; + printf("Set repeat_events for part: %s [%d]\n", part, repeat_events); rp->part->repeat_events = repeat_events ? 1 : 0; @@ -1304,6 +1335,7 @@ EAPI Evas_Event_Flags edje_edit_part_ignore_flags_get(Evas_Object *obj, const char *part) { GET_RP_OR_RETURN(0); + return rp->part->ignore_flags; } @@ -1311,6 +1343,7 @@ EAPI void edje_edit_part_ignore_flags_set(Evas_Object *obj, const char *part, Evas_Event_Flags ignore_flags) { GET_RP_OR_RETURN(); + if (!rp->object) return; printf("Set ignore_flags for part: %s [%#x]\n", part, ignore_flags); @@ -1320,9 +1353,10 @@ edje_edit_part_ignore_flags_set(Evas_Object *obj, const char *part, Evas_Event_F EAPI const char * edje_edit_part_source_get(Evas_Object *obj, const char *part) { - GET_RP_OR_RETURN(NULL); //Edje_Real_Part *clip = NULL; + GET_RP_OR_RETURN(NULL); + printf("Get source for part: %s\n", part); if (!rp->part->source) return NULL; @@ -1350,10 +1384,10 @@ edje_edit_part_source_set(Evas_Object *obj, const char *part, const char *source EAPI Evas_List * edje_edit_part_states_list_get(Evas_Object *obj, const char *part) { + char state_name[MAX_PATH]; Evas_List *states; Evas_List *l; Edje_Part_Description *state; - char state_name[MAX_PATH]; GET_RP_OR_RETURN(NULL); @@ -1386,6 +1420,8 @@ edje_edit_state_name_set(Evas_Object *obj, const char *part, const char *state, { char *delim; double value; + int part_id; + int i; GET_PD_OR_RETURN(0); printf("Set name of state: %s in part: %s [new name: %s]\n", @@ -1402,14 +1438,15 @@ edje_edit_state_name_set(Evas_Object *obj, const char *part, const char *state, /* update programs */ /* update the 'state' field in all programs. update only if program has a single target */ - int i; - int part_id = _edje_part_id_find(ed, part); + part_id = _edje_part_id_find(ed, part); for (i = 0; i < ed->table_programs_size; i++) { Edje_Program *epr = ed->table_programs[i]; + if (evas_list_count(epr->targets) == 1) { Edje_Program_Target *t = epr->targets->data; + if (t->id == part_id && !strcmp(epr->state, pd->state.name) && pd->state.value == epr->value) @@ -1436,11 +1473,12 @@ edje_edit_state_name_set(Evas_Object *obj, const char *part, const char *state, EAPI void edje_edit_state_del(Evas_Object *obj, const char *part, const char *state) { - printf("REMOVE STATE: %s IN PART: %s\n", state, part); + Edje_Part_Description *pd; GET_RP_OR_RETURN(); - Edje_Part_Description *pd; + printf("REMOVE STATE: %s IN PART: %s\n", state, part); + pd = _edje_part_description_find_byname(ed, part, state); if (!pd) return; @@ -1452,11 +1490,12 @@ edje_edit_state_del(Evas_Object *obj, const char *part, const char *state) EAPI void edje_edit_state_add(Evas_Object *obj, const char *part, const char *name) { - printf("ADD STATE: %s TO PART: %s\n", name , part); + Edje_Part_Description *pd; GET_RP_OR_RETURN(); - Edje_Part_Description *pd; + printf("ADD STATE: %s TO PART: %s\n", name , part); + pd = mem_alloc(sizeof(Edje_Part_Description)); if (!rp->part->default_desc) @@ -1686,7 +1725,9 @@ EAPI const char * edje_edit_state_rel1_to_x_get(Evas_Object *obj, const char *part, const char *state) { Edje_Real_Part *rel; + GET_PD_OR_RETURN(NULL); + //printf("Get rel1x TO of part: %s state: %s\n", part, state); if (pd->rel1.id_x == -1) return NULL; @@ -1703,7 +1744,9 @@ EAPI const char * edje_edit_state_rel1_to_y_get(Evas_Object *obj, const char *part, const char *state) { Edje_Real_Part *rel; + GET_PD_OR_RETURN(NULL); + //printf("Get rel1y TO of part: %s state: %s\n", part, state); if (pd->rel1.id_y == -1) return NULL; @@ -1720,7 +1763,9 @@ EAPI const char * edje_edit_state_rel2_to_x_get(Evas_Object *obj, const char *part, const char *state) { Edje_Real_Part *rel; + GET_PD_OR_RETURN(NULL); + //printf("Get rel2x TO of part: %s state: %s\n", part, state); if (pd->rel2.id_x == -1) return NULL; @@ -1737,7 +1782,9 @@ EAPI const char * edje_edit_state_rel2_to_y_get(Evas_Object *obj, const char *part, const char *state) { Edje_Real_Part *rel; + GET_PD_OR_RETURN(NULL); + //printf("Get rel2y TO of part: %s state: %s\n", part, state); if (pd->rel2.id_y == -1) return NULL; @@ -1755,7 +1802,9 @@ EAPI void edje_edit_state_rel1_to_x_set(Evas_Object *obj, const char *part, const char *state, const char *rel_to) { Edje_Real_Part *relp; + GET_PD_OR_RETURN(); + printf("Set rel1 to x on state: %s (to part: )\n", state); if (rel_to) @@ -1776,6 +1825,7 @@ EAPI void edje_edit_state_rel1_to_y_set(Evas_Object *obj, const char *part, const char *state, const char *rel_to) { Edje_Real_Part *relp; + GET_PD_OR_RETURN(); //printf("Set rel1 to y on state: %s (to part: %s)\n", state, rel_to); @@ -1798,7 +1848,9 @@ EAPI void edje_edit_state_rel2_to_x_set(Evas_Object *obj, const char *part, const char *state, const char *rel_to) { Edje_Real_Part *relp; + GET_PD_OR_RETURN(); + printf("Set rel2 to x on state: %s (to part: )\n", state); if (rel_to) @@ -1819,7 +1871,9 @@ EAPI void edje_edit_state_rel2_to_y_set(Evas_Object *obj, const char *part, const char *state, const char *rel_to) { Edje_Real_Part *relp; + GET_PD_OR_RETURN(); + //printf("Set rel2 to y on state: %s (to part: %s)\n", state, rel_to); if (rel_to) @@ -1840,6 +1894,7 @@ EAPI void edje_edit_state_color_get(Evas_Object *obj, const char *part, const char *state, int *r, int *g, int *b, int *a) { GET_PD_OR_RETURN(); + //printf("GET COLOR of state '%s'\n", state); if (r) *r = pd->color.r; @@ -1852,6 +1907,7 @@ EAPI void edje_edit_state_color2_get(Evas_Object *obj, const char *part, const char *state, int *r, int *g, int *b, int *a) { GET_PD_OR_RETURN(); + //printf("GET COLOR2 of state '%s'\n", state); if (r) *r = pd->color2.r; @@ -1864,6 +1920,7 @@ EAPI void edje_edit_state_color3_get(Evas_Object *obj, const char *part, const char *state, int *r, int *g, int *b, int *a) { GET_PD_OR_RETURN(); + //printf("GET COLOR3 of state '%s'\n", state); if (r) *r = pd->color3.r; @@ -1876,6 +1933,7 @@ EAPI void edje_edit_state_color_set(Evas_Object *obj, const char *part, const char *state, int r, int g, int b, int a) { GET_PD_OR_RETURN(); + //printf("SET COLOR of state '%s'\n", state); if (r > -1 && r < 256) pd->color.r = r; @@ -1890,6 +1948,7 @@ EAPI void edje_edit_state_color2_set(Evas_Object *obj, const char *part, const char *state, int r, int g, int b, int a) { GET_PD_OR_RETURN(); + //printf("SET COLOR2 of state '%s'\n", state); if (r > -1 && r < 256) pd->color2.r = r; @@ -1904,6 +1963,7 @@ EAPI void edje_edit_state_color3_set(Evas_Object *obj, const char *part, const char *state, int r, int g, int b, int a) { GET_PD_OR_RETURN(); + //printf("SET COLOR3 of state '%s'\n", state); if (r > -1 && r < 256) pd->color3.r = r; @@ -1919,6 +1979,7 @@ EAPI double edje_edit_state_align_x_get(Evas_Object *obj, const char *part, const char *state) { GET_PD_OR_RETURN(0); + //printf("GET ALIGN_X of state '%s' [%f]\n", state, pd->align.x); return pd->align.x; @@ -1928,6 +1989,7 @@ EAPI double edje_edit_state_align_y_get(Evas_Object *obj, const char *part, const char *state) { GET_PD_OR_RETURN(0); + //printf("GET ALIGN_Y of state '%s' [%f]\n", state, pd->align.y); return pd->align.y; @@ -1945,6 +2007,7 @@ EAPI void edje_edit_state_align_y_set(Evas_Object *obj, const char *part, const char *state, double align) { GET_PD_OR_RETURN(); + printf("SET ALIGN_Y of state '%s' [to: %f]\n", state, align); pd->align.y = align; } @@ -1954,6 +2017,7 @@ EAPI int edje_edit_state_min_w_get(Evas_Object *obj, const char *part, const char *state) { GET_PD_OR_RETURN(0); + printf("GET MIN_W of state '%s' [%d]\n", state, pd->min.w); return pd->min.w; } @@ -1962,6 +2026,7 @@ EAPI void edje_edit_state_min_w_set(Evas_Object *obj, const char *part, const char *state, int min_w) { GET_PD_OR_RETURN(); + printf("SET MIN_W of state '%s' [to: %d]\n", state, min_w); pd->min.w = min_w; } @@ -1970,6 +2035,7 @@ EAPI int edje_edit_state_min_h_get(Evas_Object *obj, const char *part, const char *state) { GET_PD_OR_RETURN(0); + printf("GET MIN_H of state '%s' [%d]\n", state, pd->min.h); return pd->min.h; } @@ -1978,6 +2044,7 @@ EAPI void edje_edit_state_min_h_set(Evas_Object *obj, const char *part, const char *state, int min_h) { GET_PD_OR_RETURN(); + printf("SET MIN_H of state '%s' [to: %d]\n", state, min_h); pd->min.h = min_h; } @@ -1986,6 +2053,7 @@ EAPI int edje_edit_state_max_w_get(Evas_Object *obj, const char *part, const char *state) { GET_PD_OR_RETURN(0); + printf("GET MAX_W of state '%s' [%d]\n", state, pd->max.w); return pd->max.w; } @@ -1994,6 +2062,7 @@ EAPI void edje_edit_state_max_w_set(Evas_Object *obj, const char *part, const char *state, int max_w) { GET_PD_OR_RETURN(); + printf("SET MAX_W of state '%s' [to: %d]\n", state, max_w); pd->max.w = max_w; } @@ -2002,6 +2071,7 @@ EAPI int edje_edit_state_max_h_get(Evas_Object *obj, const char *part, const char *state) { GET_PD_OR_RETURN(0); + printf("GET MAX_H of state '%s' [%d]\n", state, pd->max.h); return pd->max.h; } @@ -2010,6 +2080,7 @@ EAPI void edje_edit_state_max_h_set(Evas_Object *obj, const char *part, const char *state, int max_h) { GET_PD_OR_RETURN(); + printf("SET MAX_H of state '%s' [to: %d]\n", state, max_h); pd->max.h = max_h; } @@ -2019,6 +2090,7 @@ EAPI double edje_edit_state_aspect_min_get(Evas_Object *obj, const char *part, const char *state) { GET_PD_OR_RETURN(0); + printf("GET ASPECT_MIN of state '%s' [%f]\n", state, pd->aspect.min); return pd->aspect.min; } @@ -2027,6 +2099,7 @@ EAPI double edje_edit_state_aspect_max_get(Evas_Object *obj, const char *part, const char *state) { GET_PD_OR_RETURN(0); + printf("GET ASPECT_MAX of state '%s' [%f]\n", state, pd->aspect.max); return pd->aspect.max; } @@ -2035,6 +2108,7 @@ EAPI void edje_edit_state_aspect_min_set(Evas_Object *obj, const char *part, const char *state, double aspect) { GET_PD_OR_RETURN(); + printf("SET ASPECT_MIN of state '%s' [to: %f]\n", state, aspect); pd->aspect.min = aspect; } @@ -2043,6 +2117,7 @@ EAPI void edje_edit_state_aspect_max_set(Evas_Object *obj, const char *part, const char *state, double aspect) { GET_PD_OR_RETURN(); + printf("SET ASPECT_MAX of state '%s' [to: %f]\n", state, aspect); pd->aspect.max = aspect; } @@ -2051,6 +2126,7 @@ EAPI unsigned char edje_edit_state_aspect_pref_get(Evas_Object *obj, const char *part, const char *state) { GET_PD_OR_RETURN(0); + printf("GET ASPECT_PREF of state '%s' [%d]\n", state, pd->aspect.prefer); return pd->aspect.prefer; } @@ -2059,6 +2135,7 @@ EAPI void edje_edit_state_aspect_pref_set(Evas_Object *obj, const char *part, const char *state, unsigned char pref) { GET_PD_OR_RETURN(); + printf("SET ASPECT_PREF of state '%s' [to: %d]\n", state, pref); pd->aspect.prefer = pref; } @@ -2070,6 +2147,7 @@ EAPI const char * edje_edit_state_text_get(Evas_Object *obj, const char *part, const char *state) { GET_PD_OR_RETURN(NULL); + //printf("GET TEXT of state: %s\n", state); if (pd->text.text) @@ -2082,6 +2160,7 @@ EAPI void edje_edit_state_text_set(Evas_Object *obj, const char *part, const char *state, const char *text) { GET_PD_OR_RETURN(); + //printf("SET TEXT of state: %s\n", state); if (!text) return; @@ -2096,6 +2175,7 @@ EAPI int edje_edit_state_text_size_get(Evas_Object *obj, const char *part, const char *state) { GET_PD_OR_RETURN(-1); + //printf("GET TEXT_SIZE of state: %s [%d]\n", state, pd->text.size); return pd->text.size; } @@ -2104,6 +2184,7 @@ EAPI void edje_edit_state_text_size_set(Evas_Object *obj, const char *part, const char *state, int size) { GET_PD_OR_RETURN(); + //printf("SET TEXT_SIZE of state: %s [%d]\n", state, size); if (size < 0) return; @@ -2117,6 +2198,7 @@ EAPI double edje_edit_state_text_align_x_get(Evas_Object *obj, const char *part, const char *state) { GET_PD_OR_RETURN(0); + //printf("GET TEXT_ALIGN_X of state: %s [%f]\n", state, pd->text.align.x); return pd->text.align.x; } @@ -2125,6 +2207,7 @@ EAPI void edje_edit_state_text_align_x_set(Evas_Object *obj, const char *part, const char *state, double align) { GET_PD_OR_RETURN(); + //printf("SET TEXT_ALIGN_X of state: %s [%f]\n", state, align); pd->text.align.x = align; @@ -2135,6 +2218,7 @@ EAPI double edje_edit_state_text_align_y_get(Evas_Object *obj, const char *part, const char *state) { GET_PD_OR_RETURN(0.0); + //printf("GET TEXT_ALIGN_Y of state: %s [%f]\n", state, pd->text.align.x); return pd->text.align.y; } @@ -2143,6 +2227,7 @@ EAPI void edje_edit_state_text_align_y_set(Evas_Object *obj, const char *part, const char *state, double align) { GET_PD_OR_RETURN(); + //printf("SET TEXT_ALIGN_Y of state: %s [%f]\n", state, align); pd->text.align.y = align; @@ -2176,18 +2261,20 @@ edje_edit_fonts_list_get(Evas_Object *obj) EAPI unsigned char edje_edit_font_add(Evas_Object *obj, const char* path) { - printf("ADD FONT: %s\n", path); + char buf[MAX_PATH]; Font *fn; Edje_Font_Directory_Entry *fnt; Eet_File *eetf; struct stat st; char *name; - char buf[MAX_PATH]; FILE *f; void *fdata = NULL; int fsize = 0; GET_ED_OR_RETURN(0); + + printf("ADD FONT: %s\n", path); + if (!path) return 0; if (stat(path, &st) || !S_ISREG(st.st_mode)) return 0; if (!ed->file) return 0; @@ -2295,6 +2382,7 @@ EAPI const char * edje_edit_state_font_get(Evas_Object *obj, const char *part, const char *state) { GET_PD_OR_RETURN(NULL); + printf("GET FONT of state: %s [%s]\n", state, pd->text.font); if (!pd->text.font) return NULL; return evas_stringshare_add(pd->text.font); @@ -2304,6 +2392,7 @@ EAPI void edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, const char *font) { GET_PD_OR_RETURN(); + printf("SET FONT of state: %s [%s]\n", state, font); _edje_if_string_free(ed, pd->text.font); @@ -2316,6 +2405,7 @@ EAPI unsigned char edje_edit_part_effect_get(Evas_Object *obj, const char *part) { GET_RP_OR_RETURN(0); + printf("GET EFFECT of part: %s\n", part); return rp->part->effect; } @@ -2324,6 +2414,7 @@ EAPI void edje_edit_part_effect_set(Evas_Object *obj, const char *part, unsigned char effect) { GET_RP_OR_RETURN(); + printf("SET EFFECT of part: %s [%d]\n", part, effect); rp->part->effect = effect; @@ -2383,6 +2474,7 @@ edje_edit_image_add(Evas_Object *obj, const char* path) for (l = ed->file->image_dir->entries; l; l = l->next) { Edje_Image_Directory_Entry *i; + i = l->data; if (!i) return 0; if (i->id >= free_id) free_id = i->id + 1; /*TODO search for free (hole) id*/ @@ -2420,6 +2512,7 @@ EAPI const char * edje_edit_state_image_get(Evas_Object *obj, const char *part, const char *state) { char *image; + GET_PD_OR_RETURN(NULL); image = (char *)_edje_image_name_find(obj, pd->image.id); @@ -2433,6 +2526,7 @@ EAPI void edje_edit_state_image_set(Evas_Object *obj, const char *part, const char *state, const char *image) { int id; + GET_PD_OR_RETURN(); if (!image) return; @@ -2453,6 +2547,7 @@ edje_edit_state_tweens_list_get(Evas_Object *obj, const char *part, const char * const char *name; GET_PD_OR_RETURN(NULL); + //printf("GET TWEEN LIST for %s\n", state); for (l = pd->image.tween_list; l; l = l->next) @@ -2471,6 +2566,7 @@ edje_edit_state_tween_add(Evas_Object *obj, const char *part, const char *state, { Edje_Part_Image_Id *i; int id; + GET_PD_OR_RETURN(0); id = _edje_image_id_find(obj, tween); @@ -2492,6 +2588,7 @@ edje_edit_state_tween_del(Evas_Object *obj, const char *part, const char *state, { Evas_List *l; int id; + GET_PD_OR_RETURN(0); if (!pd->image.tween_list) return 0; @@ -2502,6 +2599,7 @@ edje_edit_state_tween_del(Evas_Object *obj, const char *part, const char *state, for (l = pd->image.tween_list; l; l = l->next) { Edje_Part_Image_Id *i; + i = l->data; if (i->id == id) { @@ -2516,6 +2614,7 @@ EAPI void edje_edit_state_image_border_get(Evas_Object *obj, const char *part, const char *state, int *l, int *r, int *t, int *b) { GET_PD_OR_RETURN(); + //printf("GET IMAGE_BORDER of state '%s'\n", state); if (l) *l = pd->border.l; @@ -2528,6 +2627,7 @@ EAPI void edje_edit_state_image_border_set(Evas_Object *obj, const char *part, const char *state, int l, int r, int t, int b) { GET_PD_OR_RETURN(); + //printf("SET IMAGE_BORDER of state '%s'\n", state); if (l > -1) pd->border.l = l; @@ -2573,6 +2673,7 @@ edje_edit_programs_list_get(Evas_Object *obj) for (i = 0; i < ed->table_programs_size; i++) { Edje_Program *epr; + epr = ed->table_programs[i]; progs = evas_list_append(progs, evas_stringshare_add(epr->name)); } @@ -2587,9 +2688,11 @@ edje_edit_program_add(Evas_Object *obj, const char *name) { Edje_Program *epr; Edje_Part_Collection *pc; - printf("ADD PROGRAM [new name: %s]\n", name); + GET_ED_OR_RETURN(0); + printf("ADD PROGRAM [new name: %s]\n", name); + //Check if program already exists if (_edje_program_get_byname(obj, name)) return 0; @@ -2641,16 +2744,18 @@ edje_edit_program_add(Evas_Object *obj, const char *name) EAPI unsigned char edje_edit_program_del(Evas_Object *obj, const char *prog) { - printf("DEL PROGRAM: %s\n", prog); Evas_List *l; + Edje_Part_Collection *pc; int id, i; + int old_id; + GET_ED_OR_RETURN(0); GET_EPR_OR_RETURN(0); + printf("DEL PROGRAM: %s\n", prog); //Remove program from programs list id = epr->id; - Edje_Part_Collection *pc; pc = ed->collection; pc->programs = evas_list_remove(pc->programs, epr); @@ -2689,10 +2794,10 @@ edje_edit_program_del(Evas_Object *obj, const char *prog) sizeof(Edje_Program *) * ed->table_programs_size); //Update the id of the moved program - int old_id; if (id < ed->table_programs_size) { Edje_Program *p; + p = ed->table_programs[id % ed->table_programs_size]; printf("UPDATE: %s(id:%d) with new id: %d\n", p->name, p->id, id); @@ -2706,6 +2811,7 @@ edje_edit_program_del(Evas_Object *obj, const char *prog) for (i = 0; i < ed->table_programs_size; i++) { Edje_Program *p; + p = ed->table_programs[i]; // printf("Check dependencies on %s\n", p->name); /* check in afters */ @@ -2759,6 +2865,7 @@ EAPI unsigned char edje_edit_program_exist(Evas_Object *obj, const char *prog) { GET_EPR_OR_RETURN(0); + return 1; } @@ -2767,6 +2874,7 @@ edje_edit_program_run(Evas_Object *obj, const char *prog) { GET_ED_OR_RETURN(0); GET_EPR_OR_RETURN(0); + _edje_program_run(ed, epr, 0, "", ""); return 1; } @@ -2776,6 +2884,7 @@ edje_edit_program_name_set(Evas_Object *obj, const char *prog, const char* new_n { GET_ED_OR_RETURN(0); GET_EPR_OR_RETURN(0); + if (!new_name) return 0; if (_edje_program_get_byname(obj, new_name)) return 0; @@ -2803,6 +2912,7 @@ edje_edit_program_source_set(Evas_Object *obj, const char *prog, const char *sou { GET_ED_OR_RETURN(0); GET_EPR_OR_RETURN(0); + if (!source) return 0; printf("SET SOURCE for program: %s [%s]\n", prog, source); @@ -2833,6 +2943,7 @@ edje_edit_program_signal_set(Evas_Object *obj, const char *prog, const char *sig { GET_ED_OR_RETURN(0); GET_EPR_OR_RETURN(0); + if (!signal) return 0; printf("SET SIGNAL for program: %s [%s]\n", prog, signal); @@ -2938,6 +3049,7 @@ EAPI double edje_edit_program_in_from_get(Evas_Object *obj, const char *prog) { GET_EPR_OR_RETURN(0); + //printf("GET IN.FROM for program: %s [%f]\n", prog, epr->in.from); return epr->in.from; } @@ -2946,6 +3058,7 @@ EAPI unsigned char edje_edit_program_in_from_set(Evas_Object *obj, const char *prog, double seconds) { GET_EPR_OR_RETURN(0); + //printf("SET IN.FROM for program: %s [%f]\n", prog, epr->in.from); epr->in.from = seconds; return 1; @@ -2955,6 +3068,7 @@ EAPI double edje_edit_program_in_range_get(Evas_Object *obj, const char *prog) { GET_EPR_OR_RETURN(0); + //printf("GET IN.RANGE for program: %s [%f]\n", prog, epr->in.range); return epr->in.range; } @@ -2963,6 +3077,7 @@ EAPI unsigned char edje_edit_program_in_range_set(Evas_Object *obj, const char *prog, double seconds) { GET_EPR_OR_RETURN(0); + //printf("SET IN.RANGE for program: %s [%f]\n", prog, epr->in.range); epr->in.range = seconds; return 1; @@ -2972,6 +3087,7 @@ EAPI int edje_edit_program_transition_get(Evas_Object *obj, const char *prog) { GET_EPR_OR_RETURN(-1); + //printf("GET TRANSITION for program: %s [%d]\n", prog, epr->tween.mode); return epr->tween.mode; } @@ -2980,6 +3096,7 @@ EAPI unsigned char edje_edit_program_transition_set(Evas_Object *obj, const char *prog, int transition) { GET_EPR_OR_RETURN(0); + //printf("GET TRANSITION for program: %s [%d]\n", prog, epr->tween.mode); epr->tween.mode = transition; return 1; @@ -2989,6 +3106,7 @@ EAPI double edje_edit_program_transition_time_get(Evas_Object *obj, const char *prog) { GET_EPR_OR_RETURN(-1); + //printf("GET TRANSITION_TIME for program: %s [%.4f]\n", prog, epr->tween.time); return epr->tween.time; } @@ -2997,6 +3115,7 @@ EAPI unsigned char edje_edit_program_transition_time_set(Evas_Object *obj, const char *prog, double seconds) { GET_EPR_OR_RETURN(0); + //printf("GET TRANSITION_TIME for program: %s [%.4f]\n", prog, epr->tween.time); epr->tween.time = seconds; return 1; @@ -3006,6 +3125,7 @@ EAPI int edje_edit_program_action_get(Evas_Object *obj, const char *prog) { GET_EPR_OR_RETURN(-1); + //printf("GET ACTION for program: %s [%d]\n", prog, epr->action); return epr->action; } @@ -3014,6 +3134,7 @@ EAPI unsigned char edje_edit_program_action_set(Evas_Object *obj, const char *prog, int action) { GET_EPR_OR_RETURN(0); + //printf("SET ACTION for program: %s [%d]\n", prog, action); if (action >= EDJE_ACTION_TYPE_LAST) return 0; @@ -3034,12 +3155,14 @@ edje_edit_program_targets_get(Evas_Object *obj, const char *prog) for (l = epr->targets; l; l = l->next) { Edje_Program_Target *t; + t = l->data; if (epr->action == EDJE_ACTION_TYPE_STATE_SET) { /* the target is a part */ Edje_Real_Part *p = NULL; + p = ed->table_parts[t->id % ed->table_parts_size]; if (p && p->part && p->part->name) targets = evas_list_append(targets, @@ -3049,6 +3172,7 @@ edje_edit_program_targets_get(Evas_Object *obj, const char *prog) { /* the target is a program */ Edje_Program *p; + p = ed->table_programs[t->id % ed->table_programs_size]; if (p && p->name) targets = evas_list_append(targets, @@ -3080,6 +3204,7 @@ edje_edit_program_target_add(Evas_Object *obj, const char *prog, const char *tar { int id; Edje_Program_Target *t; + GET_ED_OR_RETURN(0); GET_EPR_OR_RETURN(0); @@ -3087,6 +3212,7 @@ edje_edit_program_target_add(Evas_Object *obj, const char *prog, const char *tar { /* the target is a part */ Edje_Real_Part *rp; + rp = _edje_real_part_get(ed, target); if (!rp) return 0; id = rp->part->id; @@ -3095,6 +3221,7 @@ edje_edit_program_target_add(Evas_Object *obj, const char *prog, const char *tar { /* the target is a program */ Edje_Program *tar; + tar = _edje_program_get_byname(obj, target); if (!tar) return 0; id = tar->id; @@ -3145,6 +3272,7 @@ edje_edit_program_afters_clear(Evas_Object *obj, const char *prog) while (epr->after) { Edje_Program_After *pa; + pa = epr->after->data; epr->after = evas_list_remove_list(epr->after, epr->after); free(pa); @@ -3158,6 +3286,7 @@ edje_edit_program_after_add(Evas_Object *obj, const char *prog, const char *afte { Edje_Program *af; Edje_Program_After *a; + GET_EPR_OR_RETURN(0); af = _edje_program_get_byname(obj, after); @@ -3256,10 +3385,10 @@ _edje_generate_source(Edje *ed) EAPI int edje_edit_save(Evas_Object *obj) { + char buf[256]; Edje_File *ef; Eet_File *eetf; int bytes; - char buf[256]; char *progname = "Edje_Edit"; GET_ED_OR_RETURN(0); @@ -3313,6 +3442,7 @@ EAPI void edje_edit_print_internal_status(Evas_Object *obj) { Evas_List *l; + GET_ED_OR_RETURN(); //_edje_generate_source(ed);