clouseau: Fixed highlight handling Added delete fade-timer on close window Added lines asociated with each bmp

Signed-off-by: Aharon Hillel <a.hillel@samsung.com>

SVN revision: 72354
This commit is contained in:
Aharon Hillel 2012-06-18 07:23:12 +00:00 committed by Tom Hacohen
parent 16edf65bca
commit dddca2b897
4 changed files with 59 additions and 24 deletions

View File

@ -254,10 +254,7 @@ _close_app_views(app_info_st *app, Eina_Bool clr)
{ /* These are cleared when app data is reloaded */
EINA_LIST_FREE(app->view, view)
{ /* Free memory allocated to show any app screens */
bmp_info_st *b = view->data;
if (b->bmp)
free(b->bmp);
bmp_blob_free(view->data);
variant_free(view);
}
@ -632,7 +629,7 @@ _app_win_del(void *data,
evas_object_event_callback_del(st->o, EVAS_CALLBACK_MOUSE_OUT,
_mouse_out);
evas_object_event_callback_del(st->o, EVAS_CALLBACK_MOUSE_DOWN,
libclouseau_make_line);
libclouseau_make_lines);
st->win = st->bt = st->lb_mouse = st->o = NULL;
}
@ -717,7 +714,7 @@ _open_app_window(bmp_info_st *st, Evas_Object *bt, Tree_Item *treeit)
_mouse_out, st);
evas_object_event_callback_add(st->o, EVAS_CALLBACK_MOUSE_DOWN,
libclouseau_make_line, st);
libclouseau_make_lines, st);
evas_object_resize(scr, st->w, st->h);
elm_win_resize_object_add(st->win, bx);

View File

@ -1,6 +1,27 @@
#include "eet_data.h"
static data_desc *desc = NULL;
void
lines_free(bmp_info_st *st)
{ /* Free lines asociated with a bmp */
if (st->lx)
evas_object_del(st->lx);
if (st->ly)
evas_object_del(st->ly);
st->lx = st->ly = NULL;
}
void
bmp_blob_free(bmp_info_st *st)
{ /* We also free all lines drawn in this bmp canvas */
lines_free(st);
if (st->bmp)
free(st->bmp);
}
void
item_tree_item_free(Tree_Item *parent)
{
@ -676,6 +697,15 @@ _verify_e_obj(Evas_Object *obj)
return rt;
}
static void
libclouseau_highlight_del(void *data,
EINA_UNUSED Evas *e,
EINA_UNUSED Evas_Object *obj,
EINA_UNUSED void *event_info)
{ /* Delete timer for this rect */
ecore_timer_del(data);
}
void
libclouseau_highlight(Evas_Object *obj, st_evas_props *props, bmp_info_st *view)
{
@ -717,39 +747,42 @@ libclouseau_highlight(Evas_Object *obj, st_evas_props *props, bmp_info_st *view)
evas_object_color_set(r, HIGHLIGHT_R, HIGHLIGHT_G, HIGHLIGHT_B,
HIGHLIGHT_A);
evas_object_show(r);
ecore_timer_add(0.1, libclouseau_highlight_fade, r);
/* Add Timer for fade and a callback to delete timer on obj del */
evas_object_event_callback_add(r, EVAS_CALLBACK_DEL,
libclouseau_highlight_del,
ecore_timer_add(0.1, libclouseau_highlight_fade, r));
/* Print backtrace info, saved for future ref
tmp = evas_object_data_get(obj, ".clouseau.bt");
fprintf(stderr, "Creation backtrace :\n%s*******\n", tmp); */
}
void
libclouseau_make_line(void *data,
libclouseau_make_lines(void *data,
Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info)
{
{ /* and no, we are NOT talking about WHITE lines */
if (((Evas_Event_Mouse_Down *) event_info)->button == 1)
return; /* make line only if not left mouse button */
bmp_info_st *st = data;
Evas_Coord xx, yy, x_bmp, y_bmp, w_bmp, h_bmp;
lines_free(st);
evas_object_geometry_get(st->o, &x_bmp, &y_bmp, &w_bmp, &h_bmp);
xx = (((Evas_Event_Mouse_Move *) event_info)->cur.canvas.x);
yy = (((Evas_Event_Mouse_Move *) event_info)->cur.canvas.y);
Evas_Object *lx = evas_object_line_add(evas_object_evas_get(st->o));
evas_object_line_xy_set(lx, 0, yy, w_bmp, yy);
Evas_Object *ly = evas_object_line_add(evas_object_evas_get(st->o));
evas_object_line_xy_set(ly, xx, 0, xx, h_bmp);
st->lx = evas_object_line_add(evas_object_evas_get(st->o));
st->ly = evas_object_line_add(evas_object_evas_get(st->o));
evas_object_color_set(lx, HIGHLIGHT_R, HIGHLIGHT_G, HIGHLIGHT_B,
HIGHLIGHT_A);
evas_object_color_set(ly, HIGHLIGHT_R, HIGHLIGHT_G, HIGHLIGHT_B,
HIGHLIGHT_A);
evas_object_show(lx);
evas_object_show(ly);
evas_object_line_xy_set(st->lx, 0, yy, w_bmp, yy);
evas_object_line_xy_set(st->ly, xx, 0, xx, h_bmp);
ecore_timer_add(0.1, libclouseau_highlight_fade, lx);
ecore_timer_add(0.1, libclouseau_highlight_fade, ly);
evas_object_color_set(st->lx, HIGHLIGHT_R, HIGHLIGHT_G, HIGHLIGHT_B,
HIGHLIGHT_A);
evas_object_color_set(st->ly, HIGHLIGHT_R, HIGHLIGHT_G, HIGHLIGHT_B,
HIGHLIGHT_A);
evas_object_show(st->lx);
evas_object_show(st->ly);
}

View File

@ -131,6 +131,8 @@ struct _bmp_info_st
Evas_Object *lb_mouse; /* Label contains mouse cords */
Evas_Object *lb_argb; /* Current mouse pos argb val */
Evas_Object *bt; /* Button opening win */
Evas_Object *lx; /* Line on X axis */
Evas_Object *ly; /* Line on Y axis */
void *bmp; /* Bitmap BLOB, size (w * h * sizeof(int)) */
};
typedef struct _bmp_info_st bmp_info_st;
@ -168,6 +170,9 @@ struct _data_desc
typedef struct _data_desc data_desc;
/* Function Declarations */
void lines_free(bmp_info_st *st);
void bmp_blob_free(bmp_info_st *st);
Eet_Data_Descriptor *connect_desc_make(void);
Eet_Data_Descriptor *app_add_desc_make(void);
Eet_Data_Descriptor *data_req_desc_make(void);
@ -198,5 +203,5 @@ Eina_Bool eet_info_read(const char *filename, app_info_st **app, tree_data_st **
/* Highlight code, we may choose to move this to other file later */
void libclouseau_highlight(Evas_Object *obj, st_evas_props *props, bmp_info_st *view);
void libclouseau_make_line(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
void libclouseau_make_lines(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info);
#endif /* EET_DATA_H */

View File

@ -218,7 +218,7 @@ _data(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_Ipc_Event_Server_Data
bmp_info_st t = { req->gui,
req->app, req->object , req->ctr, w, h,
NULL, NULL, NULL, NULL, NULL, NULL };
NULL,NULL, NULL, NULL, NULL, NULL, NULL, NULL };
void *p = packet_compose(BMP_DATA, &t, sizeof(t), &size,
bmp, (w * h * sizeof(int)));