}
}
}
-
+
+//////////////////////////////////////////////////////////////////////////////
+ //// the multimedia controls
+ group { name: "terminology/mediactrl";
+ images {
+ image: "media_bg.png" COMP;
+ image: "media_play.png" COMP;
+ image: "media_stop.png" COMP;
+ image: "media_pause.png" COMP;
+ image: "media_line.png" COMP;
+ }
+ parts {
+ part { name: "media_clip"; type: RECT;
+ mouse_events: 0;
+ description { state: "default" 0.0;
+ rel1.to: "media_bg";
+ rel2.to: "media_bg";
+ }
+ }
+ part { name: "media_bg";
+ clip_to: "media_clip";
+ description { state: "default" 0.0;
+ image.normal: "media_bg.png";
+ image.border: 11 11 11 11;
+ max: 24 24;
+ align: 0.0 1.0;
+ }
+ description { state: "expanded" 0.0;
+ inherit: "default" 0.0;
+ min: 200 24;
+ max: 200 24;
+ }
+ }
+ part { name: "play";
+ mouse_events: 1;
+ repeat_events: 1;
+ clip_to: "media_clip";
+ description { state: "default" 0.0;
+ image.normal: "media_pause.png";
+ max: 24 24;
+ align: 0.0 1.0;
+ }
+ description { state: "paused" 0.0;
+ inherit: "default" 0.0;
+ image.normal: "media_play.png";
+ }
+ }
+ part { name: "stop";
+ mouse_events: 1;
+ repeat_events: 1;
+ clip_to: "media_clip";
+ description { state: "default" 0.0;
+ image.normal: "media_stop.png";
+ max: 24 24;
+ rel1.to: "play";
+ rel2.to: "play";
+ rel1.offset: 16 0;
+ rel2.offset: 16 0;
+ }
+ }
+ part { name: "volline";
+ mouse_events: 0;
+ repeat_events: 1;
+ clip_to: "media_clip";
+ description { state: "default" 0.0;
+ image.normal: "media_line.png";
+ min: 150 10;
+ max: 150 10;
+ rel1.to: "stop";
+ rel2.to: "stop";
+ rel1.offset: 25 0;
+ rel2.offset: 150 0;
+ }
+ }
+ part { name: "terminology.voldrag"; type: RECT;
+ mouse_events: 1;
+ repeat_events: 1;
+ clip_to: "media_clip";
+ dragable {
+ confine: "volline";
+ x: 1 1 0;
+ y: 0 0 0;
+ }
+ description { state: "default" 0.0;
+ color: 255 0 0 150;
+ min: 10 10;
+ max: 10 10;
+ }
+ description { state: "muted" 0.0;
+ visible: 0;
+ }
+ }
+ programs {
+ program { name: "media_mouse_in";
+ signal: "mouse,in";
+ source: "media_bg";
+ action: STATE_SET "expanded" 0.0;
+ transition: SINUSOIDAL 0.4 CURRENT;
+ target: "media_bg";
+ }
+ program { name: "media_mouse_out";
+ signal: "mouse,out";
+ source: "media_bg";
+ action: STATE_SET "default" 0.0;
+ transition: SINUSOIDAL 0.4 CURRENT;
+ target: "media_bg";
+ }
+ program { name: "media_pause_click";
+ signal: "mouse,up,*";
+ source: "play";
+ filter: "play" "default";
+ action: SIGNAL_EMIT "pause" "";
+ }
+ program { name: "media_play_click";
+ signal: "mouse,up,1";
+ source: "play";
+ filter: "play" "paused";
+ action: SIGNAL_EMIT "play" "";
+ }
+ program { name: "media_stop_click";
+ signal: "mouse,up,1";
+ source: "stop";
+ action: SIGNAL_EMIT "stop" "";
+ }
+ program { name: "media_signal_pause";
+ signal: "pause,set";
+ source: "terminology";
+ action: STATE_SET "paused" 0.0;
+ target: "play";
+ }
+ program { name: "media_signal_play";
+ signal: "play,set";
+ source: "terminology";
+ action: STATE_SET "default" 0.0;
+ target: "play";
+ }
+ program { name: "media_signal_mute";
+ signal: "mute,set";
+ source: "terminology";
+ action: STATE_SET "muted" 0.0;
+ target: "terminology.voldrag";
+ }
+ program { name: "media_signal_unmute";
+ signal: "mute,unset";
+ source: "terminology";
+ action: STATE_SET "default" 0.0;
+ target: "terminology.voldrag";
+ }
+ }
+ }
+ }
//////////////////////////////////////////////////////////////////////////////
//// used in the font selection dialog to give a base for black text
//// previews so they are always visible
struct _Media
{
Evas_Object_Smart_Clipped_Data __clipped_data;
- Evas_Object *clip, *o_img, *o_tmp;
+ Evas_Object *clip, *o_img, *o_tmp, *o_ctrl;
Ecore_Timer *anim;
Ecore_Job *restart_job;
const char *src;
}
static void
+_cb_media_play(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ media_play_set(data, EINA_TRUE);
+}
+
+static void
+_cb_media_pause(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ media_play_set(data, EINA_FALSE);
+}
+
+static void
+_cb_media_stop(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ media_play_set(data, EINA_FALSE);
+ media_position_set(data, 0.0);
+}
+
+static void
+_cb_media_vol(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ double vx, vy;
+ Media *sd = evas_object_smart_data_get(data);
+ if (!sd) return;
+ edje_object_part_drag_value_get(sd->o_ctrl, "terminology.voldrag", &vx, &vy);
+ media_volume_set(data, vx + vy);
+}
+
+static void
_type_mov_init(Evas_Object *obj)
{
Evas_Object *o;
+ double vol;
char *modules[] =
{
NULL,
emotion_object_file_set(o, sd->src);
evas_object_smart_member_add(o, obj);
evas_object_clip_set(o, sd->clip);
- emotion_object_position_set(o, 0.0);
- emotion_object_play_set(o, EINA_TRUE);
- if (sd->config->mute) emotion_object_audio_mute_set(o, EINA_TRUE);
+
+ o = sd->o_ctrl = edje_object_add(evas_object_evas_get(obj));
+ theme_apply(o, sd->config, "terminology/mediactrl");
+ vol = emotion_object_audio_volume_get(sd->o_img);
+ edje_object_part_drag_value_set(o, "terminology.voldrag", vol, vol);
+ edje_object_signal_callback_add(o, "play", "", _cb_media_play, obj);
+ edje_object_signal_callback_add(o, "pause", "", _cb_media_pause, obj);
+ edje_object_signal_callback_add(o, "stop", "", _cb_media_stop, obj);
+ edje_object_signal_callback_add(o, "drag", "terminology.voldrag", _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.
+ *
+ * I think we need to swallow inside the bg object. but how to
+ * retrive the edje bg object from here?
+ * */
+ evas_object_show(o);
+
+ media_position_set(obj, 0.0);
+ media_play_set(obj, EINA_TRUE);
+ if (sd->config->mute) media_mute_set(obj, EINA_TRUE);
}
static void
{
Media *sd = evas_object_smart_data_get(obj);
if (!sd) return;
+
+ evas_object_move(sd->o_ctrl, x, y);
+ evas_object_resize(sd->o_ctrl, w, h);
+
emotion_object_size_get(sd->o_img, &(sd->iw), &(sd->ih));
if ((w <= 0) || (h <= 0) || (sd->iw <= 0) || (sd->ih <= 0))
{
if (sd->clip) evas_object_del(sd->clip);
if (sd->o_img) evas_object_del(sd->o_img);
if (sd->o_tmp) evas_object_del(sd->o_tmp);
+ if (sd->o_ctrl) evas_object_del(sd->o_ctrl);
if (sd->anim) ecore_timer_del(sd->anim);
if (sd->restart_job) ecore_job_del(sd->restart_job);
_meida_sc.del(obj);
media_mute_set(Evas_Object *obj, Eina_Bool mute)
{
Media *sd = evas_object_smart_data_get(obj);
- if (!sd) return;
- if (sd->type != TYPE_MOV) return;
+ if ((!sd) || (sd->type != TYPE_MOV)) return;
emotion_object_audio_mute_set(sd->o_img, mute);
+ if (mute)
+ edje_object_signal_emit(sd->o_ctrl, "mute,set", "terminology");
+ else
+ edje_object_signal_emit(sd->o_ctrl, "mute,unset", "terminology");
+}
+
+void
+media_play_set(Evas_Object *obj, Eina_Bool play)
+{
+ Media *sd = evas_object_smart_data_get(obj);
+ if ((!sd) || (sd->type != TYPE_MOV)) return;
+ emotion_object_play_set(sd->o_img, play);
+ if (play)
+ edje_object_signal_emit(sd->o_ctrl, "play,set", "terminology");
+ else
+ edje_object_signal_emit(sd->o_ctrl, "pause,set", "terminology");
+}
+
+void
+media_position_set(Evas_Object *obj, double pos)
+{
+ Media *sd = evas_object_smart_data_get(obj);
+ if ((!sd) || (sd->type != TYPE_MOV)) return;
+ emotion_object_position_set(sd->o_img, pos);
+ edje_object_part_drag_value_set(sd->o_ctrl, "terminology.posdrag", pos, pos);
+}
+
+void
+media_volume_set(Evas_Object *obj, double vol)
+{
+ Media *sd = evas_object_smart_data_get(obj);
+ if ((!sd) || (sd->type != TYPE_MOV)) return;
+ emotion_object_audio_volume_set(sd->o_img, vol);
+ edje_object_part_drag_value_set(sd->o_ctrl, "terminology.voldrag", vol, vol);
}