media: improve media control pos/vol slider

Summary:
currently, pos/vol could be changed by using only knob not slider area.
use slider area as event source, and control knob internally.

Fixes T1440

Test Plan: terminology -> tycat video file -> try to control pos/vol by clicking slider area

Reviewers: billiob

Subscribers: seoz

Maniphest Tasks: T1440

Differential Revision: https://phab.enlightenment.org/D1219
devs/discomfitor/cc
Wonguk Jeong 9 years ago
parent 922940005a
commit b14042aa49
  1. 76
      data/themes/default.edc
  2. 76
      data/themes/nyanology/default.edc
  3. 76
      data/themes/nyanology/nyanology.edc
  4. 32
      src/bin/media.c

@ -3346,7 +3346,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
part { name: "posline";
mouse_events: 0;
mouse_events: 1;
repeat_events: 1;
clip_to: "media_clip";
description { state: "default" 0.0;
@ -3361,7 +3361,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
part { name: "terminology.posdrag";
mouse_events: 1;
mouse_events: 0;
repeat_events: 1;
clip_to: "media_clip";
dragable {
@ -3379,7 +3379,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
part { name: "volline";
mouse_events: 0;
mouse_events: 1;
repeat_events: 1;
clip_to: "media_clip";
description { state: "default" 0.0;
@ -3399,7 +3399,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
part { name: "terminology.voldrag"; type: IMAGE;
mouse_events: 1;
mouse_events: 0;
repeat_events: 1;
clip_to: "media_clip";
dragable {
@ -3464,6 +3464,74 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
action: STATE_SET "default" 0.0;
target: "terminology.voldrag";
}
program {
signal: "mouse,down,1"; source: "posline";
filter: "terminology.posdrag" "default";
script {
new x, y, w, h, m_x, m_y;
new Float:pos;
get_geometry(PART:"posline", x, y, w, h);
get_mouse(m_x, m_y);
pos = m_x - x;
pos = pos / w;
set_drag(PART:"terminology.posdrag", pos, 0.0);
emit("pos,drag,start", "");
}
}
program {
signal: "mouse,up,1"; source: "posline";
action: SIGNAL_EMIT "pos,drag,stop" "";
}
program {
signal: "mouse,move"; source: "posline";
script {
new x, y, w, h, m_x, m_y;
new Float:pos;
if (!get_mouse_buttons()) return;
get_geometry(PART:"posline", x, y, w, h);
get_mouse(m_x, m_y);
pos = m_x - x;
pos = pos / w;
set_drag(PART:"terminology.posdrag", pos, 0.0);
emit("pos,drag", "");
}
}
program {
signal: "mouse,down,1"; source: "volline";
filter: "terminology.voldrag" "default";
script {
new x, y, w, h, m_x, m_y;
new Float:pos;
get_geometry(PART:"volline", x, y, w, h);
get_mouse(m_x, m_y);
pos = m_x - x;
pos = pos / w;
set_drag(PART:"terminology.voldrag", pos, 0.0);
emit("vol,drag", "");
}
}
program {
signal: "mouse,move"; source: "volline";
script {
new x, y, w, h, m_x, m_y;
new Float:pos;
if (!get_mouse_buttons()) return;
get_geometry(PART:"volline", x, y, w, h);
get_mouse(m_x, m_y);
pos = m_x - x;
pos = pos / w;
set_drag(PART:"terminology.voldrag", pos, 0.0);
emit("vol,drag", "");
}
}
}
}

@ -2502,7 +2502,7 @@ target: "4.bottom"
}
}
part { name: "posline";
mouse_events: 0;
mouse_events: 1;
repeat_events: 1;
clip_to: "media_clip";
description { state: "default" 0.0;
@ -2517,7 +2517,7 @@ target: "4.bottom"
}
}
part { name: "terminology.posdrag";
mouse_events: 1;
mouse_events: 0;
repeat_events: 1;
clip_to: "media_clip";
dragable {
@ -2535,7 +2535,7 @@ target: "4.bottom"
}
}
part { name: "volline";
mouse_events: 0;
mouse_events: 1;
repeat_events: 1;
clip_to: "media_clip";
description { state: "default" 0.0;
@ -2555,7 +2555,7 @@ target: "4.bottom"
}
}
part { name: "terminology.voldrag"; type: IMAGE;
mouse_events: 1;
mouse_events: 0;
repeat_events: 1;
clip_to: "media_clip";
dragable {
@ -2629,6 +2629,74 @@ target: "4.bottom"
action: STATE_SET "default" 0.0;
target: "terminology.voldrag";
}
program { name: "media_pos_drag_start";
signal: "mouse,down,1"; source: "posline";
filter: "terminology.posdrag" "default";
script {
new x, y, w, h, m_x, m_y;
new Float:pos;
get_geometry(PART:"posline", x, y, w, h);
get_mouse(m_x, m_y);
pos = m_x - x;
pos = pos / w;
set_drag(PART:"terminology.posdrag", pos, 0.0);
emit("pos,drag,start", "");
}
}
program { name: "media_pos_drag_stop";
signal: "mouse,up,1"; source: "posline";
action: SIGNAL_EMIT "pos,drag,stop" "";
}
program { name: "media_pos_drag";
signal: "mouse,move"; source: "posline";
script {
new x, y, w, h, m_x, m_y;
new Float:pos;
if (!get_mouse_buttons()) return;
get_geometry(PART:"posline", x, y, w, h);
get_mouse(m_x, m_y);
pos = m_x - x;
pos = pos / w;
set_drag(PART:"terminology.posdrag", pos, 0.0);
emit("pos,drag", "");
}
}
program { name: "media_vol_drag_start";
signal: "mouse,down,1"; source: "volline";
filter: "terminology.voldrag" "default";
script {
new x, y, w, h, m_x, m_y;
new Float:pos;
get_geometry(PART:"volline", x, y, w, h);
get_mouse(m_x, m_y);
pos = m_x - x;
pos = pos / w;
set_drag(PART:"terminology.voldrag", pos, 0.0);
emit("vol,drag", "");
}
}
program { name: "media_vol_drag";
signal: "mouse,move"; source: "volline";
script {
new x, y, w, h, m_x, m_y;
new Float:pos;
if (!get_mouse_buttons()) return;
get_geometry(PART:"volline", x, y, w, h);
get_mouse(m_x, m_y);
pos = m_x - x;
pos = pos / w;
set_drag(PART:"terminology.voldrag", pos, 0.0);
emit("vol,drag", "");
}
}
}
}

@ -2550,7 +2550,7 @@ target: "4.bottom"
}
}
part { name: "posline";
mouse_events: 0;
mouse_events: 1;
repeat_events: 1;
clip_to: "media_clip";
description { state: "default" 0.0;
@ -2565,7 +2565,7 @@ target: "4.bottom"
}
}
part { name: "terminology.posdrag";
mouse_events: 1;
mouse_events: 0;
repeat_events: 1;
clip_to: "media_clip";
dragable {
@ -2583,7 +2583,7 @@ target: "4.bottom"
}
}
part { name: "volline";
mouse_events: 0;
mouse_events: 1;
repeat_events: 1;
clip_to: "media_clip";
description { state: "default" 0.0;
@ -2603,7 +2603,7 @@ target: "4.bottom"
}
}
part { name: "terminology.voldrag"; type: IMAGE;
mouse_events: 1;
mouse_events: 0;
repeat_events: 1;
clip_to: "media_clip";
dragable {
@ -2677,6 +2677,74 @@ target: "4.bottom"
action: STATE_SET "default" 0.0;
target: "terminology.voldrag";
}
program { name: "media_pos_drag_start";
signal: "mouse,down,1"; source: "posline";
filter: "terminology.posdrag" "default";
script {
new x, y, w, h, m_x, m_y;
new Float:pos;
get_geometry(PART:"posline", x, y, w, h);
get_mouse(m_x, m_y);
pos = m_x - x;
pos = pos / w;
set_drag(PART:"terminology.posdrag", pos, 0.0);
emit("pos,drag,start", "");
}
}
program { name: "media_pos_drag_stop";
signal: "mouse,up,1"; source: "posline";
action: SIGNAL_EMIT "pos,drag,stop" "";
}
program { name: "media_pos_drag";
signal: "mouse,move"; source: "posline";
script {
new x, y, w, h, m_x, m_y;
new Float:pos;
if (!get_mouse_buttons()) return;
get_geometry(PART:"posline", x, y, w, h);
get_mouse(m_x, m_y);
pos = m_x - x;
pos = pos / w;
set_drag(PART:"terminology.posdrag", pos, 0.0);
emit("pos,drag", "");
}
}
program { name: "media_vol_drag_start";
signal: "mouse,down,1"; source: "volline";
filter: "terminology.voldrag" "default";
script {
new x, y, w, h, m_x, m_y;
new Float:pos;
get_geometry(PART:"volline", x, y, w, h);
get_mouse(m_x, m_y);
pos = m_x - x;
pos = pos / w;
set_drag(PART:"terminology.voldrag", pos, 0.0);
emit("vol,drag", "");
}
}
program { name: "media_vol_drag";
signal: "mouse,move"; source: "volline";
script {
new x, y, w, h, m_x, m_y;
new Float:pos;
if (!get_mouse_buttons()) return;
get_geometry(PART:"volline", x, y, w, h);
get_mouse(m_x, m_y);
pos = m_x - x;
pos = pos / w;
set_drag(PART:"terminology.voldrag", pos, 0.0);
emit("vol,drag", "");
}
}
}
}

