summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLarry Jr <larry.olj@gmail.com>2017-10-30 16:48:47 -0200
committerSangHyeon Jade Lee <dltkdgus1764@gmail.com>2017-11-15 17:06:45 +0900
commit19efd4d826f8d4fb4b87973090151932052b4fb4 (patch)
tree8961ff79db2a2b298c58568b9f165df12e3b1863
parent71d9948250e6a654eafea7ee83e4700caf0d7cf3 (diff)
Elm: precise layout scroll width fixed
-rw-r--r--src/lib/elementary/efl_ui_list.c2
-rw-r--r--src/lib/elementary/efl_ui_list_precise_layouter.c66
2 files changed, 16 insertions, 52 deletions
diff --git a/src/lib/elementary/efl_ui_list.c b/src/lib/elementary/efl_ui_list.c
index b0e055e47c..18b603a9e5 100644
--- a/src/lib/elementary/efl_ui_list.c
+++ b/src/lib/elementary/efl_ui_list.c
@@ -19,7 +19,6 @@
19#define SIG_CHILD_ADDED "child,added" 19#define SIG_CHILD_ADDED "child,added"
20#define SIG_CHILD_REMOVED "child,removed" 20#define SIG_CHILD_REMOVED "child,removed"
21#define SELECTED_PROP "selected" 21#define SELECTED_PROP "selected"
22#define AVERAGE_SIZE_INIT 10
23 22
24#undef DBG 23#undef DBG
25#define DBG(...) do { \ 24#define DBG(...) do { \
@@ -1498,6 +1497,7 @@ _efl_ui_list_efl_ui_list_model_realize(Eo *obj, Efl_Ui_List_Data *pd, Efl_Ui_Lis
1498 EINA_SAFETY_ON_NULL_RETURN_VAL(item->children, item); 1497 EINA_SAFETY_ON_NULL_RETURN_VAL(item->children, item);
1499 1498
1500 item->layout = efl_ui_factory_create(pd->factory, item->children, obj); 1499 item->layout = efl_ui_factory_create(pd->factory, item->children, obj);
1500// elm_widget_sub_object_add(obj, item->layout);
1501// evas_object_event_callback_del_full(item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change, item); 1501// evas_object_event_callback_del_full(item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change, item);
1502 efl_ui_view_model_set(item->layout, item->children); 1502 efl_ui_view_model_set(item->layout, item->children);
1503 1503
diff --git a/src/lib/elementary/efl_ui_list_precise_layouter.c b/src/lib/elementary/efl_ui_list_precise_layouter.c
index 6298ecdfdc..1091298f19 100644
--- a/src/lib/elementary/efl_ui_list_precise_layouter.c
+++ b/src/lib/elementary/efl_ui_list_precise_layouter.c
@@ -226,8 +226,8 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
226 Efl_Ui_List_Precise_Layouter_Size* size; 226 Efl_Ui_List_Precise_Layouter_Size* size;
227 int i = 0, j = 0; 227 int i = 0, j = 0;
228 Eina_Bool horiz = EINA_FALSE/*_horiz(pd->orient)*/, zeroweight = EINA_FALSE; 228 Eina_Bool horiz = EINA_FALSE/*_horiz(pd->orient)*/, zeroweight = EINA_FALSE;
229 Evas_Coord ow, oh, want, minw, minh, scr_x, scr_y; 229 Evas_Coord ow, oh, want, scr_x, scr_y;
230 int boxx, boxy, boxw, boxh, length, /*pad, */extra = 0, rounding = 0; 230 int boxx, boxy, boxw, boxh, length, pad, extra = 0, rounding = 0;
231 int boxl = 0, boxr = 0, boxt = 0, boxb = 0; 231 int boxl = 0, boxr = 0, boxt = 0, boxb = 0;
232 double cur_pos = 0, scale, box_align[2], weight[2] = { 0, 0 }; 232 double cur_pos = 0, scale, box_align[2], weight[2] = { 0, 0 };
233 Eina_Bool box_fill[2] = { EINA_FALSE, EINA_FALSE }; 233 Eina_Bool box_fill[2] = { EINA_FALSE, EINA_FALSE };
@@ -283,8 +283,8 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
283 efl_gfx_size_hint_margin_get(modeler, &boxl, &boxr, &boxt, &boxb); 283 efl_gfx_size_hint_margin_get(modeler, &boxl, &boxr, &boxt, &boxb);
284 284
285 scale = evas_object_scale_get(modeler); 285 scale = evas_object_scale_get(modeler);
286/* // Box align: used if "item has max size and fill" or "no item has a weight" */ 286 // Box align: used if "item has max size and fill" or "no item has a weight"
287/* // Note: cells always expand on the orthogonal direction */ 287 // Note: cells always expand on the orthogonal direction
288 box_align[0] = 0;/*pd->align.h;*/ 288 box_align[0] = 0;/*pd->align.h;*/
289 box_align[1] = 0;/*pd->align.v;*/ 289 box_align[1] = 0;/*pd->align.v;*/
290 if (box_align[0] < 0) 290 if (box_align[0] < 0)
@@ -298,62 +298,33 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
298 box_align[1] = 0.5; 298 box_align[1] = 0.5;
299 } 299 }
300 300
301/* count = eina_inarray_count(&pd->items.array); */
302
303 // box outer margin 301 // box outer margin
304 boxw -= boxl + boxr; 302 boxw -= boxl + boxr;
305 boxh -= boxt + boxb; 303 boxh -= boxt + boxb;
306 boxx += boxl; 304 boxx += boxl;
307 boxy += boxt; 305 boxy += boxt;
308 306
309 int average_item_size = 10; //eina_inarray_count(&pd->items.array) ? (/*horz*/ EINA_FALSE ? pd->realized.w : pd->realized.h) / eina_inarray_count(&pd->items.array) : AVERAGE_SIZE_INIT;
310 if(!average_item_size)
311 average_item_size = 10;//AVERAGE_SIZE_INIT;
312
313 // total space & available space 307 // total space & available space
314 if (horiz) 308 if (horiz)
315 { 309 {
316 int pad;
317 length = boxw; 310 length = boxw;
318 want = 100;//pd->realized.w; 311 want = pd->min.w;
319 //pad = pd->pad.scalable ? (pd->pad.h * scale) : pd->pad.h; 312 pad = 0;//pd->pad.scalable ? (pd->pad.h * scale) : pd->pad.h;
320 pad = 0;
321
322 // padding can not be squeezed (note: could make it an option)
323 length -= pad * (count - 1);
324 // available space. if <0 we overflow
325 extra = length - want;
326
327 minw = 100;//pd->realized.w + boxl + boxr + pad * (count - 1);
328 minh = 100;//pd->realized.h + boxt + boxb;
329 /* if (pd->item_count > count) */
330 /* minw = pd->item_count * average_item_size; */
331 } 313 }
332 else 314 else
333 { 315 {
334 int pad;
335 length = boxh; 316 length = boxh;
336 want = pd->min.h; 317 want = pd->min.h;
337 pad = 0;//pd->pad.scalable ? (pd->pad.v * scale) : pd->pad.v; 318 pad = 0;//pd->pad.scalable ? (pd->pad.v * scale) : pd->pad.v;
338
339 //FIXME?? use eina_hash_population(pd->size_information) or count
340 int population = eina_hash_population(pd->size_information);
341 // padding can not be squeezed (note: could make it an option)
342 length -= pad * (population - 1); //(count - 1);
343 // available space. if <0 we overflow
344 extra = length - want;
345
346 minw = pd->min.w + boxl + boxr;
347 minh = pd->min.h + pad * (/*count*/ population - 1) + boxt + boxb;
348 if (pd->count_total > population) //count)
349 minh *= (pd->count_total / population); //count);
350 } 319 }
351 320
352// if (pd->min.h != minh || pd->min.w != minw) 321 // padding can not be squeezed (note: could make it an option)
353// { 322 length -= pad * (eina_hash_population(pd->size_information) - 1);
354// pd->min.w = minw; 323 // available space. if <0 we overflow
355// pd->min.h = minh; 324 extra = length - want;
356// } 325
326 /* Evas_Coord minw = pd->min.w + boxl + boxr; */
327 /* Evas_Coord minh = pd->min.h + boxt + boxb; */
357 328
358 efl_ui_list_model_min_size_set(modeler, pd->min); 329 efl_ui_list_model_min_size_set(modeler, pd->min);
359 if (extra < 0) extra = 0; 330 if (extra < 0) extra = 0;
@@ -379,8 +350,7 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
379 (modeler, NULL, NULL, &ow, &oh); 350 (modeler, NULL, NULL, &ow, &oh);
380 351
381 elm_interface_scrollable_content_pos_get(modeler, &scr_x, &scr_y); 352 elm_interface_scrollable_content_pos_get(modeler, &scr_x, &scr_y);
382/* cur_pos += average_item_size * pd->realized.start; */ 353 // scan all items, get their properties, calculate total weight & min size
383/* // scan all items, get their properties, calculate total weight & min size */
384 // cache size of new items 354 // cache size of new items
385 /* EINA_ACCESSOR_FOREACH(items, i, layout_item) */ 355 /* EINA_ACCESSOR_FOREACH(items, i, layout_item) */
386 EINA_ACCESSOR_FOREACH(nodes, i, items_node) 356 EINA_ACCESSOR_FOREACH(nodes, i, items_node)
@@ -415,7 +385,7 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
415 if (max.w < size->min.w) max.w = size->min.w; 385 if (max.w < size->min.w) max.w = size->min.w;
416 if (max.h < size->min.h) max.h = size->min.h; 386 if (max.h < size->min.h) max.h = size->min.h;
417 387
418 /* // extra rounding up (compensate cumulative error) */ 388 // extra rounding up (compensate cumulative error)
419 if ((i == (count - 1)) && (cur_pos - floor(cur_pos) >= 0.5)) 389 if ((i == (count - 1)) && (cur_pos - floor(cur_pos) >= 0.5))
420 rounding = 1; 390 rounding = 1;
421 391
@@ -500,12 +470,6 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
500 470
501 /* layout_item->x = x; */ 471 /* layout_item->x = x; */
502 /* layout_item->y = y; */ 472 /* layout_item->y = y; */
503
504/* // fprintf(stderr, "x: %.2f y: %.2f w: %.2f h: %.2f old x: %.2f old y: %.2f old w: %.2f old h: %.2f\n" */
505/* // , (x + 0 - pd->pan.x), (y + 0 - pd->pan.y), (float)w, (float)h */
506/* // , (float)litem->x, (float)litem->y, (float)litem->w, (float)litem->h); fflush(stderr); */
507/* // printf("obj=%d currpos=%.2f moved to X=%.2f, Y=%.2f average_item_size %d\n", litem->index, cur_pos, x, y */
508/* // , eina_inarray_count(&pd->items.array) ? (/\*horz*\/ EINA_FALSE ? pd->realized.w : pd->realized.h) / eina_inarray_count(&pd->items.array) : AVERAGE_SIZE_INIT); */
509 } 473 }
510 } 474 }
511 } 475 }