As suggested by Sachiel I added the transition layout for elm_box in
elementary_test.
The patch is attached.

2010/9/29 Otávio Pontes <ota...@profusion.mobi>:
> 2010/9/28 Gustavo Sverzut Barbieri <barbi...@profusion.mobi>:
>> 2010/9/23 Otávio Pontes <ota...@profusion.mobi>:
>>> 2010/9/22 Gustavo Sverzut Barbieri <barbi...@profusion.mobi>:
>>>> 2010/9/22 Otávio Pontes <ota...@profusion.mobi>:
>>>>> I have added the transition layout into edje too. It displays an
>>>>> animation when changing box state with different layouts.
>>>>> I am sending the patch for edje and an edc sample file.
>>>>
>>>> Awesome results, few comments:
>>>>
>>>>  - edje users don't have direct access to items, so you shouldn't
>>>> require to listen to child,added/child,removed... but it doesn't
>>>> hurt...  however:
>>>>
>>>>  - edje already knows about the items, as they are managed through
>>>> edje_object_part_box_* methods. You should reuse that. This will avoid
>>>> reload children list to recreate all items again.
>>>
>>> Done. And it was a better solution.
>>>
>>>>
>>>>  - at _edje_box_layout_calculate_coords() you don't revert the box
>>>> properties (padding, align) to the original once you measure the final
>>>> state. Okay, at layout you have a "if (progress == 0.0)" and then do
>>>> that, but it is better to do it in the other function. Also, comparing
>>>
>>> Setting box properties in layout function when progress == 0 is
>>> necessary because sometimes layout is used without any animation and
>>> _edje_box_layout_calculate_coords is called only when an animation
>>> will start. After running _edje_box_layout_calculate_coords the layout
>>> will place objects without looking at box properties. These properties
>>> will be needed only when progress == 0.0, so setting them on
>>> _edje_box_layout_calculate_coords is not necessary.
>>>
>>>> for double equality will raise some warnings for compilers with
>>>> -Wextra AFAIR.
>>>>
>>>
>>> Checking now if progress < 0.01 to avoid floating point problems.
>>>
>>>>  - double check if anim->start_progress < 1 before calling _exec() to
>>>> avoid division by 0.0 and an FPU exception? While it is hard to happen
>>>> in tests, it may happen one day in platforms that crash the
>>>> application :-(
>>>
>>> Done.
>>>
>>>>
>>>>  - edje coding style require all structs with Edje prefix, even if
>>>> they are private.
>>>>
>>>
>>> Done
>>>
>>>>
>>>> Last but not least, few questions that I cannot remember from Edje and
>>>> from your patch it is not obvious to me:
>>>>
>>>>   - does it still allocates the animation even if the transition is
>>>> immediate (ie: zero timed "transition:" in your program)? Seems so as
>>>> _edje_box_recalc_apply() always create it.
>>>
>>> _edje_box_recalc_apply aways allocate the anim struct, that is used
>>> for all animations with this box. I could allocate the struct only if
>>> necessary, but it wont be possible to avoid reloading children in
>>> _edje_box_layout_load_children_list. In this new patch anim struct is
>>> created when the first child is added to the box.
>>>
>>>>
>>>>
>>>> I'd move this to part box constructor:
>>>> evas_object_box_layout_set(ep->object, _edje_box_layout, ep->anim,
>>>> _edje_box_layout_free_data), always have it (you may even call it just
>>>> "box" and remove the "anim" reference. Then you free it (your
>>>> _edje_box_layout_free_data) at part delete. You keep this as the
>>>> single layout function ever set to ep->object.  Then move all your
>>>> _edje_box_layout_calculate_coords() to _edje_box_recalc_apply() as
>>>> there you know for sure what happened and do not have to set a flag to
>>>> be checked later... I guess these things will make code simpler and
>>>> less error prone, also easier for others to review and maintain it.
>>>
>>> Calling functions to allocate and destroy data in edje_load.c. Restart
>>> flag was removed and   _edje_box_layout_calculate_coords is called in
>>> in _edje_box_recalc_apply. The recalculate flag is still necessary.
>>>
>>> Sending new patch attached.
>>
>> sorry taking so long! in svn as r52871.
>
> Thanks
>
>>
>> --
>> Gustavo Sverzut Barbieri
>> http://profusion.mobi embedded systems
>> --------------------------------------
>> MSN: barbi...@gmail.com
>> Skype: gsbarbieri
>> Mobile: +55 (19) 9225-2202
>>
>



-- 
Otavio Pontes
ProFUSION embedded systems
http://www.profusion.mobi
From a6757cc527d6aaa08c1593d04ffcad849a04f282 Mon Sep 17 00:00:00 2001
From: Otavio Pontes <ota...@profusion.mobi>
Date: Mon, 18 Oct 2010 10:08:13 -0200
Subject: [PATCH] Adding a Transition Layout example in elementary_test
To: ota...@profusion.mobi

---
 TMP/st/elementary/src/bin/test.c     |    2 +
 TMP/st/elementary/src/bin/test_box.c |  109 ++++++++++++++++++++++++++++++++++
 2 files changed, 111 insertions(+), 0 deletions(-)

diff --git a/TMP/st/elementary/src/bin/test.c b/TMP/st/elementary/src/bin/test.c
index 04ba223..5a17cb5 100644
--- a/TMP/st/elementary/src/bin/test.c
+++ b/TMP/st/elementary/src/bin/test.c
@@ -12,6 +12,7 @@ void test_icon(void *data, Evas_Object *obj, void *event_info);
 void test_box_vert(void *data, Evas_Object *obj, void *event_info);
 void test_box_vert2(void *data, Evas_Object *obj, void *event_info);
 void test_box_horiz(void *data, Evas_Object *obj, void *event_info);
+void test_box_transition(void *data, Evas_Object *obj, void *event_info);
 void test_button(void *data, Evas_Object *obj, void *event_info);
 void test_fileselector_button(void *data, Evas_Object *obj, void *event_info);
 void test_fileselector_entry(void *data, Evas_Object *obj, void *event_info);
@@ -231,6 +232,7 @@ my_win_main(char *autorun)
    ADD_TEST("Box Vert", test_box_vert);
    ADD_TEST("Box Vert 2", test_box_vert2);
    ADD_TEST("Box Horiz", test_box_horiz);
+   ADD_TEST("Box Transition", test_box_transition);
    ADD_TEST("Buttons", test_button);
    ADD_TEST("File Selector Button", test_fileselector_button);
    ADD_TEST("File Selector Entry", test_fileselector_entry);
diff --git a/TMP/st/elementary/src/bin/test_box.c b/TMP/st/elementary/src/bin/test_box.c
index 6447501..ac2bdc4 100644
--- a/TMP/st/elementary/src/bin/test_box.c
+++ b/TMP/st/elementary/src/bin/test_box.c
@@ -168,4 +168,113 @@ test_box_horiz(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
 
    evas_object_show(win);
 }
+
+typedef struct
+{
+   Eina_List *transitions;
+   Evas_Object *box;
+   Evas_Object_Box_Layout last_layout;
+} _Transitions_Data;
+
+static void
+_test_box_transition_change(void *data)
+{
+   _Transitions_Data *tdata = data;
+   Elm_Box_Transition *layout_data;
+   Evas_Object_Box_Layout next_layout;
+
+   if (!data) return;
+   next_layout=eina_list_data_get(tdata->transitions);
+   layout_data = elm_box_transition_new(2.0, tdata->last_layout,
+         NULL, NULL, next_layout, NULL, NULL,
+         _test_box_transition_change, tdata);
+   elm_box_layout_set(tdata->box, elm_box_layout_transition, layout_data, elm_box_transition_free);
+   tdata->last_layout = next_layout;
+
+   tdata->transitions = eina_list_demote_list(tdata->transitions, tdata->transitions);
+}
+
+static void
+_win_del(void *data, Evas_Object *obj, void *event_info)
+{
+   _Transitions_Data *tdata = data;
+   elm_box_layout_set(tdata->box, evas_object_box_layout_horizontal, NULL, NULL);
+   free(data);
+}
+
+void
+test_box_transition(void *data, Evas_Object *obj, void *event_info)
+{
+   Evas_Object *win, *bg, *bx, *bt;
+   _Transitions_Data *tdata;
+
+   win = elm_win_add(NULL, "box-transition", ELM_WIN_BASIC);
+   elm_win_title_set(win, "Box Transition");
+   elm_win_autodel_set(win, 1);
+
+   bg = elm_bg_add(win);
+   elm_win_resize_object_add(win, bg);
+   evas_object_size_hint_weight_set(bg, 1.0, 1.0);
+   evas_object_show(bg);
+
+   bx = elm_box_add(win);
+   elm_win_resize_object_add(win, bx);
+   evas_object_size_hint_weight_set(bx, 1.0, 1.0);
+
+   evas_object_show(bx);
+
+   bt = elm_button_add(win);
+   elm_button_label_set(bt, "Button 1");
+   evas_object_size_hint_weight_set(bt, 1.0, 1.0);
+   evas_object_size_hint_align_set(bt, -1.0, -1.0);
+   evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
+   elm_box_pack_end(bx, bt);
+   evas_object_resize(bt, 100, 100);
+   evas_object_show(bt);
+
+   bt = elm_button_add(win);
+   elm_button_label_set(bt, "Button 2");
+   evas_object_size_hint_weight_set(bt, 1.0, 1.0);
+   evas_object_size_hint_align_set(bt, -1.0, -1.0);
+   evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
+   elm_box_pack_end(bx, bt);
+   evas_object_resize(bt, 100, 100);
+   evas_object_show(bt);
+
+   bt = elm_button_add(win);
+   elm_button_label_set(bt, "Button 3");
+   evas_object_size_hint_weight_set(bt, 1.0, 1.0);
+   evas_object_size_hint_align_set(bt, -1.0, -1.0);
+   evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
+   elm_box_pack_end(bx, bt);
+   evas_object_resize(bt, 100, 100);
+   evas_object_show(bt);
+
+   tdata = calloc(1, sizeof(_Transitions_Data));
+   tdata->box = bx;
+   tdata->last_layout = evas_object_box_layout_horizontal;
+   tdata->transitions = eina_list_append(tdata->transitions,
+         evas_object_box_layout_vertical);
+   tdata->transitions = eina_list_append(tdata->transitions,
+         evas_object_box_layout_horizontal);
+   tdata->transitions = eina_list_append(tdata->transitions,
+         evas_object_box_layout_stack);
+   tdata->transitions = eina_list_append(tdata->transitions,
+         evas_object_box_layout_homogeneous_vertical);
+   tdata->transitions = eina_list_append(tdata->transitions,
+         evas_object_box_layout_homogeneous_horizontal);
+   tdata->transitions = eina_list_append(tdata->transitions,
+         evas_object_box_layout_flow_vertical);
+   tdata->transitions = eina_list_append(tdata->transitions,
+         evas_object_box_layout_flow_horizontal);
+   tdata->transitions = eina_list_append(tdata->transitions,
+         evas_object_box_layout_stack);
+
+   evas_object_resize(win, 300, 300);
+   evas_object_resize(bx, 300, 300);
+   evas_object_smart_callback_add(win, "delete,request", _win_del, tdata);
+   evas_object_show(win);
+   elm_box_layout_set(bx, evas_object_box_layout_horizontal, NULL, NULL);
+   _test_box_transition_change(tdata);
+}
 #endif
-- 
1.7.3.1

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to