evlog - display general events nicely now

This commit is contained in:
Carsten Haitzler 2016-11-10 12:00:31 +09:00
parent 94e30e87c5
commit 4074c7952a
2 changed files with 84 additions and 0 deletions

54
evlog.c
View File

@ -1142,6 +1142,53 @@ _add_log_frame_object(Evas_Object *win, Evas_Object *grid, Event *ev)
return o;
}
static Evas_Object *
_add_log_event_event_object(Evas_Object *win, Evas_Object *grid, Event *ev)
{
Evas_Object *o, *oe;
int col[4] = {255, 255, 255, 255}, i, max;
char *s;
char buf[512];
o = elm_layout_add(win);
oe = elm_layout_edje_get(o);
elm_layout_file_set(o, "./evlog.edj", "event");
i = 0;
max = 0;
for (s = ev->event; *s; s++)
{
col[i % 3] ^= *s;
if (col[i % 3] > max) max = col[i % 3];
i++;
}
if (max > 0)
{
for (i = 0; i < 3; i++)
{
col[i] = (col[i] * 255) / max;
}
}
edje_object_color_class_set(oe, "event",
(3 * col[0]) / 4, (3 * col[1]) / 4, (3 * col[2]) / 4, (3 * col[3]) / 4,
255, 255, 255, 255,
255, 255, 255, 255);
if (ev->detail)
{
snprintf(buf, sizeof(buf), "%s (%s)", ev->event, ev->detail);
edje_object_part_text_set(oe, "text", buf);
}
else
edje_object_part_text_set(oe, "text", ev->event);
elm_grid_pack(grid, o, ev->t0 * RES, ev->n, 0, 1);
if (ev->detail)
snprintf(buf, sizeof(buf), "%s (%s) - %1.5fms", ev->event, ev->detail, ev->t0 * 1000.0);
else
snprintf(buf, sizeof(buf), "%s - %1.5fms", ev->event, ev->t0 * 1000.0);
elm_object_tooltip_text_set(o, buf);
evas_object_show(o);
return o;
}
static Evas_Object *
_add_log_cpufreq_object(Evas_Object *win, Evas_Object *grid, Event *ev, int mhzmax)
{
@ -1223,6 +1270,13 @@ _cb_fill_end(void *data, Ecore_Thread *thread)
ev);
ev->obj = o;
}
else
{
o = _add_log_event_event_object(inf->win,
inf->grid.over,
ev);
ev->obj = o;
}
}
else if (ev->slot == -2) // cpufreq
{

View File

@ -105,4 +105,34 @@ collections {
}
}
}
group { name: "event";
parts {
part { name: "base"; type: RECT; mouse_events: 0;
description { state: "default" 0.0;
color_class: "event";
min: 1 1;
}
}
part { name: "over"; type: RECT;
description { state: "default" 0.0;
color: 0 0 0 0;
min: 5 1;
}
}
part { name: "text"; type: TEXT;
scale: 1;
description { state: "default" 0.0;
rel1.relative: 0.0 1.0;
rel2.relative: 1.0 1.0;
align: 0.5 0.0;
color_class: "event";
text { font: "Sans"; size: 10;
min: 1 1;
align: 0.5 0.0;
}
}
}
}
}
}