clouseau: Added highlight on bmp window

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

SVN revision: 72342
This commit is contained in:
Aharon Hillel 2012-06-18 07:22:36 +00:00 committed by Tom Hacohen
parent 8cdb2636d9
commit e7f43b2bea
5 changed files with 98 additions and 66 deletions

View File

@ -524,7 +524,8 @@ _get_bmp_node(bmp_info_st *st, app_info_st *app)
if (!app)
return NULL;
do{ /* First find according to Evas ptr, then match ctr with refresh_ctr */
do
{ /* First find according to Evas ptr, then match ctr with refresh_ctr */
req_list = eina_list_search_unsorted_list(req_list, _bmp_node_cmp,
(void *) (uintptr_t) st->object);
@ -539,7 +540,8 @@ _get_bmp_node(bmp_info_st *st, app_info_st *app)
/* ctr did not match, look further in list */
req_list = eina_list_next(req_list);
}
}while(req_list);
}
while(req_list);
return NULL;
}
@ -942,7 +944,9 @@ _gl_selected(void *data EINA_UNUSED, Evas_Object *pobj EINA_UNUSED,
clouseau_obj_information_list_clear();
gui_elements *g = data;
Tree_Item *treeit = elm_object_item_data_get(event_info);
if (!elm_genlist_item_parent_get(event_info))
const Elm_Object_Item *parent;
const Elm_Object_Item *prt = elm_genlist_item_parent_get(event_info);
if (!prt)
return;
/* START - replacing libclouseau_highlight(obj); */
@ -962,6 +966,25 @@ _gl_selected(void *data EINA_UNUSED, Evas_Object *pobj EINA_UNUSED,
free(p);
}
}
/* We also like to HIGHLIGHT on any app views that open (for offline) */
do
{
parent = prt;
prt = elm_genlist_item_parent_get(prt);
}
while (prt);
Tree_Item *t = elm_object_item_data_get(parent);
Variant_st *v = eina_list_search_unsorted(app->view,
_bmp_object_ptr_cmp, t->ptr);
if (v)
{
bmp_info_st *view = v->data;
libclouseau_highlight(treeit->ptr, evas_object_evas_get(view->win),
&treeit->info->evas_props);
}
/* END - replacing libclouseau_highlight(obj); */
clouseau_obj_information_list_populate(treeit, gui->lb);

View File

@ -530,3 +530,58 @@ Eina_Bool eet_info_read(const char *filename,
return EINA_FALSE;
}
/* HIGHLIGHT code. */
static Eina_Bool
libclouseau_highlight_fade(void *_rect)
{
Evas_Object *rect = _rect;
int r, g, b, a;
double na;
evas_object_color_get(rect, &r, &g, &b, &a);
if (a < 20)
{
evas_object_del(rect);
return EINA_FALSE;
}
na = a - 20;
r = na / a * r;
g = na / a * g;
b = na / a * b;
evas_object_color_set(rect, r, g, b, na);
return EINA_TRUE;
}
void
libclouseau_highlight(Evas_Object *obj, Evas *e, st_evas_props *props)
{
Evas_Object *r;
int x, y, wd, ht;
if (!e) return;
if (props)
{ /* When working offline grab info from struct */
x = props->x;
y = props->y;
wd = props->w;
ht = props->h;
}
else
evas_object_geometry_get(obj, &x, &y, &wd, &ht);
r = evas_object_rectangle_add(e);
evas_object_move(r, x - PADDING, y - PADDING);
evas_object_resize(r, wd + (2 * PADDING), ht + (2 * PADDING));
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);
/* Print backtrace info, saved for future ref
tmp = evas_object_data_get(obj, ".clouseau.bt");
fprintf(stderr, "Creation backtrace :\n%s*******\n", tmp); */
}

View File

@ -182,4 +182,7 @@ void *packet_compose(message_type t, void *data, int data_size, int *size, void
Variant_st *packet_info_get(void *data, int size);
Eina_Bool eet_info_save(const char *filename, app_info_st *app, tree_data_st *ftd);
Eina_Bool eet_info_read(const char *filename, app_info_st **app, tree_data_st **ftd);
/* Highlight code, we may choose to move this to other file later */
void libclouseau_highlight(Evas_Object *obj, Evas *e, st_evas_props *props);
#endif /* EET_DATA_H */

View File

@ -13,8 +13,6 @@
static Eina_Bool _elm_is_init = EINA_FALSE;
static const char *_my_app_name = NULL;
static void libclouseau_highlight(Evas_Object *obj);
static void
libclouseau_item_add(Evas_Object *o, Tree_Item *parent)
{
@ -204,7 +202,8 @@ _data(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_Ipc_Event_Server_Data
case HIGHLIGHT:
{ /* Highlight msg contains PTR of object to highlight */
highlight_st *ht = v->data;
libclouseau_highlight((Evas_Object *) (uintptr_t) ht->object);
Evas_Object *obj = (Evas_Object *) (uintptr_t) ht->object;
libclouseau_highlight(obj, evas_object_evas_get(obj), NULL);
}
break;
@ -369,63 +368,3 @@ evas_object_free(Evas_Object *obj, int clean_layer)
_evas_object_free(obj, clean_layer);
}
/* HIGHLIGHT code. */
/* The color of the highlight */
enum {
HIGHLIGHT_R = 255,
HIGHLIGHT_G = 128,
HIGHLIGHT_B = 128,
HIGHLIGHT_A = 255,
/* How much padding around the highlight box.
* Currently we don't want any. */
PADDING = 0,
};
static Eina_Bool
libclouseau_highlight_fade(void *_rect)
{
Evas_Object *rect = _rect;
int r, g, b, a;
double na;
evas_object_color_get(rect, &r, &g, &b, &a);
if (a < 20)
{
evas_object_del(rect);
return EINA_FALSE;
}
na = a - 20;
r = na / a * r;
g = na / a * g;
b = na / a * b;
evas_object_color_set(rect, r, g, b, na);
return EINA_TRUE;
}
static void
libclouseau_highlight(Evas_Object *obj)
{
Evas *e;
Evas_Object *r;
int x, y, w, h;
e = evas_object_evas_get(obj);
if (!e) return;
evas_object_geometry_get(obj, &x, &y, &w, &h);
r = evas_object_rectangle_add(e);
evas_object_move(r, x - PADDING, y - PADDING);
evas_object_resize(r, w + (2 * PADDING), h + (2 * PADDING));
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);
/* Print backtrace info, saved for future ref
tmp = evas_object_data_get(obj, ".clouseau.bt");
fprintf(stderr, "Creation backtrace :\n%s*******\n", tmp); */
}

View File

@ -18,6 +18,18 @@
#define CLOUSEAU_OBJ_TYPE_EDJE_STR "CLOUSEAU_OBJ_TYPE_EDJE"
#define CLOUSEAU_OBJ_TYPE_TEXTBLOCK_STR "CLOUSEAU_OBJ_TYPE_TEXTBLOCK"
/* The color of the highlight */
enum {
HIGHLIGHT_R = 255,
HIGHLIGHT_G = 128,
HIGHLIGHT_B = 128,
HIGHLIGHT_A = 255,
/* How much padding around the highlight box.
* Currently we don't want any. */
PADDING = 0,
};
enum _en_obj_type
{
CLOUSEAU_OBJ_TYPE_UNKNOWN,