From c1981c41a2a0b1e7c925147cb539db1139a3b7e9 Mon Sep 17 00:00:00 2001 From: raster Date: Fri, 5 Aug 2011 12:25:43 +0000 Subject: [PATCH] ok demo is a bit better now. less ambitious. only 33million buttons. but it scrolls fine now. using homogenous boxen now in groups of 32 (5 levels of 32 - ie 32 ^ 5 == 33mil or so) git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@62132 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/bin/test_factory.c | 87 +++++++++++++++++++++++++++++--------------------- src/lib/elm_factory.c | 3 +- 2 files changed, 51 insertions(+), 39 deletions(-) diff --git a/src/bin/test_factory.c b/src/bin/test_factory.c index 589571c..b98121f 100644 --- a/src/bin/test_factory.c +++ b/src/bin/test_factory.c @@ -4,6 +4,9 @@ #endif #ifndef ELM_LIB_QUICKLAUNCH +// 32 ^ 5 = 33mil +#define BLOK 32 + static void fac_unrealize(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) { @@ -16,124 +19,132 @@ static void fac_realize_end(void *data, Evas_Object *obj, void *event_info __UNUSED__) { Evas_Object *win = data; - Evas_Object *tb, *bt; + Evas_Object *bx, *bt; int i; - printf("ADD for factory 4 %p\n", obj); - tb = elm_table_add(win); + printf("ADD for factory 4 %p [%i]\n", obj, (BLOK * (int)evas_object_data_get(obj, "num"))); + bx = elm_box_add(win); + elm_box_homogeneous_set(bx, EINA_TRUE); - for (i = 0; i < 40; i++) + for (i = 0; i < BLOK; i++) { char buf[32]; - snprintf(buf, sizeof(buf), "%i", i); + snprintf(buf, sizeof(buf), "%i", + (i + (BLOK * (int)evas_object_data_get(obj, "num")))); bt = elm_button_add(win); evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_object_text_set(bt, buf); - elm_table_pack(tb, bt, 0, i, 1, 1); + elm_box_pack_end(bx, bt); evas_object_show(bt); } - elm_factory_content_set(obj, tb); - evas_object_show(tb); + elm_factory_content_set(obj, bx); + evas_object_show(bx); } static void fac_realize3(void *data, Evas_Object *obj, void *event_info __UNUSED__) { Evas_Object *win = data; - Evas_Object *tb, *fc; + Evas_Object *bx, *fc; int i; - printf("ADD for factory 3 %p\n", obj); - tb = elm_table_add(win); + printf("ADD for factory 3 %p [%i]\n", obj, (BLOK * (int)evas_object_data_get(obj, "num"))); + bx = elm_box_add(win); + elm_box_homogeneous_set(bx, EINA_TRUE); - for (i = 0; i < 40; i++) + for (i = 0; i < BLOK; i++) { fc = elm_factory_add(win); // initial height per factory of 1000 // scrollbar will be wrong until enough // children have been realized and the // real size is known + evas_object_data_set(fc, "num", (void *)(i + (BLOK * (int)evas_object_data_get(obj, "num")))); evas_object_size_hint_min_set(fc, 0, 1000); evas_object_size_hint_weight_set(fc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(fc, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_smart_callback_add(fc, "realize", fac_realize_end, win); evas_object_smart_callback_add(fc, "unrealize", fac_unrealize, win); - elm_table_pack(tb, fc, 0, i, 1, 1); + elm_box_pack_end(bx, fc); evas_object_show(fc); } - elm_factory_content_set(obj, tb); - evas_object_show(tb); + elm_factory_content_set(obj, bx); + evas_object_show(bx); } static void fac_realize2(void *data, Evas_Object *obj, void *event_info __UNUSED__) { Evas_Object *win = data; - Evas_Object *tb, *fc; + Evas_Object *bx, *fc; int i; - printf("ADD for factory 2 %p\n", obj); - tb = elm_table_add(win); - - for (i = 0; i < 40; i++) + printf("ADD for factory 2 %p [%i]\n", obj, (BLOK * (int)evas_object_data_get(obj, "num"))); + bx = elm_box_add(win); + elm_box_homogeneous_set(bx, EINA_TRUE); + + for (i = 0; i < BLOK; i++) { fc = elm_factory_add(win); // initial height per factory of 1000 // scrollbar will be wrong until enough // children have been realized and the // real size is known + evas_object_data_set(fc, "num", (void *)(i + (BLOK * (int)evas_object_data_get(obj, "num")))); evas_object_size_hint_min_set(fc, 0, 1000); evas_object_size_hint_weight_set(fc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(fc, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_smart_callback_add(fc, "realize", fac_realize3, win); evas_object_smart_callback_add(fc, "unrealize", fac_unrealize, win); - elm_table_pack(tb, fc, 0, i, 1, 1); + elm_box_pack_end(bx, fc); evas_object_show(fc); } - elm_factory_content_set(obj, tb); - evas_object_show(tb); + elm_factory_content_set(obj, bx); + evas_object_show(bx); } static void fac_realize1(void *data, Evas_Object *obj, void *event_info __UNUSED__) { Evas_Object *win = data; - Evas_Object *tb, *fc; + Evas_Object *bx, *fc; int i; - printf("ADD for factory 1 %p\n", obj); - tb = elm_table_add(win); + printf("ADD for factory 1 %p [%i]\n", obj, (BLOK * (int)evas_object_data_get(obj, "num"))); + bx = elm_box_add(win); + elm_box_homogeneous_set(bx, EINA_TRUE); - for (i = 0; i < 40; i++) + for (i = 0; i < BLOK; i++) { fc = elm_factory_add(win); // initial height per factory of 1000 // scrollbar will be wrong until enough // children have been realized and the // real size is known + evas_object_data_set(fc, "num", (void *)(i + (BLOK * (int)evas_object_data_get(obj, "num")))); evas_object_size_hint_min_set(fc, 0, 1000); evas_object_size_hint_weight_set(fc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(fc, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_smart_callback_add(fc, "realize", fac_realize2, win); evas_object_smart_callback_add(fc, "unrealize", fac_unrealize, win); - elm_table_pack(tb, fc, 0, i, 1, 1); + elm_box_pack_end(bx, fc); evas_object_show(fc); } - elm_factory_content_set(obj, tb); - evas_object_show(tb); + elm_factory_content_set(obj, bx); + evas_object_show(bx); } void test_factory(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { - Evas_Object *win, *bg, *tb, *sc, *fc; + Evas_Object *win, *bg, *bx, *sc, *fc; int i; win = elm_win_add(NULL, "factory", ELM_WIN_BASIC); @@ -145,22 +156,24 @@ test_factory(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_inf elm_win_resize_object_add(win, bg); evas_object_show(bg); - tb = elm_table_add(win); - evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + bx = elm_box_add(win); + elm_box_homogeneous_set(bx, EINA_TRUE); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - for (i = 0; i < 40; i++) + for (i = 0; i < BLOK; i++) { fc = elm_factory_add(win); // initial height per factory of 1000 // scrollbar will be wrong until enough // children have been realized and the // real size is known + evas_object_data_set(fc, "num", (void *)i); evas_object_size_hint_min_set(fc, 0, 1000); evas_object_size_hint_weight_set(fc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(fc, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_smart_callback_add(fc, "realize", fac_realize1, win); evas_object_smart_callback_add(fc, "unrealize", fac_unrealize, win); - elm_table_pack(tb, fc, 0, i, 1, 1); + elm_box_pack_end(bx, fc); evas_object_show(fc); } @@ -169,8 +182,8 @@ test_factory(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_inf evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, sc); - elm_scroller_content_set(sc, tb); - evas_object_show(tb); + elm_scroller_content_set(sc, bx); + evas_object_show(bx); evas_object_show(sc); diff --git a/src/lib/elm_factory.c b/src/lib/elm_factory.c index 9937240..63c0013 100644 --- a/src/lib/elm_factory.c +++ b/src/lib/elm_factory.c @@ -61,7 +61,6 @@ _sizing_eval(Evas_Object *obj) evas_object_size_hint_max_get(wd->content, &maxw, &maxh); evas_object_size_hint_min_set(obj, minw, minh); evas_object_size_hint_max_set(obj, maxw, maxh); - printf("fac: %p, size %ix%i -> %ix%i\n", obj, minw, minh, maxw, maxh); } static void @@ -74,7 +73,7 @@ _eval(Evas_Object *obj) evas_object_geometry_get(obj, &x, &y, &w, &h); evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh); - if ((w < 1) || (h < 1) || (cvw < 1) || (cvh < 1)) return; + if ((w < 10) || (h < 10) || (cvw < 1) || (cvh < 1)) return; if (ELM_RECTS_INTERSECT(x, y, w, h, cvx, cvy, cvw, cvh)) { if (!wd->content) -- 2.7.4