@ -41,6 +41,7 @@ struct _Media
Eina_Bool nosmooth : 1;
Eina_Bool downloading : 1;
Eina_Bool queued : 1;
Eina_Bool pos_drag : 1;
};
static Evas_Smart *_smart = NULL;
@ -572,6 +573,7 @@ _cb_mov_frame_decode(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_
evas_object_show(sd->clip);
_type_mov_calc(data, ox, oy, ow, oh);
if (sd->pos_drag) return;
len = emotion_object_play_length_get(sd->o_img);
pos = emotion_object_position_get(sd->o_img);
pos /= len;
@ -664,6 +666,28 @@ _cb_media_vol(void *data, Evas_Object *obj EINA_UNUSED, const char *emission EIN
media_volume_set(data, vx + vy);
}
static void
_cb_media_pos_drag_start(void *data, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
{
double vx, vy;
Media *sd = evas_object_smart_data_get(data);
if (!sd) return;
sd->pos_drag = 1;
edje_object_part_drag_value_get(sd->o_ctrl, "terminology.posdrag", &vx, &vy);
media_position_set(data, vx + vy);
}
static void
_cb_media_pos_drag_stop(void *data, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
{
double pos, len;
Media *sd = evas_object_smart_data_get(data);
if (!sd || !sd->pos_drag) return;
sd->pos_drag = 0;
len = emotion_object_play_length_get(sd->o_img);
pos = emotion_object_position_get(sd->o_img);
pos /= len;
edje_object_part_drag_value_set(sd->o_ctrl, "terminology.posdrag", pos, pos);
}
static void
_cb_media_pos(void *data, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
{
@ -736,9 +760,13 @@ _type_mov_init(Evas_Object *obj)
_cb_media_pause, obj);
edje_object_signal_callback_add(o, "stop", "",
_cb_media_stop, obj);
edje_object_signal_callback_add(o, "drag", "terminology.posdrag",
edje_object_signal_callback_add(o, "pos,drag,start", "",
_cb_media_pos_drag_start, obj);
edje_object_signal_callback_add(o, "pos,drag,stop", "",
_cb_media_pos_drag_stop, obj);
edje_object_signal_callback_add(o, "pos,drag", "",
_cb_media_pos, obj);
edje_object_signal_callback_add(o, "drag", "terminology.voldrag",
edje_object_signal_callback_add(o, "vol,drag", "",
_cb_media_vol, obj);
/* TODO where to stack the object in the ui? controls cannot be part of
* the 'media smart obj' becouse controls need to be on top of the term obj.

Loading…
Cancel
Save