discomfitor pushed a commit to branch master. http://git.enlightenment.org/apps/empc.git/commit/?id=3d4b0a039e553d10bfe37254d3945e72fada0ed6
commit 3d4b0a039e553d10bfe37254d3945e72fada0ed6 Author: zmike <michael.blumenkra...@gmail.com> Date: Thu Feb 19 22:43:17 2015 -0500 add ctrl+scrolling in player view to skip prev/next album --- README | 2 + data/themes/empc.edc | 16 +++++++ src/bin/empc.c | 118 ++++++++++++++++++++++++++++++++------------------- 3 files changed, 93 insertions(+), 43 deletions(-) diff --git a/README b/README index 6e61788..a6227da 100644 --- a/README +++ b/README @@ -47,7 +47,9 @@ Controls: Double left click -> background selector view Right click -> fetch+show lyrics Wheel down -> next track + Ctrl+Wheel down -> next album Wheel up -> previous track + Ctrl+Wheel up -> previous album Ctrl+v -> paste image url/data to use as background diff --git a/data/themes/empc.edc b/data/themes/empc.edc index 4beef1a..a5d3294 100644 --- a/data/themes/empc.edc +++ b/data/themes/empc.edc @@ -10,12 +10,16 @@ /* controls actions for mouse events on background available actions: - prev + - prev_album - next + - next_album - toggle - stop */ #define WHEEL_UP_ACTION "prev" +#define CTRL_WHEEL_UP_ACTION "prev_album" #define WHEEL_DOWN_ACTION "next" +#define CTRL_WHEEL_DOWN_ACTION "next_album" #define LEFT_CLICK_ACTION "toggle" #define HIDE_TIMEOUT 3.0 @@ -230,6 +234,18 @@ collections { emit("empc,play,"WHEEL_DOWN_ACTION, "empc"); } } + program { signal: "empc,mouse,wheel,0,-1,ctrl"; source: "empc"; + script { + if (!get_int(bg_chooser)) + emit("empc,play,"CTRL_WHEEL_UP_ACTION, "empc"); + } + } + program { signal: "empc,mouse,wheel,0,1,ctrl"; source: "empc"; + script { + if (!get_int(bg_chooser)) + emit("empc,play,"CTRL_WHEEL_DOWN_ACTION, "empc"); + } + } program { signal: "empc,bg,next"; source: "empc"; //switch to left action: STATE_SET "left" 0.0; target: EMPC_SWALLOW_BACKGROUND; diff --git a/src/bin/empc.c b/src/bin/empc.c index e158647..31170a0 100644 --- a/src/bin/empc.c +++ b/src/bin/empc.c @@ -2896,6 +2896,18 @@ control_skip_back() } static void +control_skip_back_album() +{ + Empd_Empdd_Song *so; + Elm_Object_Item *pick; + + if (!empd_song_item) return; + pick = queue_list_header_prev_get(elm_genlist_item_parent_get(empd_song_item)); + so = elm_object_item_data_get(pick); + empd_empdd_play_id_call(empd_proxy, so->songid); +} + +static void control_stop() { empd_empdd_stop_call(empd_proxy); @@ -2917,6 +2929,18 @@ control_skip_forward() } static void +control_skip_forward_album() +{ + Empd_Empdd_Song *so; + Elm_Object_Item *pick; + + if (!empd_song_item) return; + pick = queue_list_header_next_get(elm_genlist_item_parent_get(empd_song_item)); + so = elm_object_item_data_get(pick); + empd_empdd_play_id_call(empd_proxy, so->songid); +} + +static void controls_hiding() { elm_layout_signal_emit(evas_object_data_get(win, "slider"), "empc,controls,hiding", "empc"); @@ -2954,56 +2978,62 @@ slider_seek(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUS static int mouse_wheel(void *data EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Wheel *ev) { - if (!queue_list_state) return ECORE_CALLBACK_RENEW; - if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) + Elm_Object_Item *it, *pit, *pick = NULL; + int x, y, w; + + if (filesystem_state) return ECORE_CALLBACK_RENEW; + if (!(ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) return ECORE_CALLBACK_RENEW; + elm_layout_signal_emit(layout, "empc,mouse,wheel", "empc"); + if (!queue_list_state) { - Elm_Object_Item *it, *pit, *pick = NULL; - int x, y, w; + if (!empd_song_item) return ECORE_CALLBACK_CANCEL; + if (ev->z < 0) //up + elm_layout_signal_emit(layout, "empc,mouse,wheel,0,-1,ctrl", "empc"); + else if (ev->z > 0) //down + elm_layout_signal_emit(layout, "empc,mouse,wheel,0,1,ctrl", "empc"); + return ECORE_CALLBACK_CANCEL; + } - if (queue_list_scroll_item) - { - if (ev->z < 0) //up - pick = queue_list_header_prev_get(queue_list_scroll_item); - else if (ev->z > 0) //down - pick = queue_list_header_next_get(queue_list_scroll_item); - elm_layout_signal_emit(layout, "empc,mouse,wheel", "empc"); - elm_genlist_item_bring_in(pick, ELM_GENLIST_ITEM_SCROLLTO_TOP); - queue_list_scroll_item = pick; - return ECORE_CALLBACK_CANCEL; - } - elm_scroller_region_get(queue_list, NULL, NULL, &w, NULL); - evas_object_geometry_get(queue_list, &x, &y, NULL, NULL); - /* FIXME: this should actually calc the height of an item for y */ - it = elm_genlist_at_xy_item_get(queue_list, x + (w / 2), y + 2, NULL); - if (!it) return ECORE_CALLBACK_RENEW; - pit = elm_genlist_item_parent_get(it); - if (!pit) pit = it; //already parent - if (!ev->z) return ECORE_CALLBACK_RENEW; + if (queue_list_scroll_item) + { if (ev->z < 0) //up - { - if (pit != it) pick = pit; - else - pick = queue_list_header_prev_get(pit); - } - else if (ev->z > 0) - { - if (pit != it) - { - pick = elm_genlist_item_next_get(pit); - if (pick) - pick = elm_genlist_item_parent_get(pick); - } - else - pick = queue_list_header_next_get(pit); - if (!pick) - pick = elm_genlist_last_item_get(queue_list); - } + pick = queue_list_header_prev_get(queue_list_scroll_item); + else if (ev->z > 0) //down + pick = queue_list_header_next_get(queue_list_scroll_item); elm_genlist_item_bring_in(pick, ELM_GENLIST_ITEM_SCROLLTO_TOP); queue_list_scroll_item = pick; - elm_layout_signal_emit(layout, "empc,mouse,wheel", "empc"); return ECORE_CALLBACK_CANCEL; } - return ECORE_CALLBACK_RENEW; + elm_scroller_region_get(queue_list, NULL, NULL, &w, NULL); + evas_object_geometry_get(queue_list, &x, &y, NULL, NULL); + /* FIXME: this should actually calc the height of an item for y */ + it = elm_genlist_at_xy_item_get(queue_list, x + (w / 2), y + 2, NULL); + if (!it) return ECORE_CALLBACK_RENEW; + pit = elm_genlist_item_parent_get(it); + if (!pit) pit = it; //already parent + if (!ev->z) return ECORE_CALLBACK_RENEW; + if (ev->z < 0) //up + { + if (pit != it) pick = pit; + else + pick = queue_list_header_prev_get(pit); + } + else if (ev->z > 0) + { + if (pit != it) + { + pick = elm_genlist_item_next_get(pit); + if (pick) + pick = elm_genlist_item_parent_get(pick); + } + else + pick = queue_list_header_next_get(pit); + if (!pick) + pick = elm_genlist_last_item_get(queue_list); + } + elm_genlist_item_bring_in(pick, ELM_GENLIST_ITEM_SCROLLTO_TOP); + queue_list_scroll_item = pick; + return ECORE_CALLBACK_CANCEL; } static int @@ -3657,7 +3687,9 @@ main(int argc, char *argv[]) elm_object_signal_callback_add(layout, "empc,play,toggle", "empc", control_toggle, NULL); elm_object_signal_callback_add(layout, "empc,play,stop", "empc", control_stop, NULL); elm_object_signal_callback_add(layout, "empc,play,prev", "empc", control_skip_back, NULL); + elm_object_signal_callback_add(layout, "empc,play,prev_album", "empc", control_skip_back_album, NULL); elm_object_signal_callback_add(layout, "empc,play,next", "empc", control_skip_forward, NULL); + elm_object_signal_callback_add(layout, "empc,play,next_album", "empc", control_skip_forward_album, NULL); elm_object_signal_callback_add(layout, "empc,lyrics,request", "empc", lyrics_request, NULL); elm_object_signal_callback_add(layout, "empc,lyrics,visible", "empc", lyrics_show, NULL); --