summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorRicardo de Almeida Gonzaga <ricardo@profusion.mobi>2012-10-19 18:50:38 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-10-19 18:50:38 +0000
commite46c4e83d5d9bf121400b0e64877173371a9d26d (patch)
tree6e91531e7ed9a8cafb7984fe7343d27b1be0d6b2 /legacy
parent1799e141b7af475965b5e5d7f2d20b821f6e7090 (diff)
ephysics: fine tunning on sandbox layout
Patch by: Ricardo de Almeida Gonzaga <ricardo@profusion.mobi> SVN revision: 78264
Diffstat (limited to 'legacy')
-rw-r--r--legacy/ephysics/src/bin/ephysics_sandbox.c92
1 files changed, 61 insertions, 31 deletions
diff --git a/legacy/ephysics/src/bin/ephysics_sandbox.c b/legacy/ephysics/src/bin/ephysics_sandbox.c
index e0da0f37b5..e9f13ffbab 100644
--- a/legacy/ephysics/src/bin/ephysics_sandbox.c
+++ b/legacy/ephysics/src/bin/ephysics_sandbox.c
@@ -499,14 +499,14 @@ _promote(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
499 499
500/*** Sandbox Widgets ***/ 500/*** Sandbox Widgets ***/
501static void 501static void
502_label_add(Evas_Object *bxparent, const char *subcategory) 502_label_add(Evas_Object *bxparent, const char *subcategory, float align)
503{ 503{
504 Evas_Object *label; 504 Evas_Object *label;
505 505
506 label = elm_label_add(bxparent); 506 label = elm_label_add(bxparent);
507 elm_object_text_set(label, subcategory); 507 elm_object_text_set(label, subcategory);
508 evas_object_size_hint_weight_set(label, 0.0, 0.0); 508 evas_object_size_hint_weight_set(label, 0.0, 0.0);
509 evas_object_size_hint_align_set(label, 0.5, 0.5); 509 evas_object_size_hint_align_set(label, align, 0.5);
510 elm_box_pack_end(bxparent, label); 510 elm_box_pack_end(bxparent, label);
511 evas_object_show(label); 511 evas_object_show(label);
512} 512}
@@ -518,14 +518,16 @@ _material_selector_add(Body_Data *bd, Evas_Object *bxparent)
518 518
519 box = elm_box_add(bxparent); 519 box = elm_box_add(bxparent);
520 elm_box_horizontal_set(box, EINA_TRUE); 520 elm_box_horizontal_set(box, EINA_TRUE);
521 elm_box_homogeneous_set(box, EINA_TRUE);
522 elm_box_padding_set(box, 25, 0);
521 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0); 523 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
522 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0); 524 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.0);
523 evas_object_show(box); 525 evas_object_show(box);
524 elm_box_pack_end(bxparent, box); 526 elm_box_pack_end(bxparent, box);
525 527
526 _label_add(box, "Body Material"); 528 _label_add(box, "Body Material", 1);
527 529
528 hv = elm_hoversel_add(bxparent); 530 hv = elm_hoversel_add(box);
529 elm_hoversel_hover_parent_set(hv, bd->wd->nf); 531 elm_hoversel_hover_parent_set(hv, bd->wd->nf);
530 elm_object_text_set(hv, materials[EPHYSICS_BODY_MATERIAL_CUSTOM]); 532 elm_object_text_set(hv, materials[EPHYSICS_BODY_MATERIAL_CUSTOM]);
531 elm_hoversel_item_add(hv, materials[EPHYSICS_BODY_MATERIAL_CUSTOM], 533 elm_hoversel_item_add(hv, materials[EPHYSICS_BODY_MATERIAL_CUSTOM],
@@ -550,7 +552,7 @@ _material_selector_add(Body_Data *bd, Evas_Object *bxparent)
550 NULL, ELM_ICON_NONE, _material_set_cb, 552 NULL, ELM_ICON_NONE, _material_set_cb,
551 (void *) EPHYSICS_BODY_MATERIAL_WOOD); 553 (void *) EPHYSICS_BODY_MATERIAL_WOOD);
552 554
553 evas_object_size_hint_align_set(hv, 1, 0.5); 555 evas_object_size_hint_align_set(hv, 0.5, 0.5);
554 elm_box_pack_end(box, hv); 556 elm_box_pack_end(box, hv);
555 evas_object_show(hv); 557 evas_object_show(hv);
556 evas_object_data_set(hv, "bd", bd); 558 evas_object_data_set(hv, "bd", bd);
@@ -561,25 +563,34 @@ _material_selector_add(Body_Data *bd, Evas_Object *bxparent)
561static void 563static void
562_type_radio_add(Body_Data *bd, Evas_Object *bxparent) 564_type_radio_add(Body_Data *bd, Evas_Object *bxparent)
563{ 565{
564 Evas_Object *dbx, *rd, *rdg; 566 Evas_Object *dbx, *rbx, *rd, *rdg;
565 567
566 dbx = elm_box_add(bxparent); 568 dbx = elm_box_add(bxparent);
567 elm_box_horizontal_set(dbx, EINA_TRUE); 569 elm_box_horizontal_set(dbx, EINA_TRUE);
568 evas_object_size_hint_weight_set(dbx, EVAS_HINT_EXPAND, 0.0); 570 evas_object_size_hint_weight_set(dbx, EVAS_HINT_EXPAND, 0.0);
569 evas_object_size_hint_align_set(dbx, EVAS_HINT_FILL, 0.0); 571 evas_object_size_hint_align_set(dbx, EVAS_HINT_FILL, 0.0);
570 elm_box_padding_set(dbx, 46, 0); 572 elm_box_homogeneous_set(dbx, EINA_TRUE);
571 elm_box_align_set(dbx, 1, 0.5); 573 elm_box_align_set(dbx, 1, 0.5);
572 elm_box_pack_end(bxparent, dbx); 574 elm_box_pack_end(bxparent, dbx);
573 evas_object_show(dbx); 575 evas_object_show(dbx);
574 576
575 _label_add(dbx, "Body Type"); 577 _label_add(dbx, "Body Type", 1);
578
579 rbx = elm_box_add(bxparent);
580 elm_box_horizontal_set(rbx, EINA_TRUE);
581 evas_object_size_hint_weight_set(rbx, EVAS_HINT_EXPAND, 0.0);
582 evas_object_size_hint_align_set(rbx, EVAS_HINT_FILL, 0.0);
583 elm_box_padding_set(rbx, 25, 0);
584 elm_box_align_set(rbx, 0.5, 0.5);
585 elm_box_pack_end(dbx, rbx);
586 evas_object_show(rbx);
576 587
577 rd = elm_radio_add(bxparent); 588 rd = elm_radio_add(bxparent);
578 elm_radio_state_value_set(rd, 0); 589 elm_radio_state_value_set(rd, 0);
579 elm_object_text_set(rd, "Solid"); 590 elm_object_text_set(rd, "Solid");
580 evas_object_size_hint_align_set(rd, 1, 0.5); 591 evas_object_size_hint_align_set(rd, 1, 0.5);
581 evas_object_size_hint_weight_set(rd, 0, EVAS_HINT_EXPAND); 592 evas_object_size_hint_weight_set(rd, 0, EVAS_HINT_EXPAND);
582 elm_box_pack_end(dbx, rd); 593 elm_box_pack_end(rbx, rd);
583 evas_object_show(rd); 594 evas_object_show(rd);
584 rdg = rd; 595 rdg = rd;
585 evas_object_smart_callback_add(rd, "changed", _type_set_cb, bd); 596 evas_object_smart_callback_add(rd, "changed", _type_set_cb, bd);
@@ -590,7 +601,7 @@ _type_radio_add(Body_Data *bd, Evas_Object *bxparent)
590 elm_object_text_set(rd, "Soft"); 601 elm_object_text_set(rd, "Soft");
591 evas_object_size_hint_align_set(rd, 1, 0.5); 602 evas_object_size_hint_align_set(rd, 1, 0.5);
592 evas_object_size_hint_weight_set(rd, 0, EVAS_HINT_EXPAND); 603 evas_object_size_hint_weight_set(rd, 0, EVAS_HINT_EXPAND);
593 elm_box_pack_end(dbx, rd); 604 elm_box_pack_end(rbx, rd);
594 evas_object_show(rd); 605 evas_object_show(rd);
595 evas_object_smart_callback_add(rd, "changed", _type_set_cb, bd); 606 evas_object_smart_callback_add(rd, "changed", _type_set_cb, bd);
596} 607}
@@ -599,17 +610,27 @@ static Evas_Object *
599_slider_add(Evas_Object *bxparent, const char *subcategory, const char *itemlb, 610_slider_add(Evas_Object *bxparent, const char *subcategory, const char *itemlb,
600 float min, float max, float initial) 611 float min, float max, float initial)
601{ 612{
602 Evas_Object *sl; 613 Evas_Object *sl, *dbx;
614
615 dbx = elm_box_add(bxparent);
616 elm_box_horizontal_set(dbx, EINA_TRUE);
617 evas_object_size_hint_weight_set(dbx, EVAS_HINT_EXPAND, 0.0);
618 evas_object_size_hint_align_set(dbx, EVAS_HINT_FILL, 0.0);
619 elm_box_homogeneous_set(dbx, EINA_TRUE);
620 elm_box_align_set(dbx, 0, 0.5);
621 elm_box_pack_end(bxparent, dbx);
622 evas_object_show(dbx);
623
624 _label_add(dbx, subcategory, 1);
603 625
604 sl = elm_slider_add(bxparent); 626 sl = elm_slider_add(bxparent);
605 elm_object_text_set(sl, subcategory);
606 elm_slider_unit_format_set(sl, itemlb); 627 elm_slider_unit_format_set(sl, itemlb);
607 elm_slider_min_max_set(sl, min, max); 628 elm_slider_min_max_set(sl, min, max);
608 elm_slider_value_set(sl, initial); 629 elm_slider_value_set(sl, initial);
609 elm_slider_span_size_set(sl, 100); 630 elm_slider_span_size_set(sl, 100);
610 evas_object_size_hint_weight_set(sl, 0.0, 0.0); 631 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
611 evas_object_size_hint_align_set(sl, 1, 0.5); 632 evas_object_size_hint_align_set(sl, 0, 0.5);
612 elm_box_pack_end(bxparent, sl); 633 elm_box_pack_end(dbx, sl);
613 evas_object_show(sl); 634 evas_object_show(sl);
614 635
615 return sl; 636 return sl;
@@ -703,14 +724,14 @@ _menu_body_page_add(World_Data *wd, Body_Data *bd, const char *pg_label)
703 evas_object_data_set(material_widget, "restitution", widget); 724 evas_object_data_set(material_widget, "restitution", widget);
704 evas_object_smart_callback_add(widget, "delay,changed", 725 evas_object_smart_callback_add(widget, "delay,changed",
705 _restitution_set_cb, bd); 726 _restitution_set_cb, bd);
706 _label_add(bx, "Damping"); 727 _label_add(bx, "Damping", 0.5);
707 widget = _slider_add(bx, "Linear", "%1.3f", 0, 1, 0); 728 widget = _slider_add(bx, "Linear", "%1.3f", 0, 1, 0);
708 evas_object_smart_callback_add(widget, "delay,changed", 729 evas_object_smart_callback_add(widget, "delay,changed",
709 _linear_damping_set_cb, bd); 730 _linear_damping_set_cb, bd);
710 widget = _slider_add(bx, "Angular", "%1.3f", 0, 1, 0); 731 widget = _slider_add(bx, "Angular", "%1.3f", 0, 1, 0);
711 evas_object_smart_callback_add(widget, "delay,changed", 732 evas_object_smart_callback_add(widget, "delay,changed",
712 _angular_damping_set_cb, bd); 733 _angular_damping_set_cb, bd);
713 _label_add(bx, "Sleeping Threshold"); 734 _label_add(bx, "Sleeping Threshold", 0.5);
714 widget = _slider_add(bx, "Linear (p/s)", "%1.2f", 735 widget = _slider_add(bx, "Linear (p/s)", "%1.2f",
715 0, 250, 24); 736 0, 250, 24);
716 evas_object_smart_callback_add(widget, "delay,changed", 737 evas_object_smart_callback_add(widget, "delay,changed",
@@ -721,7 +742,7 @@ _menu_body_page_add(World_Data *wd, Body_Data *bd, const char *pg_label)
721 _ang_sleeping_threshold_set_cb, bd); 742 _ang_sleeping_threshold_set_cb, bd);
722 743
723 bx = _category_add(bxbody, "Actions", EINA_TRUE); 744 bx = _category_add(bxbody, "Actions", EINA_TRUE);
724 _label_add(bx, "Impulse X"); 745 _label_add(bx, "Impulse X", 0.5);
725 aux_widget = _slider_add(bx, "X (kg * p/s)", "%1.3f", 746 aux_widget = _slider_add(bx, "X (kg * p/s)", "%1.3f",
726 -9999, 9999, 0); 747 -9999, 9999, 0);
727 bd->controls.impulse.x = aux_widget; 748 bd->controls.impulse.x = aux_widget;
@@ -729,7 +750,7 @@ _menu_body_page_add(World_Data *wd, Body_Data *bd, const char *pg_label)
729 -360, 360, 0); 750 -360, 360, 0);
730 bd->controls.impulse.relx = widget; 751 bd->controls.impulse.relx = widget;
731 evas_object_data_set(aux_widget, "relx", widget); 752 evas_object_data_set(aux_widget, "relx", widget);
732 _label_add(bx, "Impulse Y"); 753 _label_add(bx, "Impulse Y", 0.5);
733 widget = _slider_add(bx, "Y (kg * p/s)", "%1.3f", -9999, 9999, 0); 754 widget = _slider_add(bx, "Y (kg * p/s)", "%1.3f", -9999, 9999, 0);
734 bd->controls.impulse.y = widget; 755 bd->controls.impulse.y = widget;
735 evas_object_data_set(aux_widget, "y", widget); 756 evas_object_data_set(aux_widget, "y", widget);
@@ -750,13 +771,13 @@ _menu_body_page_add(World_Data *wd, Body_Data *bd, const char *pg_label)
750 evas_object_smart_callback_add(widget, "delay,changed", 771 evas_object_smart_callback_add(widget, "delay,changed",
751 _impulse_y_rel_set_cb, bd); 772 _impulse_y_rel_set_cb, bd);
752 773
753 _label_add(bx, "Force X"); 774 _label_add(bx, "Force X", 0.5);
754 aux_widget = _slider_add(bx, "X (kg * p/s/s)", "%1.3f", -1999, 1999, 0); 775 aux_widget = _slider_add(bx, "X (kg * p/s/s)", "%1.3f", -1999, 1999, 0);
755 bd->controls.force.x = aux_widget; 776 bd->controls.force.x = aux_widget;
756 widget = _slider_add(bx, "Rel Position X", "%1.2f", -360, 360, 0); 777 widget = _slider_add(bx, "Rel Position X", "%1.2f", -360, 360, 0);
757 bd->controls.force.relx = widget; 778 bd->controls.force.relx = widget;
758 evas_object_data_set(aux_widget, "relx", widget); 779 evas_object_data_set(aux_widget, "relx", widget);
759 _label_add(bx, "Force Y"); 780 _label_add(bx, "Force Y", 0.5);
760 widget = _slider_add(bx, "Y (kg * p/s/s)", "%1.3f", -1999, 1999, 0); 781 widget = _slider_add(bx, "Y (kg * p/s/s)", "%1.3f", -1999, 1999, 0);
761 bd->controls.force.y = widget; 782 bd->controls.force.y = widget;
762 evas_object_data_set(aux_widget, "y", widget); 783 evas_object_data_set(aux_widget, "y", widget);
@@ -780,7 +801,7 @@ _menu_body_page_add(World_Data *wd, Body_Data *bd, const char *pg_label)
780 bd->controls.force.torque = widget; 801 bd->controls.force.torque = widget;
781 evas_object_smart_callback_add(widget, "delay,changed", _torque_set_cb, bd); 802 evas_object_smart_callback_add(widget, "delay,changed", _torque_set_cb, bd);
782 803
783 _label_add(bx, "Linear Velocity"); 804 _label_add(bx, "Linear Velocity", 0.5);
784 aux_widget = _slider_add(bx, "X (p/s)", "%1.2f", -1499, 1499, 0); 805 aux_widget = _slider_add(bx, "X (p/s)", "%1.2f", -1499, 1499, 0);
785 bd->controls.velocity.x = aux_widget; 806 bd->controls.velocity.x = aux_widget;
786 widget = _slider_add(bx, "Y (p/s)", "%1.2f", -1499, 1499, 0); 807 widget = _slider_add(bx, "Y (p/s)", "%1.2f", -1499, 1499, 0);
@@ -820,7 +841,7 @@ _menu_world_page_add(World_Data *wd)
820 _menu_page_add(wd->win, &scbx, &bxparent); 841 _menu_page_add(wd->win, &scbx, &bxparent);
821 842
822 bx = _category_add(bxparent, "World", EINA_FALSE); 843 bx = _category_add(bxparent, "World", EINA_FALSE);
823 _label_add(bx, "Gravity (px/s²)"); 844 _label_add(bx, "Gravity (px/s²)", 0.5);
824 widget = _slider_add(bx, "X:", "%1.2f", -1000, 1000, 0); 845 widget = _slider_add(bx, "X:", "%1.2f", -1000, 1000, 0);
825 evas_object_smart_callback_add(widget, "delay,changed", _world_gravity_x_cb, 846 evas_object_smart_callback_add(widget, "delay,changed", _world_gravity_x_cb,
826 wd->world); 847 wd->world);
@@ -851,7 +872,7 @@ _menu_world_page_add(World_Data *wd)
851static void 872static void
852_menu_create(World_Data *wd) 873_menu_create(World_Data *wd)
853{ 874{
854 Evas_Object *mainbx, *btn, *bg, *layout; 875 Evas_Object *mainbx, *dbx, *btn, *bg, *layout;
855 876
856 bg = elm_bg_add(wd->win); 877 bg = elm_bg_add(wd->win);
857 elm_win_resize_object_add(wd->win, bg); 878 elm_win_resize_object_add(wd->win, bg);
@@ -869,20 +890,29 @@ _menu_create(World_Data *wd)
869 elm_object_part_content_set(layout, "swallow", mainbx); 890 elm_object_part_content_set(layout, "swallow", mainbx);
870 evas_object_show(mainbx); 891 evas_object_show(mainbx);
871 892
893 dbx = elm_box_add(mainbx);
894 elm_box_horizontal_set(dbx, EINA_TRUE);
895 evas_object_size_hint_weight_set(dbx, EVAS_HINT_EXPAND, 0.0);
896 evas_object_size_hint_align_set(dbx, EVAS_HINT_FILL, 0.0);
897 elm_box_align_set(dbx, 0, 0.5);
898 elm_box_pack_end(mainbx, dbx);
899 evas_object_show(dbx);
900
901 wd->tb = elm_toolbar_add(wd->win);
902 evas_object_size_hint_weight_set(wd->tb, EVAS_HINT_EXPAND, 0);
903 evas_object_size_hint_fill_set(wd->tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
904 elm_toolbar_select_mode_set(wd->tb, ELM_OBJECT_SELECT_MODE_ALWAYS);
905 elm_box_pack_end(dbx, wd->tb);
906 evas_object_show(wd->tb);
907
872 btn = elm_button_add(wd->win); 908 btn = elm_button_add(wd->win);
873 elm_object_text_set(btn, "Restart"); 909 elm_object_text_set(btn, "Restart");
874 elm_box_pack_end(mainbx, btn);
875 evas_object_size_hint_min_set(btn, 100, 30); 910 evas_object_size_hint_min_set(btn, 100, 30);
876 evas_object_size_hint_align_set(btn, 1, 0.5); 911 evas_object_size_hint_align_set(btn, 1, 0.5);
912 elm_box_pack_end(dbx, btn);
877 evas_object_show(btn); 913 evas_object_show(btn);
878 evas_object_smart_callback_add(btn, "clicked", _simulate_cb, wd); 914 evas_object_smart_callback_add(btn, "clicked", _simulate_cb, wd);
879 915
880 wd->tb = elm_toolbar_add(wd->win);
881 evas_object_size_hint_weight_set(wd->tb, EVAS_HINT_EXPAND, 0);
882 evas_object_size_hint_fill_set(wd->tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
883 elm_toolbar_select_mode_set(wd->tb, ELM_OBJECT_SELECT_MODE_ALWAYS);
884 elm_box_pack_end(mainbx, wd->tb);
885 evas_object_show(wd->tb);
886 916
887 wd->nf = elm_naviframe_add(wd->win); 917 wd->nf = elm_naviframe_add(wd->win);
888 evas_object_size_hint_weight_set(wd->nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 918 evas_object_size_hint_weight_set(wd->nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);