|
|
|
#ifndef EFL_BETA_API_SUPPORT
|
|
|
|
#define EFL_BETA_API_SUPPORT
|
|
|
|
#endif
|
|
|
|
#ifndef EFL_EO_API_SUPPORT
|
|
|
|
#define EFL_EO_API_SUPPORT
|
|
|
|
#endif
|
|
|
|
#include <Ecore.h>
|
|
|
|
#include <Ecore_Getopt.h>
|
|
|
|
#include <Ecore_Evas.h>
|
|
|
|
#include <Elementary.h>
|
|
|
|
#include <Exactness.h>
|
|
|
|
|
|
|
|
#include "exactness_private.h"
|
|
|
|
#define LDIFF(x) "<b><color=#F0F>"#x"</color></b>"
|
|
|
|
#define RDIFF(x) "<b><color=#0FF>"#x"</color></b>"
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
EX_SCENARIO,
|
|
|
|
EX_IMAGE,
|
|
|
|
EX_OBJ_INFO
|
|
|
|
} _Data_Type;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
void *p1;
|
|
|
|
void *p2;
|
|
|
|
_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 *_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 *
|
|
|
|
_action_name_get(Exactness_Action *act)
|
|
|
|
{
|
|
|
|
if (!act) return NULL;
|
|
|
|
switch(act->type)
|
|
|
|
{
|
|
|
|
case EXACTNESS_ACTION_MOUSE_IN: return "Mouse In";
|
|
|
|
case EXACTNESS_ACTION_MOUSE_OUT: return "Mouse Out";
|
|
|
|
case EXACTNESS_ACTION_MOUSE_WHEEL: return "Mouse Wheel";
|
|
|
|
case EXACTNESS_ACTION_MULTI_DOWN: return "Multi Down";
|
|
|
|
case EXACTNESS_ACTION_MULTI_UP: return "Multi Up";
|
|
|
|
case EXACTNESS_ACTION_MULTI_MOVE: return "Multi Move";
|
|
|
|
case EXACTNESS_ACTION_KEY_DOWN: return "Key Down";
|
|
|
|
case EXACTNESS_ACTION_KEY_UP: return "Key Up";
|
|
|
|
case EXACTNESS_ACTION_TAKE_SHOT: return "Take shot";
|
|
|
|
default: return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_event_struct_len_get(Exactness_Action_Type type)
|
|
|
|
{
|
|
|
|
switch(type)
|
|
|
|
{
|
|
|
|
case EXACTNESS_ACTION_MOUSE_WHEEL:
|
|
|
|
return sizeof(Exactness_Action_Mouse_Wheel);
|
|
|
|
case EXACTNESS_ACTION_MULTI_DOWN:
|
|
|
|
case EXACTNESS_ACTION_MULTI_UP:
|
|
|
|
return sizeof(Exactness_Action_Multi_Event);
|
|
|
|
case EXACTNESS_ACTION_MULTI_MOVE:
|
|
|
|
return sizeof(Exactness_Action_Multi_Move);
|
|
|
|
case EXACTNESS_ACTION_KEY_DOWN:
|
|
|
|
case EXACTNESS_ACTION_KEY_UP:
|
|
|
|
return sizeof(Exactness_Action_Key_Down_Up);
|
|
|
|
default: return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_action_specific_info_get(const Exactness_Action *act, char output[1024])
|
|
|
|
{
|
|
|
|
switch(act->type)
|
|
|
|
{
|
|
|
|
case EXACTNESS_ACTION_MOUSE_WHEEL:
|
|
|
|
{
|
|
|
|
Exactness_Action_Mouse_Wheel *t = act->data;
|
|
|
|
sprintf(output, "Direction %d Z %d", t->direction, t->z);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EXACTNESS_ACTION_MULTI_UP: case EXACTNESS_ACTION_MULTI_DOWN:
|
|
|
|
{
|
|
|
|
Exactness_Action_Multi_Event *t = act->data;
|
|
|
|
if (!t->d)
|
|
|
|
sprintf(output, "Button %d Flags %d", t->b, t->flags);
|
|
|
|
else
|
|
|
|
sprintf(output, "D %d X %d Y %d Rad %f RadX %f RadY %f Pres %f Ang %f FX %f FY %f Flags %d",
|
|
|
|
t->d, t->x, t->y, t->rad, t->radx, t->rady, t->pres, t->ang, t->fx, t->fy, t->flags);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EXACTNESS_ACTION_MULTI_MOVE:
|
|
|
|
{
|
|
|
|
Exactness_Action_Multi_Move *t = act->data;
|
|
|
|
if (!t->d)
|
|
|
|
sprintf(output, "X %d Y %d", t->x, t->y);
|
|
|
|
else
|
|
|
|
sprintf(output, "D %d X %d Y %d Rad %f RadX %f RadY %f Pres %f Ang %f FX %f FY %f",
|
|
|
|
t->d, t->x, t->y, t->rad, t->radx, t->rady, t->pres, t->ang, t->fx, t->fy);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EXACTNESS_ACTION_KEY_UP: case EXACTNESS_ACTION_KEY_DOWN:
|
|
|
|
{
|
|
|
|
Exactness_Action_Key_Down_Up *t = act->data;
|
|
|
|
sprintf(output, "Keyname %s Key %s String %s Compose %s Keycode %d",
|
|
|
|
t->keyname, t->key, t->string, t->compose, t->keycode);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
output[0] = '\0';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_is_hook_duplicate(const Exactness_Action *cur_act, const Exactness_Action *prev_act)
|
|
|
|
{
|
|
|
|
if (!prev_act) return EINA_FALSE;
|
|
|
|
if (cur_act->type == prev_act->type)
|
|
|
|
{
|
|
|
|
int len = _event_struct_len_get(cur_act->type);
|
|
|
|
return (!len || !memcmp(cur_act->data, prev_act->data, len));
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_are_scenario_entries_different(Exactness_Action *act1, Exactness_Action *act2)
|
|
|
|
{
|
|
|
|
if (!act1 ^ !act2) return EINA_TRUE;
|
|
|
|
if (act1->type != act2->type) return EINA_TRUE;
|
|
|
|
switch(act1->type)
|
|
|
|
{
|
|
|
|
case EXACTNESS_ACTION_MOUSE_WHEEL:
|
|
|
|
return !!memcmp(act1->data, act2->data, sizeof(Exactness_Action_Mouse_Wheel));
|
|
|
|
case EXACTNESS_ACTION_MULTI_DOWN: case EXACTNESS_ACTION_MULTI_UP:
|
|
|
|
return !!memcmp(act1->data, act2->data, sizeof(Exactness_Action_Multi_Event));
|
|
|
|
case EXACTNESS_ACTION_MULTI_MOVE:
|
|
|
|
return !!memcmp(act1->data, act2->data, sizeof(Exactness_Action_Multi_Move));
|
|
|
|
case EXACTNESS_ACTION_KEY_UP: case EXACTNESS_ACTION_KEY_DOWN:
|
|
|
|
return !!memcmp(act1->data, act2->data, sizeof(Exactness_Action_Key_Down_Up));
|
|
|
|
default:
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_are_images_different(Exactness_Image *e_img1, Exactness_Image *e_img2)
|
|
|
|
{
|
|
|
|
unsigned int w, h;
|
|
|
|
int *pxs1 = NULL;
|
|
|
|
int *pxs2 = NULL;
|
|
|
|
if (!e_img1 ^ !e_img2) return EINA_TRUE;
|
|
|
|
if (e_img1->w != e_img2->w) return EINA_TRUE;
|
|
|
|
if (e_img1->h != e_img2->h) return EINA_TRUE;
|
|
|
|
pxs1 = e_img1->pixels;
|
|
|
|
pxs2 = e_img2->pixels;
|
|
|
|
for (w = 0; w < e_img1->w; w++)
|
|
|
|
{
|
|
|
|
for (h = 0; h < e_img1->h; h++)
|
|
|
|
{
|
|
|
|
if (pxs1[h * e_img1->w + w] != pxs2[h * e_img1->w + w])
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Exactness_Image *
|
|
|
|
_pixels_compare(Exactness_Image *img1, Exactness_Image *img2, Eina_Bool *has_diff)
|
|
|
|
{
|
|
|
|
Exactness_Image *imgO = malloc(sizeof(*imgO));
|
|
|
|
unsigned int w, h;
|
|
|
|
int *pxs1, *pxs2, *pxsO;
|
|
|
|
unsigned int w1 = img1 ? img1->w : 0, h1 = img1 ? img1->h : 0;
|
|
|
|
unsigned int w2 = img2 ? img2->w : 0, h2 = img2 ? img2->h : 0;
|
|
|
|
imgO->w = MAX(w1, w2);
|
|
|
|
imgO->h = MAX(h1, h2);
|
|
|
|
if (has_diff) *has_diff = EINA_FALSE;
|
|
|
|
if (!imgO->w || !imgO->h)
|
|
|
|
{
|
|
|
|
free(imgO);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
imgO->pixels = malloc(imgO->w * imgO->h * 4);
|
|
|
|
|
|
|
|
pxs1 = img1 ? img1->pixels : NULL;
|
|
|
|
pxs2 = img2 ? img2->pixels : NULL;
|
|
|
|
pxsO = imgO->pixels;
|
|
|
|
|
|
|
|
for (w = 0; w < imgO->w; w++)
|
|
|
|
{
|
|
|
|
for (h = 0; h < imgO->h; h++)
|
|
|
|
{
|
|
|
|
Eina_Bool valid1 = w <= w1 && h <= h1;
|
|
|
|
Eina_Bool valid2 = w <= w2 && h <= h2;
|
|
|
|
int px1 = valid1 ? pxs1[h * w1 + w] : 0;
|
|
|
|
int px2 = valid2 ? pxs2[h * w2 + w] : 0;
|
|
|
|
int r1 = (px1 & 0x00FF0000) >> 16;
|
|
|
|
int r2 = (px2 & 0x00FF0000) >> 16;
|
|
|
|
int g1 = (px1 & 0x0000FF00) >> 8;
|
|
|
|
int g2 = (px2 & 0x0000FF00) >> 8;
|
|
|
|
int b1 = (px1 & 0x000000FF);
|
|
|
|
int b2 = (px2 & 0x000000FF);
|
|
|
|
int new_r, new_g, new_b;
|
|
|
|
if (valid1 || valid2)
|
|
|
|
{
|
|
|
|
if (px1 != px2)
|
|
|
|
{
|
|
|
|
new_r = 0xFF;
|
|
|
|
new_g = ((g1 + g2) >> 1) >> 2;
|
|
|
|
new_b = ((b1 + b2) >> 1) >> 2;
|
|
|
|
if (has_diff) *has_diff = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
new_r = (((r1 + r2) >> 1) >> 2) + 0xC0;
|
|
|
|
new_g = (((g1 + g2) >> 1) >> 2) + 0xC0;
|
|
|
|
new_b = (((b1 + b2) >> 1) >> 2) + 0xC0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
new_r = new_g = new_b = 0x0;
|
|
|
|
}
|
|
|
|
pxsO[h * imgO->w + w] = 0xFF000000 | new_r << 16 | new_g << 8 | new_b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_are_objs_trees_different(Exactness_Objects *e_objs1, Exactness_Objects *e_objs2)
|
|
|
|
{
|
|
|
|
if (!e_objs1 ^ !e_objs2) return EINA_TRUE;
|
|
|
|
Eina_List *itr1 = e_objs1->objs;
|
|
|
|
Eina_List *itr2 = e_objs2->objs;
|
|
|
|
Exactness_Object *e_obj1, *e_obj2;
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
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() */
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gui_win_create()
|
|
|
|
{
|
|
|
|
Eo *win, *bg;
|
|
|
|
|
|
|
|
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
|
|
|
win = elm_win_add(NULL, "Window", ELM_WIN_BASIC);
|
|
|
|
evas_object_smart_callback_add(win, "delete,request", _win_del, NULL);
|
|
|
|
elm_win_maximized_set(win, EINA_TRUE);
|
|
|
|
elm_win_autodel_set(win, EINA_TRUE);
|
|
|
|
elm_win_title_set(win, "Exactness Inspector");
|
|
|
|
efl_gfx_entity_size_set(win, EINA_SIZE2D(1000, 800));
|
|
|
|
|
|
|
|
bg = elm_bg_add(win);
|
|
|
|
evas_object_size_hint_weight_set(bg, 1.000000, 1.000000);
|
|
|
|
efl_gfx_entity_visible_set(bg, EINA_TRUE);
|
|
|
|
elm_win_resize_object_add(win, bg);
|
|
|
|
|
|
|
|
_main_box = elm_box_add(win);
|
|
|
|
elm_box_horizontal_set(_main_box, EINA_TRUE);
|
|
|
|
elm_box_homogeneous_set(_main_box, EINA_TRUE);
|
|
|
|
evas_object_size_hint_weight_set(_main_box, 1.000000, 1.000000);
|
|
|
|
efl_gfx_entity_visible_set(_main_box, EINA_TRUE);
|
|
|
|
elm_win_resize_object_add(win, _main_box);
|
|
|
|
|
|
|
|
efl_gfx_entity_visible_set(win, EINA_TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
_grp_text_get(void *data, Evas_Object *gl, const char *part EINA_UNUSED)
|
|
|
|
{
|
|
|
|
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 *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_Action *a1 = vv->p1;
|
|
|
|
Exactness_Action *a2 = vv->p2;
|
|
|
|
|
|
|
|
if (!a1 ^ !a2) return strdup("XXXXX");
|
|
|
|
|
|
|
|
if (a1->timestamp != a2->timestamp) eina_strbuf_append_printf(buf, "["LDIFF(%.3f)"/"RDIFF(%.3f)"]: ", a1->timestamp/1000.0, a2->timestamp/1000.0);
|
|
|
|
else eina_strbuf_append_printf(buf, "%.3f: ", a1->timestamp / 1000.0);
|
|
|
|
|
|
|
|
if (a1->type != a2->type)
|
|
|
|
eina_strbuf_append_printf(buf, "["LDIFF(%s)"/"RDIFF(%s)"] - XXXXXX", _action_name_get(a1), _action_name_get(a2));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char params1[1024];
|
|
|
|
char params2[2024];
|
|
|
|
_action_specific_info_get(a1, params1);
|
|
|
|
_action_specific_info_get(a2, params2);
|
|
|
|
|
|
|
|
eina_strbuf_append_printf(buf, "%s", _action_name_get(a1));
|
|
|
|
if (*params1 || *params2)
|
|
|
|
{
|
|
|
|
if (strcmp(params1, params2))
|
|
|
|
eina_strbuf_append_printf(buf, " - ["LDIFF(%s)"/"RDIFF(%s)"]", params1, params2);
|
|
|
|
else
|
|
|
|
eina_strbuf_append_printf(buf, " - %s", params1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Exactness_Action *act = data;
|
|
|
|
char specific_output[1024];
|
|
|
|
if (act)
|
|
|
|
{
|
|
|
|
eina_strbuf_append_printf(buf, "%.3f: ", act->timestamp / 1000.0);
|
|
|
|
eina_strbuf_append_printf(buf, "%s", _action_name_get(act));
|
|
|
|
_action_specific_info_get(act, 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);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_unit_shot_no_get(Exactness_Unit *unit, Exactness_Action *act_ref)
|
|
|
|
{
|
|
|
|
Eina_List *itr;
|
|
|
|
Exactness_Action *act;
|
|
|
|
int ret = 0;
|
|
|
|
if (!unit) return -1;
|
|
|
|
EINA_LIST_FOREACH(unit->actions, itr, act)
|
|
|
|
{
|
|
|
|
if (act->type == EXACTNESS_ACTION_TAKE_SHOT)
|
|
|
|
{
|
|
|
|
if (act == act_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;
|
|
|
|
Exactness_Action *v1 = vv->p1;
|
|
|
|
Exactness_Action *v2 = vv->p2;
|
|
|
|
if (v1 && v2 && v1->type == EXACTNESS_ACTION_TAKE_SHOT &&
|
|
|
|
v2->type == EXACTNESS_ACTION_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"))
|
|
|
|
{
|
|
|
|
Exactness_Action *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)
|
|
|
|
{
|
|
|
|
if (strcmp(part, "elm.swallow.content")) return NULL;
|
|
|
|
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 char *
|
|
|
|
_objs_text_get(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
|
|
|
|
{
|
|
|
|
return strdup("Shot");
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
_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, "("LDIFF(%s)"/"RDIFF(%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, LDIFF(%d)"/"RDIFF(%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, LDIFF(%d)"/"RDIFF(%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, LDIFF(%d)"/"RDIFF(%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, LDIFF(%d)"/"RDIFF(%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;
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = eina_strbuf_string_steal(buf);
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_itc_init()
|
|
|
|
{
|
|
|
|
if (!_grp_itc)
|
|
|
|
{
|
|
|
|
_grp_itc = elm_genlist_item_class_new();
|
|
|
|
_grp_itc->item_style = "group_index";
|
|
|
|
_grp_itc->func.text_get = _grp_text_get;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_scn_itc)
|
|
|
|
{
|
|
|
|
_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)
|
|
|
|
{
|
|
|
|
_img_itc = elm_genlist_item_class_new();
|
|
|
|
_img_itc->item_style = "full";
|
|
|
|
_img_itc->func.content_get = _img_content_get;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_objs_itc)
|
|
|
|
{
|
|
|
|
_objs_itc = elm_genlist_item_class_new();
|
|
|
|
_objs_itc->item_style = "default_style";
|
|
|
|
_objs_itc->func.text_get = _objs_text_get;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_obj_itc)
|
|
|
|
{
|
|
|
|
_obj_itc = elm_genlist_item_class_new();
|
|
|
|
_obj_itc->item_style = "default_style";
|
|
|
|
_obj_itc->func.text_get = _obj_text_get;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_comp_gl_dragged_cb(Evas_Object *obj, void *data EINA_UNUSED)
|
|
|
|
{
|
|
|
|
int x = 0, y = 0;
|
|
|
|
Eo *gl;
|
|
|
|
Eina_List *itr;
|
|
|
|
elm_interface_scrollable_content_pos_get(obj, &x, &y);
|
|
|
|
EINA_LIST_FOREACH(_gls, itr, gl)
|
|
|
|
{
|
|
|
|
if (gl != obj)
|
|
|
|
elm_interface_scrollable_content_pos_set(gl, x, y, EINA_FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_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 *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 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)
|
|
|
|
{
|
|
|
|
_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);
|
|
|
|