Inspect: support images displaying from shot entry
A button has been added next to the shot entry. The image itself is set as the its content.
This commit is contained in:
parent
c3a31c436d
commit
ffe0659fbe
|
@ -45,6 +45,7 @@ static Elm_Genlist_Item_Class *_objs_itc = NULL, *_obj_itc = NULL;
|
|||
static Eina_Hash *_item_infos_hash = NULL;
|
||||
|
||||
static Eina_Bool _show_only_diffs = EINA_FALSE;
|
||||
static Eina_List *_comp_vvs = NULL;
|
||||
|
||||
static const char *
|
||||
_event_name_get(const Variant_st *v)
|
||||
|
@ -328,7 +329,7 @@ _are_objs_trees_different(Exactness_Objects *e_objs1, Exactness_Objects *e_objs2
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
_win_del(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
efl_exit(0); /* exit the program's main loop that runs in elm_run() */
|
||||
|
@ -439,6 +440,145 @@ _scn_text_get(void *data, Evas_Object *gl, const char *part EINA_UNUSED)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
_unit_shot_no_get(Exactness_Unit *unit, Variant_st *v_ref)
|
||||
{
|
||||
Eina_List *itr;
|
||||
Variant_st *v;
|
||||
int ret = 0;
|
||||
if (!unit) return -1;
|
||||
EINA_LIST_FOREACH(unit->events, itr, v)
|
||||
{
|
||||
if (tsuite_event_mapping_type_get(v->t.type) == TSUITE_EVENT_TAKE_SHOT)
|
||||
{
|
||||
if (v == v_ref) return ret;
|
||||
ret++;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
_goto_shot(void *data EINA_UNUSED, Evas_Object *bt, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Eo *gl = efl_key_data_get(bt, "gl");
|
||||
Eina_Bool compare = !!efl_key_data_get(gl, "_exactness_gl_compare");
|
||||
if (compare)
|
||||
{
|
||||
_Compare_Item_Data *vv;
|
||||
Eina_List *itr;
|
||||
Eo *gl1 = eina_list_nth(_gls, 0);
|
||||
Eo *gl2 = eina_list_nth(_gls, 1);
|
||||
Exactness_Unit *unit1 = efl_key_data_get(gl1, "unit");
|
||||
Exactness_Unit *unit2 = efl_key_data_get(gl2, "unit");
|
||||
int shot1_no = (intptr_t)efl_key_data_get(bt, "shot1_no");
|
||||
int shot2_no = (intptr_t)efl_key_data_get(bt, "shot2_no");
|
||||
Exactness_Image *ex_img1 = shot1_no != -1 ? eina_list_nth(unit1->imgs, shot1_no) : NULL;
|
||||
Exactness_Image *ex_img2 = shot2_no != -1 ? eina_list_nth(unit2->imgs, shot2_no) : NULL;
|
||||
EINA_LIST_FOREACH(_comp_vvs, itr, vv)
|
||||
{
|
||||
if (vv->p1 == ex_img1 && vv->p2 == ex_img2)
|
||||
{
|
||||
_Item_Info *ii = eina_hash_find(_item_infos_hash, &vv);
|
||||
if (ii && ii->gl_item)
|
||||
elm_genlist_item_show(ii->gl_item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Exactness_Unit *unit = efl_key_data_get(gl, "unit");
|
||||
int shot_no = (intptr_t)efl_key_data_get(bt, "shot_no");
|
||||
Exactness_Image *ex_img = shot_no != -1 ? eina_list_nth(unit->imgs, shot_no) : NULL;
|
||||
_Item_Info *ii = eina_hash_find(_item_infos_hash, &ex_img);
|
||||
if (ii && ii->gl_item)
|
||||
elm_genlist_item_show(ii->gl_item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
|
||||
}
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_scn_content_get(void *data, Evas_Object *gl, const char *part)
|
||||
{
|
||||
Eina_Bool compare = !!efl_key_data_get(gl, "_exactness_gl_compare");
|
||||
if (compare)
|
||||
{
|
||||
if (!strcmp(part, "elm.swallow.end"))
|
||||
{
|
||||
_Compare_Item_Data *vv = data;
|
||||
Variant_st *v1 = vv->p1;
|
||||
Variant_st *v2 = vv->p2;
|
||||
if (tsuite_event_mapping_type_get(v1->t.type) == TSUITE_EVENT_TAKE_SHOT &&
|
||||
tsuite_event_mapping_type_get(v2->t.type) == TSUITE_EVENT_TAKE_SHOT)
|
||||
{
|
||||
Eo *gl1 = eina_list_nth(_gls, 0);
|
||||
Eo *gl2 = eina_list_nth(_gls, 1);
|
||||
Exactness_Unit *unit1 = efl_key_data_get(gl1, "unit");
|
||||
Exactness_Unit *unit2 = efl_key_data_get(gl2, "unit");
|
||||
int shot1_no = _unit_shot_no_get(unit1, v1);
|
||||
int shot2_no = _unit_shot_no_get(unit2, v2);
|
||||
Exactness_Image *ex_img1 = shot1_no != -1 ? eina_list_nth(unit1->imgs, shot1_no) : NULL;
|
||||
Exactness_Image *ex_img2 = shot2_no != -1 ? eina_list_nth(unit2->imgs, shot2_no) : NULL;
|
||||
Exactness_Image *ex_imgO = _pixels_compare(ex_img1, ex_img2, NULL);
|
||||
|
||||
if (ex_imgO)
|
||||
{
|
||||
Eo *bt, *ic, *evas_img;
|
||||
|
||||
bt = elm_button_add(gl);
|
||||
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_show(bt);
|
||||
efl_key_data_set(bt, "gl", gl);
|
||||
efl_key_data_set(bt, "shot1_no", (void *)(intptr_t)shot1_no);
|
||||
efl_key_data_set(bt, "shot2_no", (void *)(intptr_t)shot2_no);
|
||||
evas_object_smart_callback_add(bt, "clicked", _goto_shot, NULL);
|
||||
|
||||
ic = elm_icon_add(bt);
|
||||
evas_img = elm_image_object_get(ic);
|
||||
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_show(ic);
|
||||
elm_object_part_content_set(bt, "icon", ic);
|
||||
return bt;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!strcmp(part, "elm.swallow.end"))
|
||||
{
|
||||
Variant_st *v = data;
|
||||
Exactness_Unit *unit = efl_key_data_get(gl, "unit");
|
||||
int shot_no = _unit_shot_no_get(unit, v);
|
||||
Exactness_Image *ex_img = shot_no != -1 ? eina_list_nth(unit->imgs, shot_no) : NULL;
|
||||
|
||||
if (ex_img)
|
||||
{
|
||||
Eo *bt, *ic, *evas_img;
|
||||
|
||||
bt = elm_button_add(gl);
|
||||
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_show(bt);
|
||||
efl_key_data_set(bt, "gl", gl);
|
||||
efl_key_data_set(bt, "shot_no", (void *)(intptr_t)shot_no);
|
||||
evas_object_smart_callback_add(bt, "clicked", _goto_shot, NULL);
|
||||
|
||||
ic = elm_icon_add(bt);
|
||||
evas_img = elm_image_object_get(ic);
|
||||
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_show(ic);
|
||||
elm_object_part_content_set(bt, "icon", ic);
|
||||
|
||||
return bt;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_img_content_get(void *data, Evas_Object *gl, const char *part)
|
||||
{
|
||||
|
@ -555,6 +695,7 @@ _itc_init()
|
|||
_scn_itc = elm_genlist_item_class_new();
|
||||
_scn_itc->item_style = "default_style";
|
||||
_scn_itc->func.text_get = _scn_text_get;
|
||||
_scn_itc->func.content_get = _scn_content_get;
|
||||
}
|
||||
|
||||
if (!_img_itc)
|
||||
|
@ -806,6 +947,7 @@ _gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2)
|
|||
_gls = eina_list_append(_gls, gl1);
|
||||
elm_box_pack_end(_main_box, gl1);
|
||||
|
||||
efl_key_data_set(gl1, "unit", unit1);
|
||||
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);
|
||||
|
@ -838,6 +980,7 @@ _gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2)
|
|||
_gls = eina_list_append(_gls, gl2);
|
||||
elm_box_pack_end(_main_box, gl2);
|
||||
|
||||
efl_key_data_set(gl2, "unit", unit2);
|
||||
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);
|
||||
|
@ -908,7 +1051,11 @@ _gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2)
|
|||
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);
|
||||
/* This item info is needed to go to images from scenario shot entry */
|
||||
ii = calloc(1, sizeof(*ii));
|
||||
eina_hash_set(_item_infos_hash, &vv, ii);
|
||||
ii->gl_item = elm_genlist_item_append(glc, _img_itc, vv, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
||||
_comp_vvs = eina_list_append(_comp_vvs, vv);
|
||||
}
|
||||
}
|
||||
if (itr1) itr1 = eina_list_next(itr1);
|
||||
|
|
Loading…
Reference in New Issue