davemds pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=2ed26fed596456f144700d8a45b89484bda1d16c

commit 2ed26fed596456f144700d8a45b89484bda1d16c
Author: davemds <[email protected]>
Date:   Sun Feb 16 15:32:59 2014 +0100

    Emotion test: New volume slider. More readable alpha text.
---
 src/tests/emotion/data/theme.edc      | 67 ++++++++++++++++++++++++++++++-----
 src/tests/emotion/emotion_test_main.c | 24 ++++++++++---
 2 files changed, 79 insertions(+), 12 deletions(-)

diff --git a/src/tests/emotion/data/theme.edc b/src/tests/emotion/data/theme.edc
index 0a4b1f6..2a50c09 100644
--- a/src/tests/emotion/data/theme.edc
+++ b/src/tests/emotion/data/theme.edc
@@ -647,11 +647,13 @@ collections {
          // 
          // need txt parts:
          // "video_speed_txt"
+         // "video_volume_txt"
          // "video_progress_txt"
          // 
          // need dragables:
          // "video_progress" horizontal
          // "video_speed" vertical
+         // "video_volume" vertical
          part { name: "video_swallow"; mouse_events: 0; type: SWALLOW;
             description { state: "default" 0.0;
                rel1 {
@@ -735,24 +737,35 @@ collections {
          part { name: "video_speed_txt"; type: TEXT; mouse_events: 0;
             description { state: "default" 0.0;
                rel1 {
-                  to:       "video_frame_bottom";
-                  relative: 0.0  0.0;
-                  offset:   0    8;
+                  to:       "video_frame_top";
                }
                rel2 {
-                  to:       "video_frame_bottom";
-                  relative: 1.0  1.0;
-                  offset:   -1   -13;
+                  to:       "video_frame_top";
                }
                color:       0 0 0 255;
                text {
-                  text: "Video Speed";
                   font: "Sans";
-                  size: 6;
+                  size: 8;
                   align: 1.0 0.5;
                };
             }
          }
+         part { name: "video_volume_txt"; type: TEXT; mouse_events: 0;
+            description { state: "default" 0.0;
+               rel1 {
+                  to:       "video_frame_top";
+               }
+               rel2 {
+                  to:       "video_frame_top";
+               }
+               color:       0 0 0 255;
+               text {
+                  font: "Sans";
+                  size: 8;
+                  align: 0.0 0.5;
+               };
+            }
+         }
          part { name: "video_progress_confine"; mouse_events: 0; type:  RECT;
             description { state: "default" 0.0;
                fixed: 1 1;
@@ -851,6 +864,43 @@ collections {
                }
             }
          }
+         part { name: "video_volume_confine"; mouse_events: 0; type:  RECT;
+            description { state: "default" 0.0;
+               rel1 {
+                  to:       "video_frame_left";
+                  offset:   10    24;
+               }
+               rel2 {
+                  to:       "video_frame_left";
+                  offset:   0   -48;
+               }
+               color: 0 0 0 0;
+            }
+         }
+         part { name: "video_volume"; mouse_events: 1;
+            dragable {
+               x:        0 0 0;
+               y:        -1 1 0;
+               confine: "video_volume_confine";
+            }
+            description { state: "default" 0.0;
+               fixed: 1 1;
+               min:   24 24;
+               rel1 {
+                  to:       "video_volume_confine";
+                  relative: 0.5  0.5;
+                  offset:   0    0;
+               }
+               rel2 {
+                  to:       "video_volume_confine";
+                  relative: 0.5  0.5;
+                  offset:   0    0;
+               }
+               image {
+                  normal: "knob.png";
+               }
+            }
+         }
          part { name: "video_play"; mouse_events: 1;
             description { state: "default" 0.0;
                fixed: 1 1;
@@ -969,6 +1019,7 @@ collections {
          // "video_control" "stop"
          // "drag" "video_progress"
          // "drag" "video_speed"
+         // "drag" "video_volume"
          // 
          // get signals:
          // "video_state" "play"
diff --git a/src/tests/emotion/emotion_test_main.c 
b/src/tests/emotion/emotion_test_main.c
index 2323e06..c2274a4 100644
--- a/src/tests/emotion/emotion_test_main.c
+++ b/src/tests/emotion/emotion_test_main.c
@@ -511,11 +511,24 @@ video_obj_signal_speed_cb(void *data, Evas_Object *o, 
const char *emission EINA_
    edje_object_part_drag_value_get(o, source, &x, &y);
    spd = 255 * y;
    evas_object_color_set(ov, spd, spd, spd, spd);
-   snprintf(buf, sizeof(buf), "%.0f", spd);
+   snprintf(buf, sizeof(buf), "alpha %.0f", spd);
    edje_object_part_text_set(o, "video_speed_txt", buf);
 }
 
 static void
+video_obj_signal_vol_cb(void *data, Evas_Object *o, const char *emission 
EINA_UNUSED, const char *source EINA_UNUSED)
+{
+   Evas_Object *ov = data;
+   double vol;
+   char buf[256];
+
+   edje_object_part_drag_value_get(o, source, NULL, &vol);
+   emotion_object_audio_volume_set(ov, vol);
+   snprintf(buf, sizeof(buf), "vol %.2f", vol);
+   edje_object_part_text_set(o, "video_volume_txt", buf);
+}
+
+static void
 video_obj_signal_frame_move_start_cb(void *data EINA_UNUSED, Evas_Object *o, 
const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
 {
    Frame_Data *fd;
@@ -605,11 +618,10 @@ init_video_object(const char *module_filename, const char 
*filename)
      return;
    emotion_object_vis_set(o, vis);
    if (!emotion_object_file_set(o, filename))
-     {
        return;
-     }
    emotion_object_last_position_load(o);
    emotion_object_play_set(o, 1);
+   emotion_object_audio_volume_set(o, 0.5);
    evas_object_move(o, 0, 0);
    evas_object_resize(o, 320, 240);
    emotion_object_smooth_scale_set(o, 1);
@@ -659,6 +671,7 @@ init_video_object(const char *module_filename, const char 
*filename)
    edje_object_signal_callback_add(oe, "video_control", "stop", 
video_obj_signal_stop_cb, o);
    edje_object_signal_callback_add(oe, "drag", "video_progress", 
video_obj_signal_jump_cb, o);
    edje_object_signal_callback_add(oe, "drag", "video_speed", 
video_obj_signal_speed_cb, o);
+   edje_object_signal_callback_add(oe, "drag", "video_volume", 
video_obj_signal_vol_cb, o);
 
    edje_object_signal_callback_add(oe, "frame_move", "start", 
video_obj_signal_frame_move_start_cb, oe);
    edje_object_signal_callback_add(oe, "frame_move", "stop", 
video_obj_signal_frame_move_stop_cb, oe);
@@ -667,7 +680,10 @@ init_video_object(const char *module_filename, const char 
*filename)
    edje_object_signal_callback_add(oe, "mouse,move", "*", 
video_obj_signal_frame_move_cb, oe);
 
    edje_object_part_drag_value_set(oe, "video_speed", 0.0, 1.0);
-   edje_object_part_text_set(oe, "video_speed_txt", "255");
+   edje_object_part_text_set(oe, "video_speed_txt", "alpha 255");
+
+   edje_object_part_drag_value_set(oe, "video_volume", 0.0, 0.5);
+   edje_object_part_text_set(oe, "video_volume_txt", "vol 0.50");
 
    edje_object_signal_emit(o, "video_state", "play");
 

-- 


Reply via email to