Inspect: add objects information comparison
Genlists management needed to be modified to fit this new feature
This commit is contained in:
parent
fbd75a4356
commit
56cfef5694
|
@ -11,24 +11,40 @@
|
|||
|
||||
#include "tsuite_file_data.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EX_SCENARIO,
|
||||
EX_IMAGE,
|
||||
EX_OBJ_INFO
|
||||
} _Data_Type;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *p1;
|
||||
void *p2;
|
||||
} _Two_Ptrs;
|
||||
_Data_Type dt;
|
||||
} _Compare_Item_Data;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *ex_parent;
|
||||
Eo *gl_item;
|
||||
} _Item_Info;
|
||||
|
||||
static Eo *_main_box = NULL;
|
||||
static Eina_List *_gls = NULL;
|
||||
static Eina_List *_units = NULL;
|
||||
static Eo *_comp_selected_item = NULL;
|
||||
|
||||
static Elm_Genlist_Item_Class *_grp_itc = NULL, *_scn_itc = NULL, *_img_itc = NULL;
|
||||
static Elm_Genlist_Item_Class *_comp_scn_itc = NULL, *_comp_img_itc = NULL;
|
||||
static Elm_Genlist_Item_Class *_objs_itc = NULL, *_comp_objs_itc = NULL;
|
||||
static Elm_Genlist_Item_Class *_obj_itc = NULL, *_comp_obj_itc = NULL;
|
||||
static Elm_Genlist_Item_Class *_objs_itc = NULL, *_obj_itc = NULL;
|
||||
|
||||
static Eina_Hash *_item_infos_hash = NULL;
|
||||
|
||||
static const char *
|
||||
_event_name_get(const Variant_st *v)
|
||||
{
|
||||
if (!v) return NULL;
|
||||
switch(tsuite_event_mapping_type_get(v->t.type))
|
||||
{
|
||||
case TSUITE_EVENT_MOUSE_IN: return "Mouse In";
|
||||
|
@ -236,6 +252,30 @@ _pixels_compare(Exactness_Image *img1, Exactness_Image *img2, Eina_Bool *has_dif
|
|||
return imgO;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_are_objs_different(Exactness_Object *e_obj1, Exactness_Object *e_obj2, Eina_Bool check_objs)
|
||||
{
|
||||
if (!e_obj1 ^ !e_obj2) return EINA_TRUE;
|
||||
Eina_List *itr1 = e_obj1->children;
|
||||
Eina_List *itr2 = e_obj2->children;
|
||||
if (check_objs &&
|
||||
(strcmp(e_obj1->kl_name, e_obj2->kl_name) ||
|
||||
e_obj1->x != e_obj2->x || e_obj1->y != e_obj2->y ||
|
||||
e_obj1->w != e_obj2->w || e_obj1->h != e_obj2->h)) return EINA_TRUE;
|
||||
while (itr1 || itr2)
|
||||
{
|
||||
if ((!itr1) ^ (!itr2)) return EINA_TRUE;
|
||||
e_obj1 = eina_list_data_get(itr1);
|
||||
e_obj2 = eina_list_data_get(itr2);
|
||||
|
||||
if (_are_objs_different(e_obj1, e_obj2, EINA_TRUE)) return EINA_TRUE;
|
||||
|
||||
itr1 = eina_list_next(itr1);
|
||||
itr2 = eina_list_next(itr2);
|
||||
}
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
_win_del(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
|
@ -271,40 +311,38 @@ _gui_win_create()
|
|||
}
|
||||
|
||||
static char *
|
||||
_grp_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
|
||||
_grp_text_get(void *data, Evas_Object *gl, const char *part EINA_UNUSED)
|
||||
{
|
||||
return strdup(data);
|
||||
char buf[256];
|
||||
const char *str = NULL;
|
||||
Eina_Bool compare = !!efl_key_data_get(gl, "_exactness_gl_compare");
|
||||
_Data_Type dt = (_Data_Type) data;
|
||||
switch (dt)
|
||||
{
|
||||
case EX_SCENARIO: { str = "Scenario"; break; }
|
||||
case EX_IMAGE: { str = "Images"; break; }
|
||||
case EX_OBJ_INFO: { str = "Objects"; break; }
|
||||
default: { str = "Unknown"; break; }
|
||||
}
|
||||
sprintf(buf, "%s%s", str, compare ? " comparison" : "");
|
||||
return strdup(buf);
|
||||
}
|
||||
|
||||
static char *
|
||||
_scn_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
|
||||
_scn_text_get(void *data, Evas_Object *gl, const char *part EINA_UNUSED)
|
||||
{
|
||||
Variant_st *v = data;
|
||||
Eina_Strbuf *buf = eina_strbuf_new();
|
||||
char *ret = NULL;
|
||||
unsigned int timestamp = evt_time_get(0, v);
|
||||
char specific_output[1024];
|
||||
eina_strbuf_append_printf(buf, "%.3f: ", timestamp / 1000.0);
|
||||
eina_strbuf_append_printf(buf, "%s", _event_name_get(v));
|
||||
_event_specific_info_get(v, specific_output);
|
||||
if (*specific_output) eina_strbuf_append_printf(buf, " - %s", specific_output);
|
||||
ret = eina_strbuf_string_steal(buf);
|
||||
eina_strbuf_free(buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *
|
||||
_comp_scn_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
|
||||
{
|
||||
_Two_Ptrs *vv = data;
|
||||
Eina_Bool compare = !!efl_key_data_get(gl, "_exactness_gl_compare");
|
||||
if (compare)
|
||||
{
|
||||
_Compare_Item_Data *vv = data;
|
||||
Variant_st *v1 = vv->p1;
|
||||
Variant_st *v2 = vv->p2;
|
||||
int tm1 = evt_time_get(0, v1);
|
||||
int tm2 = evt_time_get(0, v2);
|
||||
Tsuite_Event_Type t1 = tsuite_event_mapping_type_get(v1->t.type);
|
||||
Tsuite_Event_Type t2 = tsuite_event_mapping_type_get(v2->t.type);
|
||||
Eina_Strbuf *buf = eina_strbuf_new();
|
||||
char *ret = NULL;
|
||||
Tsuite_Event_Type t1 = v1 ? tsuite_event_mapping_type_get(v1->t.type) : TSUITE_EVENT_NOT_SUPPORTED;
|
||||
Tsuite_Event_Type t2 = v2 ? tsuite_event_mapping_type_get(v2->t.type) : TSUITE_EVENT_NOT_SUPPORTED;
|
||||
|
||||
if (tm1 != tm2) eina_strbuf_append_printf(buf, "[%.3f/%.3f]: ", tm1/1000.0, tm2/1000.0);
|
||||
else eina_strbuf_append_printf(buf, "%.3f: ", tm1 / 1000.0);
|
||||
|
@ -327,6 +365,22 @@ _comp_scn_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EI
|
|||
eina_strbuf_append_printf(buf, " - %s", params1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Variant_st *v = data;
|
||||
unsigned int timestamp = evt_time_get(0, v);
|
||||
char specific_output[1024];
|
||||
if (v)
|
||||
{
|
||||
eina_strbuf_append_printf(buf, "%.3f: ", timestamp / 1000.0);
|
||||
eina_strbuf_append_printf(buf, "%s", _event_name_get(v));
|
||||
_event_specific_info_get(v, specific_output);
|
||||
if (*specific_output) eina_strbuf_append_printf(buf, " - %s", specific_output);
|
||||
}
|
||||
else
|
||||
eina_strbuf_append(buf, "XXXXX");
|
||||
}
|
||||
|
||||
ret = eina_strbuf_string_steal(buf);
|
||||
eina_strbuf_free(buf);
|
||||
|
@ -334,34 +388,30 @@ _comp_scn_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EI
|
|||
}
|
||||
|
||||
static Evas_Object *
|
||||
_img_content_get(void *data, Evas_Object *obj, const char *part)
|
||||
_img_content_get(void *data, Evas_Object *gl, const char *part)
|
||||
{
|
||||
if (strcmp(part, "elm.swallow.content")) return NULL;
|
||||
Exactness_Image *ex_img = data;
|
||||
Eo *img = elm_image_add(obj);
|
||||
Eo *img = elm_image_add(gl);
|
||||
Eo *evas_img = elm_image_object_get(img);
|
||||
Eina_Bool compare = !!efl_key_data_get(gl, "_exactness_gl_compare");
|
||||
if (compare)
|
||||
{
|
||||
_Compare_Item_Data *vv = data;
|
||||
Exactness_Image *ex_img1 = vv->p1;
|
||||
Exactness_Image *ex_img2 = vv->p2;
|
||||
Exactness_Image *ex_imgO = _pixels_compare(ex_img1, ex_img2, NULL);
|
||||
|
||||
evas_object_image_size_set(evas_img, ex_imgO->w, ex_imgO->h);
|
||||
evas_object_image_data_set(evas_img, ex_imgO->pixels);
|
||||
evas_object_size_hint_min_set(img, ELM_SCALE_SIZE(300), ELM_SCALE_SIZE(300));
|
||||
}
|
||||
else
|
||||
{
|
||||
Exactness_Image *ex_img = data;
|
||||
evas_object_image_size_set(evas_img, ex_img->w, ex_img->h);
|
||||
evas_object_image_data_set(evas_img, ex_img->pixels);
|
||||
|
||||
evas_object_size_hint_min_set(img, ELM_SCALE_SIZE(300), ELM_SCALE_SIZE(300));
|
||||
return img;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_comp_img_content_get(void *data, Evas_Object *obj, const char *part)
|
||||
{
|
||||
if (strcmp(part, "elm.swallow.content")) return NULL;
|
||||
_Two_Ptrs *vv = data;
|
||||
Exactness_Image *img1 = vv->p1;
|
||||
Exactness_Image *img2 = vv->p2;
|
||||
Exactness_Image *imgO = _pixels_compare(img1, img2, NULL);
|
||||
|
||||
Eo *img = elm_image_add(obj);
|
||||
Eo *evas_img = elm_image_object_get(img);
|
||||
evas_object_image_size_set(evas_img, imgO->w, imgO->h);
|
||||
evas_object_image_data_set(evas_img, imgO->pixels);
|
||||
evas_object_size_hint_min_set(img, ELM_SCALE_SIZE(300), ELM_SCALE_SIZE(300));
|
||||
|
||||
}
|
||||
return img;
|
||||
}
|
||||
|
||||
|
@ -372,14 +422,70 @@ _objs_text_get(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char
|
|||
}
|
||||
|
||||
static char *
|
||||
_obj_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
|
||||
_obj_text_get(void *data, Evas_Object *gl, const char *part EINA_UNUSED)
|
||||
{
|
||||
Eina_Strbuf *buf = eina_strbuf_new();
|
||||
char *ret = NULL;
|
||||
Eina_Bool compare = !!efl_key_data_get(gl, "_exactness_gl_compare");
|
||||
if (compare)
|
||||
{
|
||||
_Compare_Item_Data *vv = data;
|
||||
Exactness_Object *e_obj1 = vv->p1;
|
||||
Exactness_Object *e_obj2 = vv->p2;
|
||||
if ((!e_obj1 ^ !e_obj2) || strcmp(e_obj1->kl_name, e_obj2->kl_name))
|
||||
eina_strbuf_append_printf(buf, "(%s/%s)",
|
||||
e_obj1 ? e_obj1->kl_name : "XXXXX",
|
||||
e_obj2 ? e_obj2->kl_name : "XXXXX");
|
||||
else
|
||||
eina_strbuf_append_printf(buf, "%s", e_obj1->kl_name);
|
||||
|
||||
eina_strbuf_append(buf, " x = ");
|
||||
if ((!e_obj1 ^ !e_obj2) || e_obj1->x != e_obj2->x)
|
||||
eina_strbuf_append_printf(buf, "%d/%d",
|
||||
e_obj1 ? e_obj1->x : -1,
|
||||
e_obj2 ? e_obj2->x : -1);
|
||||
else
|
||||
eina_strbuf_append_printf(buf, "%d", e_obj1->x);
|
||||
|
||||
eina_strbuf_append(buf, " y = ");
|
||||
if ((!e_obj1 ^ !e_obj2) || e_obj1->y != e_obj2->y)
|
||||
eina_strbuf_append_printf(buf, "%d/%d",
|
||||
e_obj1 ? e_obj1->y : -1,
|
||||
e_obj2 ? e_obj2->y : -1);
|
||||
else
|
||||
eina_strbuf_append_printf(buf, "%d", e_obj1->y);
|
||||
|
||||
eina_strbuf_append(buf, " w = ");
|
||||
if ((!e_obj1 ^ !e_obj2) || e_obj1->w != e_obj2->w)
|
||||
eina_strbuf_append_printf(buf, "%d/%d",
|
||||
e_obj1 ? e_obj1->w : -1,
|
||||
e_obj2 ? e_obj2->w : -1);
|
||||
else
|
||||
eina_strbuf_append_printf(buf, "%d", e_obj1->w);
|
||||
|
||||
eina_strbuf_append(buf, " h = ");
|
||||
if ((!e_obj1 ^ !e_obj2) || e_obj1->h != e_obj2->h)
|
||||
eina_strbuf_append_printf(buf, "%d/%d",
|
||||
e_obj1 ? e_obj1->h : -1,
|
||||
e_obj2 ? e_obj2->h : -1);
|
||||
else
|
||||
eina_strbuf_append_printf(buf, "%d", e_obj1->h);
|
||||
|
||||
if (e_obj1 && e_obj2 && _are_objs_different(e_obj1, e_obj2, EINA_FALSE))
|
||||
eina_strbuf_append(buf, " - DIFF INSIDE");
|
||||
}
|
||||
else
|
||||
{
|
||||
Exactness_Object *e_obj = data;
|
||||
char text[1024];
|
||||
sprintf(text, "0x%.8llX (%s) x = %d y = %d w = %d h = %d",
|
||||
e_obj->id, e_obj->kl_name,
|
||||
eina_strbuf_append_printf(buf,
|
||||
"%s: x = %d y = %d w = %d h = %d",
|
||||
e_obj->kl_name,
|
||||
e_obj->x, e_obj->y, e_obj->w, e_obj->h);
|
||||
return strdup(text);
|
||||
}
|
||||
|
||||
ret = eina_strbuf_string_steal(buf);
|
||||
eina_strbuf_free(buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -406,20 +512,6 @@ _itc_init()
|
|||
_img_itc->func.content_get = _img_content_get;
|
||||
}
|
||||
|
||||
if (!_comp_scn_itc)
|
||||
{
|
||||
_comp_scn_itc = elm_genlist_item_class_new();
|
||||
_comp_scn_itc->item_style = "default";
|
||||
_comp_scn_itc->func.text_get = _comp_scn_text_get;
|
||||
}
|
||||
|
||||
if (!_comp_img_itc)
|
||||
{
|
||||
_comp_img_itc = elm_genlist_item_class_new();
|
||||
_comp_img_itc->item_style = "full";
|
||||
_comp_img_itc->func.content_get = _comp_img_content_get;
|
||||
}
|
||||
|
||||
if (!_objs_itc)
|
||||
{
|
||||
_objs_itc = elm_genlist_item_class_new();
|
||||
|
@ -427,26 +519,12 @@ _itc_init()
|
|||
_objs_itc->func.text_get = _objs_text_get;
|
||||
}
|
||||
|
||||
if (!_comp_objs_itc)
|
||||
{
|
||||
_comp_objs_itc = elm_genlist_item_class_new();
|
||||
_comp_objs_itc->item_style = "default";
|
||||
//_comp_objs_itc->func.text_get = _comp_objs_text_get;
|
||||
}
|
||||
|
||||
if (!_obj_itc)
|
||||
{
|
||||
_obj_itc = elm_genlist_item_class_new();
|
||||
_obj_itc->item_style = "default";
|
||||
_obj_itc->func.text_get = _obj_text_get;
|
||||
}
|
||||
|
||||
if (!_comp_obj_itc)
|
||||
{
|
||||
_comp_obj_itc = elm_genlist_item_class_new();
|
||||
_comp_obj_itc->item_style = "default";
|
||||
//_comp_obj_itc->func.text_get = _comp_obj_text_get;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -464,89 +542,254 @@ _comp_gl_dragged_cb(Evas_Object *obj, void *data EINA_UNUSED)
|
|||
}
|
||||
|
||||
static void
|
||||
_gl_expand_request_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
_obj_item_realize(Exactness_Object *ex_obj)
|
||||
{
|
||||
_Item_Info *ii = eina_hash_find(_item_infos_hash, &ex_obj);
|
||||
if (!ii) return;
|
||||
if (ii->gl_item) return;
|
||||
_obj_item_realize(ii->ex_parent);
|
||||
_Item_Info *iip = eina_hash_find(_item_infos_hash, &(ii->ex_parent));
|
||||
if (iip->gl_item) elm_genlist_item_expanded_set(iip->gl_item, EINA_TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
_gl_expand_request_cb(void *data EINA_UNUSED, Evas_Object *gl, void *event_info)
|
||||
{
|
||||
Elm_Object_Item *glit = event_info;
|
||||
Eina_Bool compare = !!efl_key_data_get(gl, "_exactness_gl_compare");
|
||||
if (compare)
|
||||
{
|
||||
const Elm_Genlist_Item_Class *itc = elm_genlist_item_item_class_get(glit);
|
||||
if (itc == _objs_itc)
|
||||
{
|
||||
_Compare_Item_Data *vv = elm_object_item_data_get(glit);
|
||||
_Item_Info *ii = eina_hash_find(_item_infos_hash, &(vv->p1));
|
||||
if (ii) elm_genlist_item_expanded_set(ii->gl_item, EINA_TRUE);
|
||||
ii = eina_hash_find(_item_infos_hash, &(vv->p2));
|
||||
if (ii) elm_genlist_item_expanded_set(ii->gl_item, EINA_TRUE);
|
||||
}
|
||||
else if (itc == _obj_itc)
|
||||
{
|
||||
_Compare_Item_Data *vv = elm_object_item_data_get(glit);
|
||||
_Item_Info *ii = eina_hash_find(_item_infos_hash, &(vv->p1));
|
||||
if (!ii || !ii->gl_item) _obj_item_realize(vv->p1);
|
||||
if (!ii) ii = eina_hash_find(_item_infos_hash, &(vv->p1));
|
||||
if (ii && ii->gl_item) elm_genlist_item_expanded_set(ii->gl_item, EINA_TRUE);
|
||||
|
||||
ii = eina_hash_find(_item_infos_hash, &(vv->p2));
|
||||
if (!ii || !ii->gl_item) _obj_item_realize(vv->p2);
|
||||
if (!ii) ii = eina_hash_find(_item_infos_hash, &(vv->p2));
|
||||
if (ii && ii->gl_item) elm_genlist_item_expanded_set(ii->gl_item, EINA_TRUE);
|
||||
}
|
||||
}
|
||||
elm_genlist_item_expanded_set(glit, EINA_TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
_gl_contract_request_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
_gl_contract_request_cb(void *data EINA_UNUSED, Evas_Object *gl EINA_UNUSED, void *event_info)
|
||||
{
|
||||
Elm_Object_Item *glit = event_info;
|
||||
Eina_Bool compare = !!efl_key_data_get(gl, "_exactness_gl_compare");
|
||||
if (compare)
|
||||
{
|
||||
const Elm_Genlist_Item_Class *itc = elm_genlist_item_item_class_get(glit);
|
||||
if (itc == _objs_itc)
|
||||
{
|
||||
_Compare_Item_Data *vv = elm_object_item_data_get(glit);
|
||||
_Item_Info *ii = eina_hash_find(_item_infos_hash, &(vv->p1));
|
||||
if (ii) elm_genlist_item_expanded_set(ii->gl_item, EINA_FALSE);
|
||||
ii = eina_hash_find(_item_infos_hash, &(vv->p2));
|
||||
if (ii) elm_genlist_item_expanded_set(ii->gl_item, EINA_FALSE);
|
||||
}
|
||||
else if (itc == _obj_itc)
|
||||
{
|
||||
_Compare_Item_Data *vv = elm_object_item_data_get(glit);
|
||||
_Item_Info *ii = eina_hash_find(_item_infos_hash, &(vv->p1));
|
||||
if (ii && ii->gl_item) elm_genlist_item_expanded_set(ii->gl_item, EINA_FALSE);
|
||||
|
||||
ii = eina_hash_find(_item_infos_hash, &(vv->p2));
|
||||
if (ii && ii->gl_item) elm_genlist_item_expanded_set(ii->gl_item, EINA_FALSE);
|
||||
}
|
||||
}
|
||||
elm_genlist_item_expanded_set(glit, EINA_FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
_gl_expanded_cb(void *_data EINA_UNUSED, Evas_Object *gl, void *event_info)
|
||||
_gl_expanded_cb(void *_data EINA_UNUSED, Evas_Object *gl EINA_UNUSED, void *event_info)
|
||||
{
|
||||
Elm_Object_Item *glit = event_info;
|
||||
const Elm_Genlist_Item_Class *itc = elm_genlist_item_item_class_get(glit);
|
||||
Eina_Bool compare = !!efl_key_data_get(gl, "_exactness_gl_compare");
|
||||
if (itc == _objs_itc)
|
||||
{
|
||||
if (compare)
|
||||
{
|
||||
_Compare_Item_Data *vv = elm_object_item_data_get(glit);
|
||||
Exactness_Objects *e_objs1 = vv->p1;
|
||||
Exactness_Objects *e_objs2 = vv->p2;
|
||||
Eina_List *itr1 = e_objs1->main_objs, *itr2 = e_objs2->main_objs;
|
||||
|
||||
while (itr1 || itr2)
|
||||
{
|
||||
Exactness_Object *e_obj1 = eina_list_data_get(itr1);
|
||||
Exactness_Object *e_obj2 = eina_list_data_get(itr2);
|
||||
vv = calloc(1, sizeof(*vv));
|
||||
vv->p1 = e_obj1;
|
||||
vv->p2 = e_obj2;
|
||||
vv->dt = EX_OBJ_INFO;
|
||||
elm_genlist_item_append(gl, _obj_itc, vv, glit,
|
||||
e_obj1->children || e_obj2->children ? ELM_GENLIST_ITEM_TREE : ELM_GENLIST_ITEM_NONE,
|
||||
NULL, NULL);
|
||||
itr1 = eina_list_next(itr1);
|
||||
itr2 = eina_list_next(itr2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Exactness_Objects *e_objs = elm_object_item_data_get(glit);
|
||||
Eina_List *itr;
|
||||
Exactness_Object *e_obj;
|
||||
|
||||
EINA_LIST_FOREACH(e_objs->main_objs, itr, e_obj)
|
||||
{
|
||||
elm_genlist_item_append(gl, _obj_itc, e_obj, glit,
|
||||
_Item_Info *ii = eina_hash_find(_item_infos_hash, &e_obj);
|
||||
if (!ii)
|
||||
{
|
||||
ii = calloc(1, sizeof(*ii));
|
||||
eina_hash_set(_item_infos_hash, &e_obj, ii);
|
||||
}
|
||||
ii->ex_parent = e_objs;
|
||||
ii->gl_item = elm_genlist_item_append(gl, _obj_itc, e_obj, glit,
|
||||
e_obj->children ? ELM_GENLIST_ITEM_TREE : ELM_GENLIST_ITEM_NONE,
|
||||
NULL, NULL);
|
||||
efl_wref_add(ii->gl_item, &(ii->gl_item));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (itc == _obj_itc)
|
||||
{
|
||||
if (compare)
|
||||
{
|
||||
_Compare_Item_Data *vv = elm_object_item_data_get(glit);
|
||||
Exactness_Object *e_obj1 = vv->p1;
|
||||
Exactness_Object *e_obj2 = vv->p2;
|
||||
Eina_List *itr1 = e_obj1->children, *itr2 = e_obj2->children;
|
||||
|
||||
while (itr1 || itr2)
|
||||
{
|
||||
e_obj1 = eina_list_data_get(itr1);
|
||||
e_obj2 = eina_list_data_get(itr2);
|
||||
vv = calloc(1, sizeof(*vv));
|
||||
vv->p1 = e_obj1;
|
||||
vv->p2 = e_obj2;
|
||||
vv->dt = EX_OBJ_INFO;
|
||||
elm_genlist_item_append(gl, _obj_itc, vv, glit,
|
||||
(e_obj1 && e_obj1->children) || (e_obj2 && e_obj2->children) ?
|
||||
ELM_GENLIST_ITEM_TREE : ELM_GENLIST_ITEM_NONE,
|
||||
NULL, NULL);
|
||||
itr1 = eina_list_next(itr1);
|
||||
itr2 = eina_list_next(itr2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Exactness_Object *e_obj = elm_object_item_data_get(glit), *e_obj2;
|
||||
Eina_List *itr;
|
||||
|
||||
EINA_LIST_FOREACH(e_obj->children, itr, e_obj2)
|
||||
{
|
||||
elm_genlist_item_append(gl, _obj_itc, e_obj2, glit,
|
||||
_Item_Info *ii = eina_hash_find(_item_infos_hash, &e_obj2);
|
||||
if (!ii)
|
||||
{
|
||||
ii = calloc(1, sizeof(*ii));
|
||||
eina_hash_set(_item_infos_hash, &e_obj2, ii);
|
||||
}
|
||||
ii->ex_parent = e_obj;
|
||||
ii->gl_item = elm_genlist_item_append(gl, _obj_itc, e_obj2, glit,
|
||||
e_obj2->children ? ELM_GENLIST_ITEM_TREE : ELM_GENLIST_ITEM_NONE,
|
||||
NULL, NULL);
|
||||
efl_wref_add(ii->gl_item, &(ii->gl_item));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_gl_contracted_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
_gl_contracted_cb(void *data EINA_UNUSED, Evas_Object *gl EINA_UNUSED, void *event_info)
|
||||
{
|
||||
Elm_Object_Item *glit = event_info;
|
||||
elm_genlist_item_subitems_clear(glit);
|
||||
}
|
||||
|
||||
static void
|
||||
_gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2, int position)
|
||||
_comp_gl_selected_cb(void *data EINA_UNUSED, Evas_Object *gl EINA_UNUSED, void *event_info)
|
||||
{
|
||||
_comp_selected_item = event_info;
|
||||
_Compare_Item_Data *vv = elm_object_item_data_get(_comp_selected_item);
|
||||
if (vv->p1)
|
||||
{
|
||||
_Item_Info *ii = eina_hash_find(_item_infos_hash, &(vv->p1));
|
||||
if (!ii || !ii->gl_item) _obj_item_realize(vv->p1);
|
||||
elm_genlist_item_selected_set(ii->gl_item, EINA_TRUE);
|
||||
}
|
||||
|
||||
if (vv->p2)
|
||||
{
|
||||
_Item_Info *ii = eina_hash_find(_item_infos_hash, &(vv->p2));
|
||||
if (!ii || !ii->gl_item) _obj_item_realize(vv->p2);
|
||||
elm_genlist_item_selected_set(ii->gl_item, EINA_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2)
|
||||
{
|
||||
Eina_List *itr1, *itr2;
|
||||
Eo *gl;
|
||||
Eo *gl1, *gl2 = NULL, *glc = NULL;
|
||||
|
||||
gl = elm_genlist_add(_main_box);
|
||||
elm_genlist_homogeneous_set(gl, EINA_TRUE);
|
||||
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
efl_gfx_visible_set(gl, EINA_TRUE);
|
||||
_gls = eina_list_append(_gls, gl);
|
||||
gl1 = elm_genlist_add(_main_box);
|
||||
elm_genlist_homogeneous_set(gl1, EINA_TRUE);
|
||||
evas_object_size_hint_weight_set(gl1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(gl1, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
efl_gfx_entity_visible_set(gl1, EINA_TRUE);
|
||||
_gls = eina_list_append(_gls, gl1);
|
||||
elm_box_pack_end(_main_box, gl1);
|
||||
|
||||
evas_object_smart_callback_add(gl, "expand,request", _gl_expand_request_cb, NULL);
|
||||
evas_object_smart_callback_add(gl, "contract,request", _gl_contract_request_cb, NULL);
|
||||
evas_object_smart_callback_add(gl, "expanded", _gl_expanded_cb, NULL);
|
||||
evas_object_smart_callback_add(gl, "contracted", _gl_contracted_cb, NULL);
|
||||
|
||||
if (position == -1) elm_box_pack_end(_main_box, gl);
|
||||
else if (position == 0) elm_box_pack_start(_main_box, gl);
|
||||
else
|
||||
{
|
||||
Eina_List *children = elm_box_children_get(_main_box);
|
||||
Eo *before = eina_list_nth(children, position - 1);
|
||||
elm_box_pack_after(_main_box, gl, before);
|
||||
eina_list_free(children);
|
||||
}
|
||||
evas_object_smart_callback_add(gl1, "expand,request", _gl_expand_request_cb, NULL);
|
||||
evas_object_smart_callback_add(gl1, "contract,request", _gl_contract_request_cb, NULL);
|
||||
evas_object_smart_callback_add(gl1, "expanded", _gl_expanded_cb, NULL);
|
||||
evas_object_smart_callback_add(gl1, "contracted", _gl_contracted_cb, NULL);
|
||||
|
||||
if (unit2)
|
||||
{
|
||||
elm_interface_scrollable_vbar_drag_cb_set(gl, _comp_gl_dragged_cb);
|
||||
glc = elm_genlist_add(_main_box);
|
||||
elm_genlist_homogeneous_set(glc, EINA_TRUE);
|
||||
evas_object_size_hint_weight_set(glc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(glc, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
efl_gfx_entity_visible_set(glc, EINA_TRUE);
|
||||
elm_box_pack_end(_main_box, glc);
|
||||
|
||||
evas_object_smart_callback_add(glc, "expand,request", _gl_expand_request_cb, NULL);
|
||||
evas_object_smart_callback_add(glc, "contract,request", _gl_contract_request_cb, NULL);
|
||||
evas_object_smart_callback_add(glc, "expanded", _gl_expanded_cb, NULL);
|
||||
evas_object_smart_callback_add(glc, "contracted", _gl_contracted_cb, NULL);
|
||||
|
||||
efl_key_data_set(glc, "_exactness_gl_compare", glc);
|
||||
elm_interface_scrollable_scroll_down_cb_set(glc, _comp_gl_dragged_cb);
|
||||
elm_interface_scrollable_scroll_up_cb_set(glc, _comp_gl_dragged_cb);
|
||||
evas_object_smart_callback_add(glc, "selected", _comp_gl_selected_cb, NULL);
|
||||
|
||||
gl2 = elm_genlist_add(_main_box);
|
||||
elm_genlist_homogeneous_set(gl2, EINA_TRUE);
|
||||
evas_object_size_hint_weight_set(gl2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(gl2, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
efl_gfx_entity_visible_set(gl2, EINA_TRUE);
|
||||
_gls = eina_list_append(_gls, gl2);
|
||||
elm_box_pack_end(_main_box, gl2);
|
||||
|
||||
evas_object_smart_callback_add(gl2, "expand,request", _gl_expand_request_cb, NULL);
|
||||
evas_object_smart_callback_add(gl2, "contract,request", _gl_contract_request_cb, NULL);
|
||||
evas_object_smart_callback_add(gl2, "expanded", _gl_expanded_cb, NULL);
|
||||
evas_object_smart_callback_add(gl2, "contracted", _gl_contracted_cb, NULL);
|
||||
}
|
||||
_itc_init();
|
||||
|
||||
|
@ -554,21 +797,29 @@ _gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2, int position)
|
|||
itr2 = unit2 ? unit2->events : NULL;
|
||||
|
||||
if (itr1)
|
||||
elm_genlist_item_append(gl, _grp_itc, unit2 ? "Scenario comparison" : "Scenario", NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
|
||||
elm_genlist_item_append(gl1, _grp_itc, (void *)EX_SCENARIO, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
|
||||
if (itr2)
|
||||
{
|
||||
elm_genlist_item_append(gl2, _grp_itc, (void *)EX_SCENARIO, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
|
||||
elm_genlist_item_append(glc, _grp_itc, (void *)EX_SCENARIO, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
|
||||
}
|
||||
while (itr1 || itr2)
|
||||
{
|
||||
Variant_st *v1 = itr1 ? eina_list_data_get(itr1) : NULL;
|
||||
_Item_Info *ii = calloc(1, sizeof(*ii));
|
||||
eina_hash_set(_item_infos_hash, &v1, ii);
|
||||
ii->gl_item = elm_genlist_item_append(gl1, _scn_itc, v1, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
||||
if (unit2)
|
||||
{
|
||||
_Compare_Item_Data *vv = calloc(1, sizeof(*vv));
|
||||
Variant_st *v2 = itr2 ? eina_list_data_get(itr2) : NULL;
|
||||
_Two_Ptrs *vv = malloc(sizeof(*vv));
|
||||
vv->p1 = v1;
|
||||
vv->p2 = v2;
|
||||
elm_genlist_item_append(gl, _comp_scn_itc, vv, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
elm_genlist_item_append(gl, _scn_itc, v1, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
||||
vv->dt = EX_SCENARIO;
|
||||
ii = calloc(1, sizeof(*ii));
|
||||
eina_hash_set(_item_infos_hash, &v2, ii);
|
||||
ii->gl_item = elm_genlist_item_append(gl2, _scn_itc, v2, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
||||
elm_genlist_item_append(glc, _scn_itc, vv, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
||||
}
|
||||
if (itr1) itr1 = eina_list_next(itr1);
|
||||
if (itr2) itr2 = eina_list_next(itr2);
|
||||
|
@ -578,21 +829,29 @@ _gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2, int position)
|
|||
itr2 = unit2 ? unit2->imgs : NULL;
|
||||
|
||||
if (itr1)
|
||||
elm_genlist_item_append(gl, _grp_itc, unit2 ? "Images comparison" : "Images", NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
|
||||
elm_genlist_item_append(gl1, _grp_itc, (void *)EX_IMAGE, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
|
||||
if (itr2)
|
||||
{
|
||||
elm_genlist_item_append(gl2, _grp_itc, (void *)EX_IMAGE, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
|
||||
elm_genlist_item_append(glc, _grp_itc, (void *)EX_IMAGE, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
|
||||
}
|
||||
while (itr1 || itr2)
|
||||
{
|
||||
Exactness_Image *img1 = itr1 ? eina_list_data_get(itr1) : NULL;
|
||||
_Item_Info *ii = calloc(1, sizeof(*ii));
|
||||
eina_hash_set(_item_infos_hash, &img1, ii);
|
||||
ii->gl_item = elm_genlist_item_append(gl1, _img_itc, img1, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
||||
if (unit2)
|
||||
{
|
||||
_Compare_Item_Data *vv = calloc(1, sizeof(*vv));
|
||||
Exactness_Image *img2 = itr2 ? eina_list_data_get(itr2) : NULL;
|
||||
_Two_Ptrs *vv = malloc(sizeof(*vv));
|
||||
vv->p1 = img1;
|
||||
vv->p2 = img2;
|
||||
elm_genlist_item_append(gl, _comp_img_itc, vv, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
elm_genlist_item_append(gl, _img_itc, img1, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
||||
vv->dt = EX_IMAGE;
|
||||
ii = calloc(1, sizeof(*ii));
|
||||
eina_hash_set(_item_infos_hash, &img2, ii);
|
||||
ii->gl_item = elm_genlist_item_append(gl2, _img_itc, img2, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
||||
elm_genlist_item_append(glc, _img_itc, vv, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
||||
}
|
||||
if (itr1) itr1 = eina_list_next(itr1);
|
||||
if (itr2) itr2 = eina_list_next(itr2);
|
||||
|
@ -602,21 +861,33 @@ _gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2, int position)
|
|||
itr2 = unit2 ? unit2->objs : NULL;
|
||||
|
||||
if (itr1)
|
||||
elm_genlist_item_append(gl, _grp_itc, unit2 ? "Objects comparison" : "Objects", NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
|
||||
elm_genlist_item_append(gl1, _grp_itc, (void *)EX_OBJ_INFO, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
|
||||
if (itr2)
|
||||
{
|
||||
elm_genlist_item_append(gl2, _grp_itc, (void *)EX_OBJ_INFO, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
|
||||
elm_genlist_item_append(glc, _grp_itc, (void *)EX_OBJ_INFO, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
|
||||
}
|
||||
while (itr1 || itr2)
|
||||
{
|
||||
Exactness_Objects *objs1 = itr1 ? eina_list_data_get(itr1) : NULL;
|
||||
_Item_Info *ii = calloc(1, sizeof(*ii));
|
||||
eina_hash_set(_item_infos_hash, &objs1, ii);
|
||||
ii->gl_item = elm_genlist_item_append(gl1, _objs_itc, objs1, NULL,
|
||||
ELM_GENLIST_ITEM_TREE, NULL, NULL);
|
||||
efl_wref_add(ii->gl_item, &(ii->gl_item));
|
||||
if (unit2)
|
||||
{
|
||||
_Compare_Item_Data *vv = calloc(1, sizeof(*vv));
|
||||
Exactness_Objects *objs2 = itr2 ? eina_list_data_get(itr2) : NULL;
|
||||
_Two_Ptrs *vv = malloc(sizeof(*vv));
|
||||
vv->p1 = objs1->objs;
|
||||
vv->p2 = objs2->objs;
|
||||
elm_genlist_item_append(gl, _comp_objs_itc, vv, NULL, ELM_GENLIST_ITEM_TREE, NULL, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
elm_genlist_item_append(gl, _objs_itc, objs1, NULL, ELM_GENLIST_ITEM_TREE, NULL, NULL);
|
||||
vv->p1 = objs1;
|
||||
vv->p2 = objs2;
|
||||
vv->dt = EX_OBJ_INFO;
|
||||
ii = calloc(1, sizeof(*ii));
|
||||
eina_hash_set(_item_infos_hash, &objs2, ii);
|
||||
ii->gl_item = elm_genlist_item_append(gl2, _objs_itc, objs2, NULL,
|
||||
ELM_GENLIST_ITEM_TREE, NULL, NULL);
|
||||
efl_wref_add(ii->gl_item, &(ii->gl_item));
|
||||
elm_genlist_item_append(glc, _objs_itc, vv, NULL, ELM_GENLIST_ITEM_TREE, NULL, NULL);
|
||||
}
|
||||
if (itr1) itr1 = eina_list_next(itr1);
|
||||
if (itr2) itr2 = eina_list_next(itr2);
|
||||
|
@ -880,6 +1151,7 @@ main(int argc, char *argv[])
|
|||
Eina_List *itr;
|
||||
Exactness_Unit *unit, *unit1 = NULL, *unit2 = NULL;
|
||||
Eina_Bool need_compare = compare_files && eina_list_count(_units) == 2;
|
||||
_item_infos_hash = eina_hash_pointer_new(NULL);
|
||||
_gui_win_create();
|
||||
EINA_LIST_FOREACH(_units, itr, unit)
|
||||
{
|
||||
|
@ -888,12 +1160,9 @@ main(int argc, char *argv[])
|
|||
if (!unit1) unit1 = unit;
|
||||
else unit2 = unit;
|
||||
}
|
||||
_gui_unit_display(unit, NULL, -1);
|
||||
}
|
||||
if (need_compare)
|
||||
{
|
||||
_gui_unit_display(unit1, unit2, 1);
|
||||
else _gui_unit_display(unit, NULL);
|
||||
}
|
||||
if (need_compare) _gui_unit_display(unit1, unit2);
|
||||
elm_run();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
unsigned int
|
||||
evt_time_get(unsigned int tm, Variant_st *v)
|
||||
{
|
||||
if (!v) return tm;
|
||||
switch(tsuite_event_mapping_type_get(v->t.type))
|
||||
{
|
||||
case TSUITE_EVENT_MOUSE_IN:
|
||||
|
|
Loading…
Reference in New Issue