summaryrefslogtreecommitdiff
path: root/src/tests/emotion/emotion_test_main-eo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/emotion/emotion_test_main-eo.c')
-rw-r--r--src/tests/emotion/emotion_test_main-eo.c150
1 files changed, 66 insertions, 84 deletions
diff --git a/src/tests/emotion/emotion_test_main-eo.c b/src/tests/emotion/emotion_test_main-eo.c
index 4efbfc9..f88e045 100644
--- a/src/tests/emotion/emotion_test_main-eo.c
+++ b/src/tests/emotion/emotion_test_main-eo.c
@@ -76,7 +76,7 @@ static const char *theme_file = NULL;
76static void 76static void
77bg_resize(Evas_Coord w, Evas_Coord h) 77bg_resize(Evas_Coord w, Evas_Coord h)
78{ 78{
79 eo_do(o_bg, efl_gfx_size_set(w, h)); 79 efl_gfx_size_set(o_bg, w, h);
80} 80}
81 81
82static void 82static void
@@ -84,8 +84,7 @@ main_resize(Ecore_Evas *ee)
84{ 84{
85 Evas_Coord w, h; 85 Evas_Coord w, h;
86 86
87 eo_do(ecore_evas_get(ee), 87 evas_canvas_output_viewport_get(ecore_evas_get(ee), NULL, NULL, &w, &h);
88 evas_canvas_output_viewport_get(NULL, NULL, &w, &h));
89 bg_resize(w, h); 88 bg_resize(w, h);
90} 89}
91 90
@@ -113,15 +112,13 @@ static void
113bg_setup(void) 112bg_setup(void)
114{ 113{
115 o_bg = eo_add(EDJE_OBJECT_CLASS, evas); 114 o_bg = eo_add(EDJE_OBJECT_CLASS, evas);
116 eo_do(o_bg, efl_file_set(theme_file, "background"), 115 efl_file_set(o_bg, theme_file, "background");
117 efl_gfx_position_set(0, 0), 116 efl_gfx_position_set(o_bg, 0, 0);
118 efl_gfx_size_set(startw, starth), 117 efl_gfx_size_set(o_bg, startw, starth);
119 efl_gfx_stack_layer_set(-999), 118 efl_gfx_stack_layer_set(o_bg, -999);
120 efl_gfx_visible_set(EINA_TRUE), 119 efl_gfx_visible_set(o_bg, EINA_TRUE);
121 evas_obj_focus_set(EINA_TRUE), 120 evas_obj_focus_set(o_bg, EINA_TRUE);
122 121 eo_event_callback_add(o_bg, EVAS_OBJECT_EVENT_KEY_DOWN, bg_key_down, NULL);
123 eo_event_callback_add(EVAS_OBJECT_EVENT_KEY_DOWN,
124 bg_key_down, NULL));
125} 122}
126 123
127static void 124static void
@@ -309,7 +306,7 @@ video_obj_time_changed(Evas_Object *obj, Evas_Object *edje)
309 pos = emotion_object_position_get(obj); 306 pos = emotion_object_position_get(obj);
310 len = emotion_object_play_length_get(obj); 307 len = emotion_object_play_length_get(obj);
311 scale = (len > 0.0) ? pos / len : 0.0; 308 scale = (len > 0.0) ? pos / len : 0.0;
312 eo_do(edje, edje_obj_part_drag_value_set("video_progress", scale, 0.0)); 309 edje_obj_part_drag_value_set(edje, "video_progress", scale, 0.0);
313 310
314 lh = len / 3600; 311 lh = len / 3600;
315 lm = len / 60 - (lh * 60); 312 lm = len / 60 - (lh * 60);
@@ -323,7 +320,7 @@ video_obj_time_changed(Evas_Object *obj, Evas_Object *edje)
323 320
324 snprintf(buf, sizeof(buf), "%i:%02i:%02i.%02i / %i:%02i:%02i", 321 snprintf(buf, sizeof(buf), "%i:%02i:%02i.%02i / %i:%02i:%02i",
325 ph, pm, ps, pf, lh, lm, ls); 322 ph, pm, ps, pf, lh, lm, ls);
326 eo_do(edje, edje_obj_part_text_set("video_progress_txt", buf)); 323 edje_obj_part_text_set(edje, "video_progress_txt", buf);
327} 324}
328 325
329static Eina_Bool 326static Eina_Bool
@@ -356,12 +353,11 @@ video_obj_frame_resize_cb(void *data, const Eo_Event *event)
356 printf("HANDLE %ix%i @ %3.3f\n", iw, ih, ratio); 353 printf("HANDLE %ix%i @ %3.3f\n", iw, ih, ratio);
357 if (ratio > 0.0) iw = (ih * ratio) + 0.5; 354 if (ratio > 0.0) iw = (ih * ratio) + 0.5;
358 evas_object_size_hint_min_set(event->obj, iw, ih); 355 evas_object_size_hint_min_set(event->obj, iw, ih);
359 eo_do(oe, edje_obj_part_swallow( "video_swallow", event->obj), 356 edje_obj_part_swallow(oe, "video_swallow", event->obj);
360 edje_obj_size_min_calc(&w, &h), 357 edje_obj_size_min_calc(oe, &w, &h);
361 efl_gfx_size_set(w, h) 358 efl_gfx_size_set(oe, w, h);
362 ); 359 evas_obj_size_hint_min_set(event->obj, 0, 0);
363 eo_do(event->obj, evas_obj_size_hint_min_set(0, 0)); 360 edje_obj_part_swallow(oe, "video_swallow", event->obj);
364 eo_do(oe, edje_obj_part_swallow( "video_swallow", event->obj));
365 361
366 return EINA_TRUE; 362 return EINA_TRUE;
367} 363}
@@ -459,7 +455,7 @@ video_obj_signal_play_cb(void *data, Evas_Object *o, const char *emission EINA_U
459{ 455{
460 Evas_Object *ov = data; 456 Evas_Object *ov = data;
461 emotion_object_play_set(ov, EINA_TRUE); 457 emotion_object_play_set(ov, EINA_TRUE);
462 eo_do(o, edje_obj_signal_emit("video_state", "play")); 458 edje_obj_signal_emit(o, "video_state", "play");
463} 459}
464 460
465static void 461static void
@@ -467,7 +463,7 @@ video_obj_signal_pause_cb(void *data, Evas_Object *o, const char *emission EINA_
467{ 463{
468 Evas_Object *ov = data; 464 Evas_Object *ov = data;
469 emotion_object_play_set(ov, EINA_FALSE); 465 emotion_object_play_set(ov, EINA_FALSE);
470 eo_do(o, edje_obj_signal_emit("video_state", "pause")); 466 edje_obj_signal_emit(o, "video_state", "pause");
471} 467}
472 468
473static void 469static void
@@ -476,7 +472,7 @@ video_obj_signal_stop_cb(void *data, Evas_Object *o, const char *emission EINA_U
476 Evas_Object *ov = data; 472 Evas_Object *ov = data;
477 emotion_object_play_set(ov, EINA_FALSE); 473 emotion_object_play_set(ov, EINA_FALSE);
478 emotion_object_position_set(ov, 0.0); 474 emotion_object_position_set(ov, 0.0);
479 eo_do(o, edje_obj_signal_emit("video_state", "stop")); 475 edje_obj_signal_emit(o, "video_state", "stop");
480} 476}
481 477
482static void 478static void
@@ -486,7 +482,7 @@ video_obj_signal_jump_cb(void *data, Evas_Object *o, const char *emission EINA_U
486 double len; 482 double len;
487 double x, y; 483 double x, y;
488 484
489 eo_do(o, edje_obj_part_drag_value_get(source, &x, &y)); 485 edje_obj_part_drag_value_get(o, source, &x, &y);
490 len = emotion_object_play_length_get(ov); 486 len = emotion_object_play_length_get(ov);
491 emotion_object_position_set(ov, x * len); 487 emotion_object_position_set(ov, x * len);
492} 488}
@@ -499,11 +495,11 @@ video_obj_signal_alpha_cb(void *data, Evas_Object *o, const char *emission EINA_
499 double x, y; 495 double x, y;
500 char buf[256]; 496 char buf[256];
501 497
502 eo_do(o, edje_obj_part_drag_value_get(source, &x, &y)); 498 edje_obj_part_drag_value_get(o, source, &x, &y);
503 alpha = 255 * y; 499 alpha = 255 * y;
504 eo_do(ov, efl_gfx_color_set(alpha, alpha, alpha, alpha)); 500 efl_gfx_color_set(ov, alpha, alpha, alpha, alpha);
505 snprintf(buf, sizeof(buf), "alpha %.0f", alpha); 501 snprintf(buf, sizeof(buf), "alpha %.0f", alpha);
506 eo_do(o, edje_obj_part_text_set("video_alpha_txt", buf)); 502 edje_obj_part_text_set(o, "video_alpha_txt", buf);
507} 503}
508 504
509static void 505static void
@@ -513,10 +509,10 @@ video_obj_signal_vol_cb(void *data, Evas_Object *o, const char *emission EINA_UN
513 double vol; 509 double vol;
514 char buf[256]; 510 char buf[256];
515 511
516 eo_do(o, edje_obj_part_drag_value_get(source, NULL, &vol)); 512 edje_obj_part_drag_value_get(o, source, NULL, &vol);
517 emotion_object_audio_volume_set(ov, vol); 513 emotion_object_audio_volume_set(ov, vol);
518 snprintf(buf, sizeof(buf), "vol %.2f", vol); 514 snprintf(buf, sizeof(buf), "vol %.2f", vol);
519 eo_do(o, edje_obj_part_text_set("video_volume_txt", buf)); 515 edje_obj_part_text_set(o, "video_volume_txt", buf);
520} 516}
521 517
522static void 518static void
@@ -525,14 +521,13 @@ video_obj_signal_frame_move_start_cb(void *data EINA_UNUSED, Evas_Object *o, con
525 Frame_Data *fd; 521 Frame_Data *fd;
526 Evas_Coord x, y; 522 Evas_Coord x, y;
527 523
528 eo_do(o, fd = eo_key_data_get("frame_data")); 524 fd = eo_key_data_get(o, "frame_data");
529 if (!fd) return; 525 if (!fd) return;
530 fd->moving = 1; 526 fd->moving = 1;
531 eo_do(evas_object_evas_get(o), 527 evas_canvas_pointer_canvas_xy_get(evas_object_evas_get(o), &x, &y);
532 evas_canvas_pointer_canvas_xy_get(&x, &y));
533 fd->x = x; 528 fd->x = x;
534 fd->y = y; 529 fd->y = y;
535 eo_do(o, efl_gfx_stack_raise()); 530 efl_gfx_stack_raise(o);
536} 531}
537 532
538static void 533static void
@@ -540,7 +535,7 @@ video_obj_signal_frame_move_stop_cb(void *data EINA_UNUSED, Evas_Object *o, cons
540{ 535{
541 Frame_Data *fd; 536 Frame_Data *fd;
542 537
543 eo_do(o, fd = eo_key_data_get("frame_data")); 538 fd = eo_key_data_get(o, "frame_data");
544 if (!fd) return; 539 if (!fd) return;
545 fd->moving = 0; 540 fd->moving = 0;
546} 541}
@@ -551,14 +546,13 @@ video_obj_signal_frame_resize_start_cb(void *data EINA_UNUSED, Evas_Object *o, c
551 Frame_Data *fd; 546 Frame_Data *fd;
552 Evas_Coord x, y; 547 Evas_Coord x, y;
553 548
554 eo_do(o, fd = eo_key_data_get("frame_data")); 549 fd = eo_key_data_get(o, "frame_data");
555 if (!fd) return; 550 if (!fd) return;
556 fd->resizing = 1; 551 fd->resizing = 1;
557 eo_do(evas_object_evas_get(o), 552 evas_canvas_pointer_canvas_xy_get(evas_object_evas_get(o), &x, &y);
558 evas_canvas_pointer_canvas_xy_get(&x, &y));
559 fd->x = x; 553 fd->x = x;
560 fd->y = y; 554 fd->y = y;
561 eo_do(o, efl_gfx_stack_raise()); 555 efl_gfx_stack_raise(o);
562} 556}
563 557
564static void 558static void
@@ -566,7 +560,7 @@ video_obj_signal_frame_resize_stop_cb(void *data EINA_UNUSED, Evas_Object *o, co
566{ 560{
567 Frame_Data *fd; 561 Frame_Data *fd;
568 562
569 eo_do(o, fd = eo_key_data_get("frame_data")); 563 fd = eo_key_data_get(o, "frame_data");
570 if (!fd) return; 564 if (!fd) return;
571 fd->resizing = 0; 565 fd->resizing = 0;
572} 566}
@@ -576,18 +570,15 @@ video_obj_signal_frame_move_cb(void *data EINA_UNUSED, Evas_Object *o, const cha
576{ 570{
577 Frame_Data *fd; 571 Frame_Data *fd;
578 572
579 eo_do(o, fd = eo_key_data_get("frame_data")); 573 fd = eo_key_data_get(o, "frame_data");
580 if (!fd) return; 574 if (!fd) return;
581 if (fd->moving) 575 if (fd->moving)
582 { 576 {
583 Evas_Coord x, y, ox, oy; 577 Evas_Coord x, y, ox, oy;
584 578
585 eo_do(evas_object_evas_get(o), 579 evas_canvas_pointer_canvas_xy_get(evas_object_evas_get(o), &x, &y);
586 evas_canvas_pointer_canvas_xy_get(&x, &y)); 580 efl_gfx_position_get(o, &ox, &oy);
587 eo_do(o, 581 efl_gfx_position_set(o, ox + (x - fd->x), oy + (y - fd->y));
588 efl_gfx_position_get(&ox, &oy),
589 efl_gfx_position_set(ox + (x - fd->x), oy + (y - fd->y))
590 );
591 fd->x = x; 582 fd->x = x;
592 fd->y = y; 583 fd->y = y;
593 } 584 }
@@ -595,9 +586,8 @@ video_obj_signal_frame_move_cb(void *data EINA_UNUSED, Evas_Object *o, const cha
595 { 586 {
596 Evas_Coord x, y, ow, oh; 587 Evas_Coord x, y, ow, oh;
597 588
598 eo_do(evas_object_evas_get(o), 589 evas_canvas_pointer_canvas_xy_get(evas_object_evas_get(o), &x, &y);
599 evas_canvas_pointer_canvas_xy_get(&x, &y)); 590 efl_gfx_size_get(o, &ow, &oh);
600 eo_do(o, efl_gfx_size_get(&ow, &oh));
601 evas_object_resize(o, ow + (x - fd->x), oh + (y - fd->y)); 591 evas_object_resize(o, ow + (x - fd->x), oh + (y - fd->y));
602 fd->x = x; 592 fd->x = x;
603 fd->y = y; 593 fd->y = y;
@@ -650,43 +640,35 @@ init_video_object(const char *module_filename, const char *filename)
650 if (!fd) exit(1); 640 if (!fd) exit(1);
651 641
652 oe = eo_add(EDJE_OBJECT_CLASS, evas); 642 oe = eo_add(EDJE_OBJECT_CLASS, evas);
653 eo_do(oe, 643 eo_event_callback_add(oe, EVAS_OBJECT_EVENT_FREE, _oe_free_cb, fd);
654 eo_event_callback_add(EVAS_OBJECT_EVENT_FREE, _oe_free_cb, fd), 644 eo_key_data_set(oe, "frame_data", fd);
655 eo_key_data_set("frame_data", fd), 645 efl_file_set(oe, theme_file, reflex ? "video_controller/reflex" : "video_controller");
656 efl_file_set(theme_file, 646 edje_obj_part_swallow(oe, "video_swallow", o);
657 reflex ? "video_controller/reflex" : "video_controller"),
658 edje_obj_part_swallow("video_swallow", o));
659 647
660 offset = 20 * (eina_list_count(video_objs) - 1); 648 offset = 20 * (eina_list_count(video_objs) - 1);
661 eo_do(oe, 649 efl_gfx_position_set(oe, offset, offset);
662 efl_gfx_position_set(offset, offset), 650 edje_obj_size_min_calc(oe, &w, &h);
663 edje_obj_size_min_calc(&w, &h), 651 efl_gfx_size_set(oe, w, h);
664 efl_gfx_size_set(w, h)); 652
665 653 eo_event_callback_array_add(o, emotion_object_test_callbacks, oe);
666 eo_do(o, eo_event_callback_array_add(emotion_object_test_callbacks, oe)); 654
667 655 edje_obj_signal_callback_add(oe, "video_control", "play", video_obj_signal_play_cb, o);
668 eo_do(oe, 656 edje_obj_signal_callback_add(oe, "video_control", "pause", video_obj_signal_pause_cb, o);
669 edje_obj_signal_callback_add("video_control", "play", video_obj_signal_play_cb, o), 657 edje_obj_signal_callback_add(oe, "video_control", "stop", video_obj_signal_stop_cb, o);
670 edje_obj_signal_callback_add("video_control", "pause", video_obj_signal_pause_cb, o), 658 edje_obj_signal_callback_add(oe, "drag", "video_progress", video_obj_signal_jump_cb, o);
671 edje_obj_signal_callback_add("video_control", "stop", video_obj_signal_stop_cb, o), 659 edje_obj_signal_callback_add(oe, "drag", "video_alpha", video_obj_signal_alpha_cb, o);
672 edje_obj_signal_callback_add("drag", "video_progress", video_obj_signal_jump_cb, o), 660 edje_obj_signal_callback_add(oe, "drag", "video_volume", video_obj_signal_vol_cb, o);
673 edje_obj_signal_callback_add("drag", "video_alpha", video_obj_signal_alpha_cb, o), 661 edje_obj_signal_callback_add(oe, "frame_move", "start", video_obj_signal_frame_move_start_cb, oe);
674 edje_obj_signal_callback_add("drag", "video_volume", video_obj_signal_vol_cb, o), 662 edje_obj_signal_callback_add(oe, "frame_move", "stop", video_obj_signal_frame_move_stop_cb, oe);
675 663 edje_obj_signal_callback_add(oe, "frame_resize", "start", video_obj_signal_frame_resize_start_cb, oe);
676 edje_obj_signal_callback_add("frame_move", "start", video_obj_signal_frame_move_start_cb, oe), 664 edje_obj_signal_callback_add(oe, "frame_resize", "stop", video_obj_signal_frame_resize_stop_cb, oe);
677 edje_obj_signal_callback_add("frame_move", "stop", video_obj_signal_frame_move_stop_cb, oe), 665 edje_obj_signal_callback_add(oe, "mouse, move", "*", video_obj_signal_frame_move_cb, oe);
678 edje_obj_signal_callback_add("frame_resize", "start", video_obj_signal_frame_resize_start_cb, oe), 666 edje_obj_part_drag_value_set(oe, "video_alpha", 0.0, 1.0);
679 edje_obj_signal_callback_add("frame_resize", "stop", video_obj_signal_frame_resize_stop_cb, oe), 667 edje_obj_part_text_set(oe, "video_alpha_txt", "alpha 255");
680 edje_obj_signal_callback_add("mouse,move", "*", video_obj_signal_frame_move_cb, oe), 668 edje_obj_part_drag_value_set(oe, "video_volume", 0.0, 0.5);
681 669 edje_obj_part_text_set(oe, "video_volume_txt", "vol 0.50");
682 edje_obj_part_drag_value_set("video_alpha", 0.0, 1.0), 670 edje_obj_signal_emit(oe, "video_state", "play");
683 edje_obj_part_text_set("video_alpha_txt", "alpha 255"), 671 efl_gfx_visible_set(oe, EINA_TRUE);
684 edje_obj_part_drag_value_set("video_volume", 0.0, 0.5),
685 edje_obj_part_text_set("video_volume_txt", "vol 0.50"),
686
687 edje_obj_signal_emit("video_state", "play"),
688
689 efl_gfx_visible_set(EINA_TRUE));
690} 672}
691 673
692int 674int