summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLarry Lira <larry@expertisesolutions.com.br>2019-01-11 16:24:14 +0900
committerSangHyeon Jade Lee <sh10233.lee@samsung.com>2019-01-11 17:21:19 +0900
commit54287d67d4efd5ca80a6c324397aeaa0ee25e5f1 (patch)
tree8ddac50d6ff2a972f61212aaeff67e9519d13994
parent766f8151fc20c4c2859844d7a6bcefa92210ed43 (diff)
Efl.Ui.List_View: precise layout async
Summary: fixed precise layouter to work with create asynchronous fixed example theme signal Reviewers: cedric, felipealmeida, SanghyeonLee, lauromoura Reviewed By: SanghyeonLee Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7476
-rw-r--r--src/examples/elementary/efl_ui_list_view_example_1.c2
-rw-r--r--src/lib/elementary/efl_ui_list_view.c23
-rw-r--r--src/lib/elementary/efl_ui_list_view_precise_layouter.c218
-rw-r--r--src/lib/elementary/efl_ui_list_view_precise_layouter.eo1
-rw-r--r--src/lib/elementary/efl_ui_list_view_relayout.eo5
5 files changed, 123 insertions, 126 deletions
diff --git a/src/examples/elementary/efl_ui_list_view_example_1.c b/src/examples/elementary/efl_ui_list_view_example_1.c
index dc300264aa..e432fe1d66 100644
--- a/src/examples/elementary/efl_ui_list_view_example_1.c
+++ b/src/examples/elementary/efl_ui_list_view_example_1.c
@@ -87,7 +87,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
87 ); 87 );
88 88
89 factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win); 89 factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
90 efl_ui_model_connect(factory, "signal/elm,state,%v", "odd_style"); 90 efl_ui_model_connect(factory, "signal/efl,state,%v", "odd_style");
91 efl_ui_model_connect(factory, "signal/efl,state,%{selected;unselected}", "selected"); 91 efl_ui_model_connect(factory, "signal/efl,state,%{selected;unselected}", "selected");
92 efl_ui_model_connect(factory, "efl.text", "name"); 92 efl_ui_model_connect(factory, "efl.text", "name");
93 efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default"); 93 efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default");
diff --git a/src/lib/elementary/efl_ui_list_view.c b/src/lib/elementary/efl_ui_list_view.c
index fc85818fc0..ee26515822 100644
--- a/src/lib/elementary/efl_ui_list_view.c
+++ b/src/lib/elementary/efl_ui_list_view.c
@@ -32,7 +32,6 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
32 32
33void _efl_ui_list_view_custom_layout(Efl_Ui_List_View *); 33void _efl_ui_list_view_custom_layout(Efl_Ui_List_View *);
34void _efl_ui_list_view_item_select_set(Efl_Ui_List_View_Layout_Item*, Eina_Bool); 34void _efl_ui_list_view_item_select_set(Efl_Ui_List_View_Layout_Item*, Eina_Bool);
35static void _layout(Efl_Ui_List_View_Data* pd);
36 35
37static Eina_Bool _key_action_move(Evas_Object *obj, const char *params); 36static Eina_Bool _key_action_move(Evas_Object *obj, const char *params);
38static Eina_Bool _key_action_select(Evas_Object *obj, const char *params); 37static Eina_Bool _key_action_select(Evas_Object *obj, const char *params);
@@ -166,7 +165,7 @@ _on_item_mouse_up(void *data, Evas *evas EINA_UNUSED, Evas_Object *o EINA_UNUSED
166 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; 165 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
167 166
168 v = efl_model_property_get(item->children, SELECTED_PROP); 167 v = efl_model_property_get(item->children, SELECTED_PROP);
169 if (!eina_value_get(v, &select)) 168 if (!eina_value_get(v, &select))
170 { 169 {
171 WRN("Could not get the select value"); 170 WRN("Could not get the select value");
172 eina_value_free(v); 171 eina_value_free(v);
@@ -239,7 +238,11 @@ _efl_ui_list_view_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_List_View_Data *pd, Ei
239EOLIAN static void 238EOLIAN static void
240_efl_ui_list_view_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd) 239_efl_ui_list_view_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd)
241{ 240{
242 _layout(pd); 241 if (!pd->model)
242 return;
243
244 efl_ui_list_view_relayout_layout_do(pd->relayout, pd->obj, pd->seg_array_first, pd->seg_array);
245
243} 246}
244 247
245EOLIAN static void 248EOLIAN static void
@@ -841,15 +844,6 @@ _efl_ui_list_view_relayout_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data
841 return pd->relayout; 844 return pd->relayout;
842} 845}
843 846
844static void
845_layout(Efl_Ui_List_View_Data *pd)
846{
847 if (!pd->model)
848 return;
849
850 efl_ui_list_view_relayout_layout_do(pd->relayout, pd->obj, pd->seg_array_first, pd->seg_array);
851}
852
853static Eina_Value 847static Eina_Value
854_children_slice_then(void * data, const Eina_Value v, const Eina_Future *dead_future EINA_UNUSED) 848_children_slice_then(void * data, const Eina_Value v, const Eina_Future *dead_future EINA_UNUSED)
855{ 849{
@@ -941,8 +935,11 @@ _content_created(Eo *obj, void *data, const Eina_Value value)
941 evt.layout = item->layout; 935 evt.layout = item->layout;
942 evt.index = efl_ui_list_view_item_index_get(item); 936 evt.index = efl_ui_list_view_item_index_get(item);
943 efl_event_callback_call(obj, EFL_UI_LIST_VIEW_EVENT_ITEM_REALIZED, &evt); 937 efl_event_callback_call(obj, EFL_UI_LIST_VIEW_EVENT_ITEM_REALIZED, &evt);
944 efl_ui_focus_composition_dirty(obj);
945 938
939 tracking->item->layout_request = NULL;
940 efl_ui_list_view_relayout_content_created(tracking->pd->relayout, item);
941
942 efl_ui_focus_composition_dirty(obj);
946 evas_object_show(item->layout); 943 evas_object_show(item->layout);
947 944
948 return value; 945 return value;
diff --git a/src/lib/elementary/efl_ui_list_view_precise_layouter.c b/src/lib/elementary/efl_ui_list_view_precise_layouter.c
index 9b6ba9f0ad..156662caa5 100644
--- a/src/lib/elementary/efl_ui_list_view_precise_layouter.c
+++ b/src/lib/elementary/efl_ui_list_view_precise_layouter.c
@@ -22,7 +22,6 @@ typedef struct _Efl_Ui_List_View_Precise_Layouter_Data
22 22
23 unsigned int calc_progress; 23 unsigned int calc_progress;
24 24
25 int first;
26 int count_total; 25 int count_total;
27 26
28 Eina_Bool initialized : 1; 27 Eina_Bool initialized : 1;
@@ -118,21 +117,26 @@ _item_size_calc(Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Lay
118 } 117 }
119} 118}
120 119
121static void 120static Eina_Size2D
122_item_min_calc(Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Layout_Item* item 121_item_min_calc(Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Layout_Item* item)
123 , Eina_Size2D min, Efl_Ui_List_View_Seg_Array_Node *itemnode)
124{ 122{
125 Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = itemnode->layout_data; 123 Efl_Ui_List_View_Seg_Array_Node *itemnode = item->tree_node;
124 Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata;
126 Efl_Ui_List_View_Layout_Item *layout_item; 125 Efl_Ui_List_View_Layout_Item *layout_item;
127 int i, pad[4]; 126 int i, pad[4];
128 127
129 efl_gfx_size_hint_margin_get(item->layout, &pad[0], &pad[1], &pad[2], &pad[3]); 128 Eina_Size2D min = efl_gfx_size_hint_combined_min_get(item->layout);
130 129
130 efl_gfx_size_hint_margin_get(item->layout, &pad[0], &pad[1], &pad[2], &pad[3]);
131 min.w += pad[0] + pad[1]; 131 min.w += pad[0] + pad[1];
132 min.h += pad[2] + pad[3]; 132 min.h += pad[2] + pad[3];
133 133
134 if (item->min.h == min.h && item->min.w == min.w) 134 if (item->min.h == min.h && item->min.w == min.w)
135 return; 135 return min;
136
137 EINA_SAFETY_ON_NULL_RETURN_VAL(itemnode, min);
138 EINA_SAFETY_ON_NULL_RETURN_VAL(itemnode->layout_data, min);
139 nodedata = itemnode->layout_data;
136 140
137 pd->min.h += min.h - item->min.h; 141 pd->min.h += min.h - item->min.h;
138 nodedata->min.h += min.h - item->min.h; 142 nodedata->min.h += min.h - item->min.h;
@@ -175,13 +179,12 @@ _item_min_calc(Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Layo
175 179
176 item->min.w = min.w; 180 item->min.w = min.w;
177 item->min.h = min.h; 181 item->min.h = min.h;
178 182 return item->min;
179 _item_size_calc(pd, item);
180} 183}
181 184
182static void 185static void
183_on_item_size_hint_change(void *data, Evas *e EINA_UNUSED, 186_on_item_size_hint_change(void *data, Evas *e EINA_UNUSED,
184 Evas_Object *obj, void *event_info EINA_UNUSED) 187 Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
185{ 188{
186 Efl_Ui_List_View_Precise_Layouter_Callback_Data *cb_data = data; 189 Efl_Ui_List_View_Precise_Layouter_Callback_Data *cb_data = data;
187 Efl_Ui_List_View_Precise_Layouter_Data *pd = cb_data->pd; 190 Efl_Ui_List_View_Precise_Layouter_Data *pd = cb_data->pd;
@@ -189,8 +192,7 @@ _on_item_size_hint_change(void *data, Evas *e EINA_UNUSED,
189 Efl_Ui_List_View_Seg_Array_Node *node = item->tree_node; 192 Efl_Ui_List_View_Seg_Array_Node *node = item->tree_node;
190 Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = node->layout_data; 193 Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = node->layout_data;
191 194
192 Eina_Size2D min = efl_gfx_size_hint_combined_min_get(obj); 195 _item_min_calc(pd, item);
193 _item_min_calc(pd, item, min, node);
194 if (!nodedata->realized) 196 if (!nodedata->realized)
195 { 197 {
196 free(evas_object_event_callback_del(item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change)); 198 free(evas_object_event_callback_del(item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change));
@@ -273,17 +275,17 @@ _child_removed_cb(void *data, const Efl_Event *event)
273 nodedata->min.w = 0; 275 nodedata->min.w = 0;
274 276
275 for (i = 0; i != itemnode->length; ++i) 277 for (i = 0; i != itemnode->length; ++i)
276 { 278 {
277 layout_item = (Efl_Ui_List_View_Layout_Item *)itemnode->pointers[i]; 279 layout_item = (Efl_Ui_List_View_Layout_Item *)itemnode->pointers[i];
278 if (nodedata->min.w < layout_item->min.w) 280 if (nodedata->min.w < layout_item->min.w)
279 nodedata->min.w = layout_item->min.w; 281 nodedata->min.w = layout_item->min.w;
280 282
281 if (litem->min.w == layout_item->min.w) 283 if (litem->min.w == layout_item->min.w)
282 { 284 {
283 nodedata->min.w = layout_item->min.w; 285 nodedata->min.w = layout_item->min.w;
284 break; 286 break;
285 } 287 }
286 } 288 }
287 289
288 if (pd->min.w == litem->min.w) 290 if (pd->min.w == litem->min.w)
289 { 291 {
@@ -300,9 +302,8 @@ _child_removed_cb(void *data, const Efl_Event *event)
300 if (litem->min.w == nodedata2->min.w) 302 if (litem->min.w == nodedata2->min.w)
301 break; 303 break;
302 } 304 }
303 eina_accessor_free(nodes); 305 eina_accessor_free(nodes);
304 } 306 }
305
306 efl_ui_list_view_model_unrealize(pd->modeler, litem); 307 efl_ui_list_view_model_unrealize(pd->modeler, litem);
307 308
308 free(litem); 309 free(litem);
@@ -391,7 +392,6 @@ static void
391_node_realize(Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Seg_Array_Node *node) 392_node_realize(Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Seg_Array_Node *node)
392{ 393{
393 Efl_Ui_List_View_Layout_Item* layout_item; 394 Efl_Ui_List_View_Layout_Item* layout_item;
394 Efl_Ui_List_View_Precise_Layouter_Callback_Data *cb_data;
395 Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = node->layout_data; 395 Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = node->layout_data;
396 int i; 396 int i;
397 397
@@ -405,15 +405,6 @@ _node_realize(Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Seg_A
405 { 405 {
406 layout_item = (Efl_Ui_List_View_Layout_Item *)node->pointers[i]; 406 layout_item = (Efl_Ui_List_View_Layout_Item *)node->pointers[i];
407 efl_ui_list_view_model_realize(pd->modeler, layout_item); 407 efl_ui_list_view_model_realize(pd->modeler, layout_item);
408
409 if (layout_item->layout)
410 {
411 cb_data = calloc(1, sizeof(Efl_Ui_List_View_Precise_Layouter_Callback_Data));
412 cb_data->pd = pd;
413 cb_data->item = layout_item;
414 evas_object_event_callback_add(layout_item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change, cb_data);
415 _item_size_calc(pd, layout_item);
416 }
417 } 408 }
418} 409}
419 410
@@ -438,8 +429,8 @@ _node_unrealize(Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Seg
438 { 429 {
439 cb_data = evas_object_event_callback_del(layout_item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change); 430 cb_data = evas_object_event_callback_del(layout_item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change);
440 free(cb_data); 431 free(cb_data);
432 efl_ui_list_view_model_unrealize(pd->modeler, layout_item);
441 } 433 }
442 efl_ui_list_view_model_unrealize(pd->modeler, layout_item);
443 } 434 }
444} 435}
445 436
@@ -485,8 +476,8 @@ _calc_size_job(void *data)
485 Efl_Ui_List_View_Precise_Layouter_Data *pd; 476 Efl_Ui_List_View_Precise_Layouter_Data *pd;
486 Efl_Ui_List_View_Seg_Array_Node *node; 477 Efl_Ui_List_View_Seg_Array_Node *node;
487 Efl_Ui_List_View_Layout_Item *layout_item; 478 Efl_Ui_List_View_Layout_Item *layout_item;
479 Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata;
488 Eo *obj = data; 480 Eo *obj = data;
489 Eina_Size2D min;
490 int i; 481 int i;
491 double start_time = ecore_time_get(); 482 double start_time = ecore_time_get();
492 483
@@ -501,52 +492,36 @@ _calc_size_job(void *data)
501 if (!node->layout_data) 492 if (!node->layout_data)
502 node->layout_data = calloc(1, sizeof(Efl_Ui_List_View_Precise_Layouter_Node_Data)); 493 node->layout_data = calloc(1, sizeof(Efl_Ui_List_View_Precise_Layouter_Node_Data));
503 494
495 nodedata = node->layout_data;
496 if (pd->calc_progress == 1)
497 nodedata->realized = EINA_TRUE;
498
504 for (i = 0; i != node->length; ++i) 499 for (i = 0; i != node->length; ++i)
505 { 500 {
506 layout_item = (Efl_Ui_List_View_Layout_Item *)node->pointers[i]; 501 layout_item = (Efl_Ui_List_View_Layout_Item *)node->pointers[i];
507 EINA_SAFETY_ON_NULL_RETURN(layout_item); 502 EINA_SAFETY_ON_NULL_RETURN(layout_item);
508 503
509 // cache size of new items 504 // cache size of new items
510 if ((layout_item->min.w == 0) && (layout_item->min.h == 0)) 505 if ((layout_item->min.w == 0) && (layout_item->min.h == 0) && (!layout_item->layout))
511 { 506 efl_ui_list_view_model_realize(pd->modeler, layout_item);
512 if (!layout_item->layout)
513 {
514 efl_ui_list_view_model_realize(pd->modeler, layout_item);
515 }
516
517 min = efl_gfx_size_hint_combined_min_get(layout_item->layout);
518 if (min.w && min.h)
519 {
520 _item_min_calc(pd, layout_item, min, node);
521 efl_ui_list_view_model_unrealize(pd->modeler, layout_item);
522 }
523 else
524 {
525 Efl_Ui_List_View_Precise_Layouter_Callback_Data *cb_data = calloc(1, sizeof(Efl_Ui_List_View_Precise_Layouter_Callback_Data));
526 cb_data->pd = pd;
527 cb_data->item = layout_item;
528 evas_object_event_callback_add(layout_item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change, cb_data);
529 }
530 }
531 } 507 }
508
532 if ( (ecore_time_get() - start_time ) > 0.01 ) 509 if ( (ecore_time_get() - start_time ) > 0.01 )
533 { 510 {
534 ecore_job_del(pd->calc_job); 511 ecore_job_del(pd->calc_job);
535 pd->calc_job = ecore_job_add(_calc_size_job, obj); 512 pd->calc_job = ecore_job_add(_calc_size_job, obj);
536 eina_accessor_free(nodes); 513 eina_accessor_free(nodes);
537 return; 514 return;
538 } 515 }
539 } 516 }
540 eina_accessor_free(nodes); 517 eina_accessor_free(nodes);
541 pd->calc_progress = 0; 518 pd->calc_progress = 0;
542 pd->calc_job = NULL; 519 pd->calc_job = NULL;
543 pd->recalc = EINA_FALSE; 520 pd->recalc = EINA_FALSE;
544
545 evas_object_smart_changed(pd->modeler);
546} 521}
547 522
548EOLIAN static Efl_Object * 523EOLIAN static Efl_Object *
549_efl_ui_list_view_precise_layouter_efl_object_constructor(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd) 524_efl_ui_list_view_precise_layouter_efl_object_constructor(Eo *obj, Efl_Ui_List_View_Precise_Layouter_Data *pd)
550{ 525{
551 obj = efl_constructor(efl_super(obj, MY_CLASS)); 526 obj = efl_constructor(efl_super(obj, MY_CLASS));
552 pd->initialized = EINA_FALSE; 527 pd->initialized = EINA_FALSE;
@@ -554,6 +529,31 @@ _efl_ui_list_view_precise_layouter_efl_object_constructor(Eo *obj EINA_UNUSED, E
554 return obj; 529 return obj;
555} 530}
556 531
532EOLIAN static void
533_efl_ui_list_view_precise_layouter_efl_ui_list_view_relayout_content_created(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Ui_List_View_Layout_Item *item)
534{
535 Efl_Ui_List_View_Precise_Layouter_Callback_Data *cb_data;
536 EINA_SAFETY_ON_NULL_RETURN(item);
537 EINA_SAFETY_ON_NULL_RETURN(item->layout);
538 Efl_Ui_List_View_Seg_Array_Node *node = item->tree_node;
539 Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = node->layout_data;
540
541 Eina_Size2D min = _item_min_calc(pd, item);
542
543 if (min.w && min.h && !nodedata->realized)
544 {
545 efl_ui_list_view_model_unrealize(pd->modeler, item);
546 return;
547 }
548
549 cb_data = calloc(1, sizeof(Efl_Ui_List_View_Precise_Layouter_Callback_Data));
550 cb_data->pd = pd;
551 cb_data->item = item;
552 evas_object_event_callback_add(item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change, cb_data);
553
554 _item_size_calc(pd, item);
555}
556
557EOLIAN static Eina_List * 557EOLIAN static Eina_List *
558_efl_ui_list_view_precise_layouter_efl_ui_list_view_relayout_elements_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd) 558_efl_ui_list_view_precise_layouter_efl_ui_list_view_relayout_elements_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd)
559{ 559{
@@ -569,7 +569,7 @@ _efl_ui_list_view_precise_layouter_efl_ui_list_view_relayout_elements_get(const
569 if (!nodedata || !nodedata->realized) 569 if (!nodedata || !nodedata->realized)
570 continue; 570 continue;
571 571
572 for(j = 0; j != items_node->length;++j) 572 for (j = 0; j != items_node->length;++j)
573 { 573 {
574 layout_item = (Efl_Ui_List_View_Layout_Item *)items_node->pointers[j]; 574 layout_item = (Efl_Ui_List_View_Layout_Item *)items_node->pointers[j];
575 if (layout_item->layout) 575 if (layout_item->layout)
@@ -582,7 +582,7 @@ _efl_ui_list_view_precise_layouter_efl_ui_list_view_relayout_elements_get(const
582} 582}
583 583
584EOLIAN static void 584EOLIAN static void
585_efl_ui_list_view_precise_layouter_efl_ui_list_view_relayout_model_set(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Model *model) 585_efl_ui_list_view_precise_layouter_efl_ui_list_view_relayout_model_set(Eo *obj, Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_Model *model)
586{ 586{
587 _finalize(obj, pd); 587 _finalize(obj, pd);
588 588
@@ -607,11 +607,11 @@ _efl_ui_list_view_relayout_layout_do(Efl_Ui_List_View_Precise_Layouter_Data *pd)
607 Efl_Ui_List_View_Layout_Item* layout_item; 607 Efl_Ui_List_View_Layout_Item* layout_item;
608 Efl_Ui_List_View_Seg_Array_Node *items_node; 608 Efl_Ui_List_View_Seg_Array_Node *items_node;
609 int i, j = 0; 609 int i, j = 0;
610 int boxx, boxy, boxw, boxh, extra = 0, rounding = 0;
611 int boxl = 0, boxr = 0, boxt = 0, boxb = 0;
610 612
611 _calc_range(pd); 613 _calc_range(pd);
612 614
613 int boxx, boxy, boxw, boxh, extra = 0, rounding = 0;
614 int boxl = 0, boxr = 0, boxt = 0, boxb = 0;
615 evas_object_geometry_get(pd->modeler, &boxx, &boxy, &boxw, &boxh); 615 evas_object_geometry_get(pd->modeler, &boxx, &boxy, &boxw, &boxh);
616 efl_gfx_size_hint_margin_get(pd->modeler, &boxl, &boxr, &boxt, &boxb); 616 efl_gfx_size_hint_margin_get(pd->modeler, &boxl, &boxr, &boxt, &boxb);
617 617
@@ -621,13 +621,6 @@ _efl_ui_list_view_relayout_layout_do(Efl_Ui_List_View_Precise_Layouter_Data *pd)
621 boxx += boxl; 621 boxx += boxl;
622 boxy += boxt; 622 boxy += boxt;
623 623
624 //padding can not be squeezed (note: could make it an option)
625// int pad;
626// double scale;
627// scale = evas_object_scale_get(pd->modeler);
628// pad = 0;//pd->pad.scalable ? (pd->pad.v * scale) : pd->pad.v;
629// length -= pad * (pd->count_total - 1);
630
631 // available space. if <0 we overflow 624 // available space. if <0 we overflow
632 extra = boxh - pd->min.h; 625 extra = boxh - pd->min.h;
633 if (extra < 0) extra = 0; 626 if (extra < 0) extra = 0;
@@ -641,46 +634,50 @@ _efl_ui_list_view_relayout_layout_do(Efl_Ui_List_View_Precise_Layouter_Data *pd)
641 EINA_ACCESSOR_FOREACH(nodes, i, items_node) 634 EINA_ACCESSOR_FOREACH(nodes, i, items_node)
642 { 635 {
643 Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = items_node->layout_data; 636 Efl_Ui_List_View_Precise_Layouter_Node_Data *nodedata = items_node->layout_data;
644 if (!nodedata) 637 if (!items_node->layout_data)
638 continue;
639
640 if (!nodedata->realized)
645 { 641 {
646 continue; 642 cur_pos += nodedata->min.h;
643 continue;
647 } 644 }
648 645
649 if (nodedata->realized) 646 for (j = 0; j != items_node->length;++j)
650 { 647 {
651 for(j = 0; j != items_node->length;++j) 648 layout_item = (Efl_Ui_List_View_Layout_Item *)items_node->pointers[j];
649 double x, y, w, h;
650 double weight_x, weight_y;
651 if (!(layout_item->min.w && layout_item->min.h))
652 continue;
653
654 // extra rounding up (compensate cumulative error)
655 if ((i == (pd->count_total - 1)) && (cur_pos - floor(cur_pos) >= 0.5))
656 rounding = 1;
657
658 if (layout_item->layout)
652 { 659 {
653 layout_item = (Efl_Ui_List_View_Layout_Item *)items_node->pointers[j]; 660 if (pd->resize)
654 double x, y, w, h; 661 _item_size_calc(pd, layout_item);
655 double weight_x, weight_y; 662
656 663 efl_gfx_size_hint_weight_get(layout_item->layout, &weight_x, &weight_y);
657 if (layout_item->min.w && layout_item->min.h)
658 {
659 assert(layout_item->layout != NULL);
660 if (pd->resize)
661 _item_size_calc(pd, layout_item);
662
663 efl_gfx_size_hint_weight_get(layout_item->layout, &weight_x, &weight_y);
664 // extra rounding up (compensate cumulative error)
665 if ((i == (pd->count_total - 1)) && (cur_pos - floor(cur_pos) >= 0.5))
666 rounding = 1;
667
668 x = layout_item->pos.x;
669 y = layout_item->pos.y + cur_pos;
670 w = layout_item->size.w;
671 h = layout_item->size.h + rounding + weight_y * extra;
672 cur_pos += h;
673
674 if (w < pd->min.w) w = pd->min.w;
675 if (w > vgmt.w) w = vgmt.w;
676
677 evas_object_geometry_set(layout_item->layout, (x + 0 - spos.x), (y + 0 - spos.y), w, h);
678 }
679 } 664 }
680 } 665 else
681 else 666 {
682 { 667 cur_pos += layout_item->size.h;
683 cur_pos += nodedata->min.h; 668 continue;
669 }
670
671 x = layout_item->pos.x;
672 y = layout_item->pos.y + cur_pos;
673 w = layout_item->size.w;
674 h = layout_item->size.h + rounding + weight_y * extra;
675 cur_pos += h;
676
677 if (w < pd->min.w) w = pd->min.w;
678 if (w > vgmt.w) w = vgmt.w;
679
680 evas_object_geometry_set(layout_item->layout, (x + 0 - spos.x), (y + 0 - spos.y), w, h);
684 } 681 }
685 } 682 }
686 eina_accessor_free(nodes); 683 eina_accessor_free(nodes);
@@ -691,18 +688,15 @@ _efl_ui_list_view_relayout_layout_do(Efl_Ui_List_View_Precise_Layouter_Data *pd)
691EOLIAN static void 688EOLIAN static void
692_efl_ui_list_view_precise_layouter_efl_ui_list_view_relayout_layout_do 689_efl_ui_list_view_precise_layouter_efl_ui_list_view_relayout_layout_do
693 (Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd 690 (Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd
694 , Efl_Ui_List_View_Model *modeler, int first, Efl_Ui_List_View_Seg_Array *seg_array) 691 , Efl_Ui_List_View_Model *modeler, int first EINA_UNUSED, Efl_Ui_List_View_Seg_Array *seg_array)
695{ 692{
696 if (!_initilize(obj, pd, modeler, seg_array) || !pd->seg_array) 693 if (!_initilize(obj, pd, modeler, seg_array) || !pd->seg_array)
697 return; 694 return;
698 695
699 pd->first = first; 696 if (!pd->calc_job && pd->recalc && efl_ui_list_view_seg_array_count(seg_array) > 0)
700
701 if (pd->recalc && efl_ui_list_view_seg_array_count(seg_array) > 0)
702 { 697 {
703 // cache size of new items 698 // cache size of new items
704 pd->calc_progress = 0; 699 pd->calc_progress = 0;
705 ecore_job_del(pd->calc_job);
706 pd->calc_job = ecore_job_add(_calc_size_job, obj); 700 pd->calc_job = ecore_job_add(_calc_size_job, obj);
707 return; 701 return;
708 } 702 }
diff --git a/src/lib/elementary/efl_ui_list_view_precise_layouter.eo b/src/lib/elementary/efl_ui_list_view_precise_layouter.eo
index 9f953aa91c..9100f6967b 100644
--- a/src/lib/elementary/efl_ui_list_view_precise_layouter.eo
+++ b/src/lib/elementary/efl_ui_list_view_precise_layouter.eo
@@ -3,6 +3,7 @@ class Efl.Ui.List_View_Precise_Layouter (Efl.Object, Efl.Ui.List_View_Relayout)
3 implements { 3 implements {
4 Efl.Object.constructor; 4 Efl.Object.constructor;
5 Efl.Ui.List_View_Relayout.layout_do; 5 Efl.Ui.List_View_Relayout.layout_do;
6 Efl.Ui.List_View_Relayout.content_created;
6 Efl.Ui.List_View_Relayout.model { set; } 7 Efl.Ui.List_View_Relayout.model { set; }
7 Efl.Ui.List_View_Relayout.elements { get; } 8 Efl.Ui.List_View_Relayout.elements { get; }
8 } 9 }
diff --git a/src/lib/elementary/efl_ui_list_view_relayout.eo b/src/lib/elementary/efl_ui_list_view_relayout.eo
index ac6cd788bc..e5359b79d5 100644
--- a/src/lib/elementary/efl_ui_list_view_relayout.eo
+++ b/src/lib/elementary/efl_ui_list_view_relayout.eo
@@ -8,6 +8,11 @@ interface Efl.Ui.List_View_Relayout (Efl.Interface)
8 children: Efl.Ui.List_View_Seg_Array; 8 children: Efl.Ui.List_View_Seg_Array;
9 } 9 }
10 } 10 }
11 content_created {
12 params {
13 item: ptr(Efl.Ui.List_View_Layout_Item);
14 }
15 }
11 @property model { 16 @property model {
12 [[Model that is/will be ]] 17 [[Model that is/will be ]]
13 set {} 18 set {}