make evrything handle mouse events.

- double click on item runs action, right click runs action and keep evry open
- same with selectors
- mouse down and move 150px browses that item. and back. TODO needs an indicator
- mouse wheel selects next/prev on plugin bar or selectors 



SVN revision: 48949
This commit is contained in:
Hannes Janetzek 2010-05-17 23:15:00 +00:00
parent 24188afa26
commit 5f9084b7d7
6 changed files with 952 additions and 686 deletions

View File

@ -32800,9 +32800,7 @@ collections {
data.item: "shaped" "1";
data.item: "shadow_offset" "50";
parts {
/*************** list ***************/
part {
name: "list_win";
type: RECT;
@ -32862,14 +32860,14 @@ collections {
rel2 {
relative: 1.0 1.0;
to: "base";
offset: 47 47;
offset: 47 40;
}
image {
normal: "everything_drop.png";
middle: 0;
border: 50 50 50 50;
}
fill.smooth: 0;
fill.smooth: 1;
}
description {
state: "composite" 0.0;
@ -32940,6 +32938,7 @@ collections {
part {
name: "bar_base";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
@ -32958,6 +32957,7 @@ collections {
part {
name: "bar_clip";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
@ -32978,6 +32978,7 @@ collections {
part {
name: "bar_bg";
clip_to: "base";
mouse_events: 0;
description {
state: "default" 0.0;
min: 32 25;
@ -33013,6 +33014,7 @@ collections {
part {
name: "bar_over2";
clip_to: "base";
mouse_events: 0;
description {
state: "default" 0.0;
rel1.to: "bar_bg";
@ -33029,6 +33031,7 @@ collections {
part {
name: "bar_over1";
clip_to: "base";
mouse_events: 0;
description {
state: "default" 0.0;
rel1.to: "bar_bg";
@ -33182,6 +33185,7 @@ collections {
name: "e.swallow.list";
type: SWALLOW;
clip_to: "list_clip";
mouse_events: 1;
description {
state: "default" 0.0;
min: 32 170;
@ -33206,6 +33210,7 @@ collections {
part {
name: "list_over";
clip_to: "base";
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
@ -33228,6 +33233,7 @@ collections {
part {
name: "list_over2";
clip_to: "base";
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
@ -33249,6 +33255,7 @@ collections {
}
part {
name: "box";
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
@ -33267,6 +33274,7 @@ collections {
color: 255 255 255 255;
}
}
/*************** top ***************/
part {
name: "win";
type: RECT;
@ -33315,13 +33323,13 @@ collections {
rel1.offset: 4 4;
rel2.offset: -5 -5;
fill.smooth: 1;
color: 255 255 255 255;
fill.smooth: 0;
}
description {
state: "composite" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 200;
}
}
part {
@ -33639,6 +33647,7 @@ collections {
name: "inner_clip";
type: RECT;
clip_to: "clip";
mouse_events: 0;
description {
state: "default" 0.0;
rel1.offset: 10 10;
@ -33649,6 +33658,7 @@ collections {
name: "icon_clip";
type: RECT;
clip_to: "inner_clip";
mouse_events: 0;
description {
state: "default" 0.0;
color: 255 255 255 255;
@ -33662,6 +33672,7 @@ collections {
name: "e.swallow.icons";
type: SWALLOW;
clip_to: "icon_clip";
mouse_events: 0;
description {
state: "default" 0.0;
min: 64 64;
@ -33683,6 +33694,7 @@ collections {
name: "e.swallow.thumb";
type: SWALLOW;
clip_to: "icon_clip";
mouse_events: 0;
description {
state: "default" 0.0;
min: 86 64;
@ -33755,6 +33767,14 @@ collections {
}
}
}
part {
name: "event";
type: RECT;
description {
state: "default" 0.0;
color: 0 0 0 0;
}
}
}
programs {
program {
@ -33831,6 +33851,7 @@ collections {
type: TEXT;
scale: 1;
clip_to: "clip";
mouse_events: 0;
description {
state: "default" 0.0;
align: 0.5 0.5;
@ -33877,6 +33898,7 @@ collections {
mouse_events: 0;
clip_to: "clip";
scale: 1;
mouse_events: 0;
description {
state: "default" 0.0;
align: 0.5 0.5;
@ -33900,6 +33922,14 @@ collections {
visible: 1;
}
}
part {
name: "event";
type: RECT;
description {
state: "default" 0.0;
color: 0 0 0 0;
}
}
}
programs {
program {
@ -33929,53 +33959,7 @@ collections {
group {
name: "e/modules/everything/thumbview/main/window";
images {
image: "vgrad_dark.png" COMP;
image: "dia_botshad.png" COMP;
image: "big_arrow_up.png" COMP;
image: "busy-1.png" COMP;
image: "busy-2.png" COMP;
image: "busy-3.png" COMP;
image: "busy-4.png" COMP;
image: "busy-5.png" COMP;
image: "busy-6.png" COMP;
image: "busy-7.png" COMP;
image: "busy-8.png" COMP;
image: "busy-9.png" COMP;
}
parts {
part {
name: "base";
mouse_events: 0;
type: RECT;
description {
state: "default" 0.0;
visible: 0;
rel1 {
relative: 0.0 0.0;
offset: 0 -3;
}
rel2 {
relative: 1.0 1.0;
offset: -1 6;
}
}
}
part {
name: "e.swallow.preview";
type: SWALLOW;
description {
state: "default" 0.0;
}
}
part {
name: "events";
type: RECT;
description {
state: "default" 0.0;
color: 0 0 0 0;
}
}
part {
name: "e.swallow.list";
type: SWALLOW;
@ -33991,115 +33975,6 @@ collections {
}
}
}
part {
name: "cover";
type: RECT;
description {
state: "default" 0.0;
color: 0 0 0 0;
visible: 0;
}
description {
state: "out" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
part {
name: "shadow2";
mouse_events: 0;
description {
state: "default" 0.0;
rel1.relative: 0.0 1.0;
rel1.offset: 0 -4;
image.normal: "dia_botshad.png";
fill {
smooth: 0;
size {
relative: 0.0 1.0;
offset: 64 0;
}
}
}
}
part {
name: "busy_clip";
type: RECT;
description {
state: "default" 0.0;
visible: 0;
color: 255 255 255 0;
}
description {
state: "visible" 0.0;
visible: 1;
color: 255 255 255 255;
}
}
part {
name: "busy";
mouse_events: 0;
clip_to: "busy_clip";
description {
state: "default" 0.0;
min: 32 32;
max: 32 32;
aspect: 1.0 1.0;
aspect_preference: BOTH;
rel1 {
relative: 0.5 0.5;
offset: 0 0;
}
rel2 {
relative: 0.5 0.5;
offset: -1 1;
}
image {
normal: "busy-9.png";
tween: "busy-1.png";
tween: "busy-2.png";
tween: "busy-3.png";
tween: "busy-4.png";
tween: "busy-5.png";
tween: "busy-6.png";
tween: "busy-7.png";
tween: "busy-8.png";
}
}
}
}
programs {
program {
name: "busy1";
signal: "e,state,busy,on";
source: "e";
action: STATE_SET "visible" 0.0;
transition: LINEAR 1.0;
target: "busy_clip";
}
program {
name: "busy_anim";
signal: "e,state,busy,on";
source: "e";
action: STATE_SET "default" 0.0;
transition: LINEAR 0.3333;
target: "busy";
after: "busy_anim";
}
program {
name: "busy2";
signal: "e,state,busy,off";
source: "e";
action: STATE_SET "default" 0.0;
transition: LINEAR 1.0;
target: "busy_clip";
after: "busy3";
}
program {
name: "busy3";
action: ACTION_STOP;
target: "busy_anim";
}
}
}
group {
@ -34207,6 +34082,7 @@ collections {
name: "e.swallow.icon";
clip_to: "clip";
type: SWALLOW;
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
@ -34225,6 +34101,7 @@ collections {
name: "e.swallow.thumb";
clip_to: "clip";
type: SWALLOW;
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
@ -34263,6 +34140,14 @@ collections {
}
}
}
part {
name: "event";
type: RECT;
description {
state: "default" 0.0;
color: 0 0 0 0;
}
}
}
programs {
program {
@ -34452,6 +34337,7 @@ collections {
name: "e.swallow.icon";
clip_to: "clip";
type: SWALLOW;
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
@ -34466,6 +34352,7 @@ collections {
name: "e.swallow.thumb";
clip_to: "clip";
type: SWALLOW;
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
@ -34478,6 +34365,7 @@ collections {
}
part {
name: "arrow";
mouse_events: 0;
description {
state: "default" 0.0;
align: 0.0 0.5;
@ -34604,6 +34492,14 @@ collections {
visible: 1;
}
}
part {
name: "event";
type: RECT;
description {
state: "default" 0.0;
color: 0 0 0 0;
}
}
}
programs {
program {

View File

@ -36,6 +36,8 @@ struct _Evry_Window
Evry_Selector **sel_list;
int level;
int down_out;
};
struct _Evry_Selector
@ -120,9 +122,11 @@ struct _Evry_View
struct _Tab_View
{
Evas *evas;
const Evry_State *state;
Evry_View *view;
Evas *evas;
Evas_Object *o_tabs;
Eina_List *tabs;
@ -259,7 +263,7 @@ Evry_Type evry_type_register(const char *type);
const char *evry_type_get(Evry_Type type);
Tab_View *evry_tab_view_new(const Evry_State *s, Evas *e);
Tab_View *evry_tab_view_new(Evry_View *view, const Evry_State *s, Evas *e);
void evry_tab_view_free(Tab_View *v);
Eina_Bool view_thumb_init(void);
@ -295,6 +299,8 @@ void evry_history_free(void);
int evry_browse_item(Evry_Selector *sel);
int evry_browse_back(Evry_Selector *sel);
void evry_plugin_action(int finished);
extern Evry_History *evry_hist;
extern Evry_Config *evry_conf;

View File

@ -57,6 +57,7 @@ static void _evry_item_sel(Evry_State *s, Evry_Item *it);
static int _evry_cb_key_down(void *data, int type, void *event);
static int _evry_cb_selection_notify(void *data, int type, void *event);
static int _evry_cb_mouse(void *data, int type, void *event);
/* local subsystem globals */
@ -194,16 +195,39 @@ evry_show(E_Zone *zone, const char *params)
win->handlers = eina_list_append
(win->handlers, ecore_event_handler_add
(ECORE_EVENT_KEY_DOWN, _evry_cb_key_down, NULL));
(ECORE_EVENT_KEY_DOWN,
_evry_cb_key_down, NULL));
win->handlers = eina_list_append
(win->handlers, ecore_event_handler_add
(ECORE_X_EVENT_SELECTION_NOTIFY,
_evry_cb_selection_notify, win));
win->handlers = eina_list_append
(win->handlers, ecore_event_handler_add
(EVRY_EVENT_ITEM_CHANGED,
_evry_cb_item_changed, NULL));
win->handlers = eina_list_append
(win->handlers, ecore_event_handler_add
(ECORE_EVENT_MOUSE_BUTTON_DOWN,
_evry_cb_mouse, win));
win->handlers = eina_list_append
(win->handlers, ecore_event_handler_add
(ECORE_EVENT_MOUSE_BUTTON_UP,
_evry_cb_mouse, win));
win->handlers = eina_list_append
(win->handlers, ecore_event_handler_add
(ECORE_EVENT_MOUSE_MOVE,
_evry_cb_mouse, win));
win->handlers = eina_list_append
(win->handlers, ecore_event_handler_add
(ECORE_EVENT_MOUSE_WHEEL,
_evry_cb_mouse, win));
e_popup_layer_set(win->popup, 255);
e_popup_show(win->popup);
@ -376,7 +400,7 @@ _evry_selectors_shift(int dir)
return 0;
}
EAPI void
void
evry_clear_input(Evry_Plugin *p)
{
Evry_Selector *sel = _evry_selector_for_plugin_get(p);
@ -402,7 +426,7 @@ evry_clear_input(Evry_Plugin *p)
static int item_cnt = 0;
#endif
EAPI Evry_Item *
Evry_Item *
evry_item_new(Evry_Item *base, Evry_Plugin *p, const char *label,
Evas_Object *(*icon_get) (Evry_Item *it, Evas *e),
void (*cb_free) (Evry_Item *item))
@ -437,7 +461,7 @@ evry_item_new(Evry_Item *base, Evry_Plugin *p, const char *label,
return it;
}
EAPI void
void
evry_item_free(Evry_Item *it)
{
if (!it) return;
@ -520,7 +544,7 @@ _evry_selector_update_actions(Evry_Selector *sel)
sel->update_timer = ecore_timer_add(0.1, _evry_timer_cb_actions_get, it);
}
EAPI void
void
evry_item_select(const Evry_State *state, Evry_Item *it)
{
Evry_State *s = (Evry_State *)state;
@ -546,7 +570,7 @@ evry_item_select(const Evry_State *state, Evry_Item *it)
}
}
EAPI void
void
evry_item_mark(const Evry_State *state, Evry_Item *it, Eina_Bool mark)
{
Evry_State *s = (Evry_State *)state;
@ -563,13 +587,13 @@ evry_item_mark(const Evry_State *state, Evry_Item *it, Eina_Bool mark)
}
}
EAPI void
void
evry_item_ref(Evry_Item *it)
{
it->ref++;
}
EAPI int
int
evry_list_win_show(void)
{
if (win->visible) return 0;
@ -578,13 +602,13 @@ evry_list_win_show(void)
return 1;
}
EAPI void
void
evry_list_win_hide(void)
{
_evry_list_win_clear(1);
}
EAPI void
void
evry_plugin_update(Evry_Plugin *p, int action)
{
Evry_State *s;
@ -771,9 +795,76 @@ _evry_window_new(E_Zone *zone)
ecore_x_netwm_window_type_set(popup->evas_win, ECORE_X_WINDOW_TYPE_UTILITY);
evas_event_feed_mouse_in(win->popup->evas, ecore_x_current_time_get(), NULL);
evas_event_feed_mouse_move(win->popup->evas, -1000000, -1000000, ecore_x_current_time_get(), NULL);
return win;
}
static int
_evry_cb_mouse(void *data, int type, void *event)
{
Ecore_Event_Mouse_Button *ev;
E_Popup *pop;
ev = event;
if (ev->window != input_window) return 1;
pop = win->popup;
if (type == ECORE_EVENT_MOUSE_MOVE)
{
Ecore_Event_Mouse_Move *ev = event;
evas_event_feed_mouse_move
(pop->evas,
ev->x - pop->x + pop->zone->x,
ev->y - pop->y + pop->zone->y,
ev->timestamp, NULL);
}
else if (type == ECORE_EVENT_MOUSE_BUTTON_DOWN)
{
win->down_out = 0;
/* XXX shift triple click in flags when needed */
if (!E_INSIDE(ev->x, ev->y, pop->x + pop->zone->x,
pop->y + pop->zone->y, pop->w, pop->h))
{
win->down_out = 1;
return 1;
}
evas_event_feed_mouse_down
(pop->evas,
ev->buttons, ev->double_click,
ev->timestamp, NULL);
}
else if (type == ECORE_EVENT_MOUSE_BUTTON_UP)
{
if (win->down_out &&
!E_INSIDE(ev->x, ev->y, pop->x + pop->zone->x,
pop->y + pop->zone->y, pop->w, pop->h))
{
evry_hide(0);
return 1;
}
evas_event_feed_mouse_up
(pop->evas,
ev->buttons, ev->double_click,
ev->timestamp, NULL);
}
else if (type == ECORE_EVENT_MOUSE_WHEEL)
{
Ecore_Event_Mouse_Wheel *ev = event;
evas_event_feed_mouse_wheel
(pop->evas, 0, ev->z, ev->timestamp, NULL);
}
return 1;
}
static void
_evry_window_free(Evry_Window *win)
{
@ -785,6 +876,74 @@ _evry_window_free(Evry_Window *win)
E_FREE(win);
}
static void
_evry_selector_cb_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Down *ev = event_info;
/* Evry_Selector *sel = data; */
if (ev->button == 1)
{
if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
evry_plugin_action(1);
}
}
static void
_evry_selector_cb_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Wheel *ev = event_info;
if (ev->z > 0)
{
/* FIXME dont loose selector 2 state until state 0 changed: */
if (win->selector != win->selectors[2])
_evry_selectors_switch(1);
}
else if (ev->z < 0)
{
_evry_selectors_switch(-1);
}
}
static void
_evry_selector_cb_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Up *ev = event_info;
Evry_Selector *sel = data;
if (sel == win->selector)
return;
if (ev->button == 3)
{
evry_plugin_action(0);
}
else if (ev->button == 1)
{
if (sel == win->selectors[0])
{
if (win->selector == win->selectors[1])
_evry_selectors_switch(-1);
else
_evry_selectors_switch(1);
}
else if (sel == win->selectors[1])
{
if (win->selector == win->selectors[0])
_evry_selectors_switch(1);
else
_evry_selectors_switch(-1);
}
else if (sel == win->selectors[2])
{
if (win->selector == win->selectors[1])
_evry_selectors_switch(1);
}
}
}
static Evry_Selector *
_evry_selector_new(Evry_Window *win, int type)
{
@ -795,6 +954,13 @@ _evry_selector_new(Evry_Window *win, int type)
sel->o_main = o;
e_theme_edje_object_set(o, "base/theme/everything",
"e/modules/everything/selector_item");
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_evry_selector_cb_down, sel);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP,
_evry_selector_cb_up, sel);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL,
_evry_selector_cb_wheel, sel);
evas_object_show(o);
sel->aggregator = evry_aggregator_new(win, type);
@ -1352,9 +1518,10 @@ evry_browse_item(Evry_Selector *sel)
return 1;
}
EAPI int
int
evry_browse_back(Evry_Selector *sel)
{
if (!sel) sel = win->selector;
Evry_State *s = sel->state;
DBG("%p", sel);
@ -1870,6 +2037,12 @@ _evry_action_do(Evry_Action *act)
return 0;
}
void
evry_plugin_action(int finished)
{
_evry_plugin_action(win->selector, finished);
}
static void
_evry_plugin_action(Evry_Selector *sel, int finished)
{

View File

@ -56,6 +56,10 @@ struct _Smart_Data
int sliding;
int clearing;
int mouse_act;
int mouse_down;
Item *it_down;
};
struct _Item
@ -77,6 +81,8 @@ struct _Item
static View *view = NULL;
static void _view_clear(Evry_View *view, int slide);
static void _pan_item_select(Evas_Object *obj, Item *it, int scroll);
static void
@ -164,6 +170,70 @@ _thumb_idler(void *data)
return 0;
}
static void
_item_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Down *ev = event_info;
Item *it = data;
Smart_Data *sd = evas_object_smart_data_get(it->obj);
sd->mouse_act = 1;
if (ev->button == 1)
{
if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
{
evry_item_select(sd->view->state, it->item);
_pan_item_select(it->obj, it, 0);
evry_plugin_action(1);
}
else
{
sd->mouse_down = ev->canvas.x;
sd->it_down = it;
if (sd->selector && evas_object_visible_get(sd->selector))
{
evas_object_hide(sd->selector);
}
}
}
}
static void
_item_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Up *ev = event_info;
Item *it = data;
Smart_Data *sd = evas_object_smart_data_get(it->obj);
sd->mouse_down = 0;
sd->it_down = NULL;
if (ev->button == 1)
{
if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
{
if (sd->selector)
evas_object_hide(sd->selector);
evry_item_select(sd->view->state, it->item);
_pan_item_select(it->obj, it, 0);
}
}
else if (ev->button == 3)
{
if (sd->selector)
evas_object_hide(sd->selector);
evry_item_select(sd->view->state, it->item);
_pan_item_select(it->obj, it, 0);
evry_plugin_action(0);
}
}
static void
_item_show(View *v, Item *it, Evas_Object *list)
{
@ -185,6 +255,10 @@ _item_show(View *v, Item *it, Evas_Object *list)
edje_object_signal_emit(it->frame, "e,state,detail,show", "e");
}
evas_object_event_callback_add(it->frame, EVAS_CALLBACK_MOUSE_DOWN,
_item_down, it);
evas_object_event_callback_add(it->frame, EVAS_CALLBACK_MOUSE_UP,
_item_up, it);
evas_object_smart_member_add(it->frame, list);
evas_object_clip_set(it->frame, evas_object_clip_get(list));
@ -342,7 +416,7 @@ _e_smart_reconfigure_do(void *data)
if (sd->selector)
evas_object_hide(sd->selector);
}
else
else if (!sd->mouse_act)
{
if (!sd->selector)
{
@ -716,7 +790,15 @@ _pan_item_select(Evas_Object *obj, Item *it, int scroll)
}
else scroll = 0;
if (sd->view->mode == VIEW_MODE_LIST ||
if (sd->mouse_act &&
((sd->view->mode == VIEW_MODE_LIST ||
sd->view->mode == VIEW_MODE_DETAIL)))
{
edje_object_signal_emit(sd->cur_item->frame,
"e,state,selected", "e");
return;
}
else if (sd->view->mode == VIEW_MODE_LIST ||
sd->view->mode == VIEW_MODE_DETAIL)
{
int all = sd->ch / it->h;
@ -769,8 +851,6 @@ _pan_item_select(Evas_Object *obj, Item *it, int scroll)
}
}
/* edje_object_signal_emit(sd->cur_item->frame,
* "e,state,selected", "e"); */
align *= it->h;
}
else
@ -858,6 +938,10 @@ _view_clear(Evry_View *view, int slide)
Smart_Data *sd = evas_object_smart_data_get(v->span);
Item *it;
sd->mouse_down = 0;
sd->mouse_act = 0;
sd->it_down = NULL;
if (!sd->clearing && evry_conf->scroll_animate)
{
if (slide)
@ -943,6 +1027,8 @@ _view_update(Evry_View *view, int slide)
Evry_Plugin *p = v->state->plugin;
sd->cur_item = NULL;
sd->mouse_act = 0;
sd->mouse_down = 0;
if (!p)
{
@ -1104,6 +1190,9 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
const char *key = ev->key;
sd->mouse_act = 0;
sd->mouse_down = 0;
if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) &&
(!strcmp(key, "2")))
{
@ -1393,6 +1482,52 @@ _cb_item_changed(void *data, int type, void *event)
return 1;
}
static void
_view_cb_mouse_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Wheel *ev = event_info;
Smart_Data *sd = evas_object_smart_data_get(obj);
if (ev->z)
{
evas_object_hide(sd->selector);
if (sd->cur_item)
edje_object_signal_emit(sd->cur_item->frame, "e,state,selected", "e");
sd->mouse_act = 1;
}
}
static void
_view_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Move *ev = event_info;
Smart_Data *sd = evas_object_smart_data_get(obj);
if (!sd->mouse_down)
return ;
if (!sd->it_down)
return;
if ((sd->cur_item != sd->it_down) &&
(abs(ev->cur.canvas.x - sd->mouse_down) > 15))
{
evry_item_select(sd->view->state, sd->it_down->item);
_pan_item_select(obj, sd->it_down, 0);
return;
}
if (ev->cur.canvas.x - sd->mouse_down > 150)
{
evry_browse_back(NULL);
sd->mouse_down = 0;
}
else if (sd->mouse_down - ev->cur.canvas.x > 150)
{
evry_browse_item(NULL);
sd->mouse_down = 0;
}
}
static Evry_View *
_view_create(Evry_View *view, const Evry_State *s, const Evas_Object *swallow)
{
@ -1424,11 +1559,17 @@ _view_create(Evry_View *view, const Evry_State *s, const Evas_Object *swallow)
// scrolled thumbs
v->span = _pan_add(v->evas);
_pan_view_set(v->span, v);
evas_object_event_callback_add(v->span, EVAS_CALLBACK_MOUSE_WHEEL,
_view_cb_mouse_wheel, NULL);
evas_object_event_callback_add(v->span, EVAS_CALLBACK_MOUSE_MOVE,
_view_cb_mouse_move, NULL);
// the scrollframe holding the scrolled thumbs
v->sframe = e_scrollframe_add(v->evas);
e_scrollframe_custom_theme_set(v->sframe, "base/theme/widgets",
"e/modules/everything/thumbview/main/scrollframe");
e_scrollframe_thumbscroll_force(v->sframe, 1);
e_scrollframe_extern_pan_set(v->sframe, v->span,
_pan_set, _pan_get, _pan_max_get,
_pan_child_size_get);
@ -1437,7 +1578,7 @@ _view_create(Evry_View *view, const Evry_State *s, const Evas_Object *swallow)
evas_object_show(v->sframe);
evas_object_show(v->span);
v->tabs = evry_tab_view_new(s, v->evas);
v->tabs = evry_tab_view_new(EVRY_VIEW(v), v->state, v->evas);
EVRY_VIEW(v)->o_list = v->bg;
EVRY_VIEW(v)->o_bar = v->tabs->o_tabs;

View File

@ -416,6 +416,7 @@ _evry_icon_fdo_set(Evas_Object *obj, const char *icon)
path = efreet_icon_path_find(e_config->icon_theme, icon, 128);
if (!path) return 0;
e_icon_scale_size_set(obj, 128);
e_icon_file_set(obj, path);
E_FREE(path);
return 1;

View File

@ -5,6 +5,7 @@ typedef struct _Tab Tab;
struct _Tab
{
Tab_View *tab_view;
Evry_Plugin *plugin;
Evas_Object *o_tab;
@ -13,6 +14,10 @@ struct _Tab
static void _tabs_update(Tab_View *v);
static void _plugin_select(Tab_View *v, Evry_Plugin *p);
static void _plugin_next(Tab_View *v);
static void _plugin_prev(Tab_View *v);
#if 0
static int
@ -98,10 +103,46 @@ _timer_cb(void *data)
}
static void
_tab_cb_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
/* Evas_Event_Mouse_Down *ev = event_info; */
}
static void
_tab_cb_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Up *ev = event_info;
Tab *tab = data;
Tab_View *v = tab->tab_view;
if (ev->button == 1)
{
_plugin_select(v, tab->plugin);
v->view->update(v->view, 0);
}
}
static void
_tabs_cb_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Wheel *ev = event_info;
Tab_View *v = data;
if (ev->z > 0)
{
_plugin_next(v);
v->view->update(v->view, 0);
}
else if (ev->z < 0)
{
_plugin_prev(v);
v->view->update(v->view, 0);
}
}
static void
_tabs_update(Tab_View *v)
{
Eina_List *l, *ll, *plugins;
Evry_Plugin *p;
const Evry_State *s = v->state;
@ -153,12 +194,16 @@ _tabs_update(Tab_View *v)
{
tab = E_NEW(Tab, 1);
tab->plugin = p;
tab->tab_view = v;
o = edje_object_add(v->evas);
e_theme_edje_object_set(o, "base/theme/everything",
"e/modules/everything/tab_item");
edje_object_part_text_set(o, "e.text.label", EVRY_ITEM(p)->label);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_tab_cb_down, tab);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP,
_tab_cb_up, tab);
tab->o_tab = o;
edje_object_size_min_calc(o, &tab->cw, NULL);
@ -340,7 +385,7 @@ _tabs_key_down(Tab_View *v, const Ecore_Event_Key *ev)
EAPI Tab_View *
evry_tab_view_new(const Evry_State *s, Evas *e)
evry_tab_view_new(Evry_View *view, const Evry_State *s, Evas *e)
{
Tab_View *v;
Evas_Object *o;
@ -349,12 +394,16 @@ evry_tab_view_new(const Evry_State *s, Evas *e)
v->update = &_tabs_update;
v->clear = &_tabs_clear;
v->key_down = &_tabs_key_down;
v->view = view;
v->state = s;
v->evas = e;
o = e_box_add(e);
e_box_orientation_set(o, 1);
e_box_homogenous_set(o, 1);
/* evas_object_propagate_events_set(o, 1); */
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL,
_tabs_cb_wheel, v);
v->o_tabs = o;
return v;