Commit 02f8897c authored by Romain Bignon's avatar Romain Bignon

hours on the right

parent 107d3c55
......@@ -51,7 +51,7 @@ int create_image(struct data* data, const char *filename, struct event* events,
const int ygraph = 100;
const int hgraph = 24*6;
const int wgraph = days;
Imlib_Image image = imlib_create_image(xgraph + wgraph,
Imlib_Image image = imlib_create_image(xgraph + wgraph + xgraph,
ygraph + hgraph + 50);
imlib_context_set_image(image);
......@@ -72,11 +72,14 @@ int create_image(struct data* data, const char *filename, struct event* events,
for (i = 0; i < 24; ++i)
{
if (!(i % 2))
if ((i % 2))
{
char text[6];
snprintf(text, sizeof text, "%02d:00", i);
imlib_text_draw(5, ygraph + (i*6) - 3, text);
imlib_text_draw(5, ygraph + (i*6) - 10, text);
imlib_image_fill_rectangle(xgraph - 4, ygraph + (i*6), 3, 1);
imlib_text_draw(xgraph + wgraph + 8, ygraph + (i*6) - 10, text);
imlib_image_fill_rectangle(xgraph + wgraph + 1, ygraph + (i*6), 3, 1);
}
}
......@@ -116,6 +119,8 @@ int create_image(struct data* data, const char *filename, struct event* events,
if (events->to.tm_mday > 0)
{
to = difftime(mktime(&events->to), first)/(3600*24);
if (to > days)
to = days;
imlib_text_draw(xgraph + from + 2, ygraph - 27, events->label);
imlib_image_fill_rectangle(xgraph + from, ygraph - 7, to - from, 1);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment