aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2017-11-03 19:14:04 -0200
committerSangHyeon Jade Lee <dltkdgus1764@gmail.com>2017-11-15 17:06:45 +0900
commit71d9948250e6a654eafea7ee83e4700caf0d7cf3 (patch)
tree6295ce965f61eee6cd15e4534b1aa96664685519
parentelm: Add group iterator to segarray (diff)
downloadefl-71d9948250e6a654eafea7ee83e4700caf0d7cf3.tar.gz
elm: Create iteration by node with segarray
-rw-r--r--src/lib/elementary/efl_ui_list.c26
-rw-r--r--src/lib/elementary/efl_ui_list_precise_layouter.c28
-rw-r--r--src/lib/elementary/efl_ui_list_private.h6
-rw-r--r--src/lib/elementary/efl_ui_list_segarray.c17
-rw-r--r--src/lib/elementary/efl_ui_list_segarray.h4
5 files changed, 49 insertions, 32 deletions
diff --git a/src/lib/elementary/efl_ui_list.c b/src/lib/elementary/efl_ui_list.c
index 9c13eff014..b0e055e47c 100644
--- a/src/lib/elementary/efl_ui_list.c
+++ b/src/lib/elementary/efl_ui_list.c
@@ -64,7 +64,7 @@ _horiz(Efl_Orient dir)
EOLIAN static void
_efl_ui_list_pan_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_List_Pan_Data *psd)
{
- DBG("");
+ //DBG("");
/* if (pd->recalc) return; */
/* _efl_ui_list_custom_layout(obj); */
@@ -235,8 +235,8 @@ _long_press_cb(void *data)
item->long_timer = NULL;
item->longpressed = EINA_TRUE;
- if (item->layout)
- efl_event_callback_legacy_call(item->layout, EFL_UI_EVENT_LONGPRESSED, item);
+ if (item->item.layout)
+ efl_event_callback_legacy_call(item->item.layout, EFL_UI_EVENT_LONGPRESSED, item);
return ECORE_CALLBACK_CANCEL;
}
@@ -352,7 +352,7 @@ _item_style_property_then(void * data, Efl_Event const* event)
if (vtype == EINA_VALUE_TYPE_STRING || vtype == EINA_VALUE_TYPE_STRINGSHARE)
eina_value_get(value, &style);
- elm_object_style_set(item->layout, style);
+ elm_object_style_set(item->item.layout, style);
}
static void
@@ -381,7 +381,7 @@ _efl_model_properties_changed_cb(void *data, const Efl_Event *event)
{
if (prop == sprop)
{
- item->future = efl_model_property_get(item->model, sprop);
+ item->future = efl_model_property_get(item->item.children, sprop);
efl_future_then(item->future, &_item_selected_then, &_item_property_error, NULL, item);
}
}
@@ -467,14 +467,14 @@ _layout_unrealize(Efl_Ui_List_Data *pd, Efl_Ui_List_Item *item)
/* TODO:calculate new min */
//_item_min_calc(pd, item, 0, 0);
- evt.child = item->model;
- evt.layout = item->layout;
- evt.index = item->index;
+ evt.child = item->item.children;
+ evt.layout = item->item.layout;
+ evt.index = item->item.index;
efl_event_callback_call(item->list, EFL_UI_LIST_EVENT_ITEM_UNREALIZED, &evt);
- efl_ui_view_model_set(item->layout, NULL);
+ efl_ui_view_model_set(item->item.layout, NULL);
- evas_object_hide(item->layout);
- evas_object_move(item->layout, -9999, -9999);
+ evas_object_hide(item->item.layout);
+ evas_object_move(item->item.layout, -9999, -9999);
}
/* static Efl_Ui_List_Item* */
@@ -1183,7 +1183,7 @@ _efl_ui_list_efl_access_selection_selected_child_get(Eo *obj EINA_UNUSED, Efl_Ui
if(child_index < (int) eina_list_count(pd->selected_items))
{
Efl_Ui_List_Item* items = eina_list_nth(pd->selected_items, child_index);
- return items[child_index].layout;
+ return items[child_index].item.layout;
}
else
return NULL;
@@ -1452,7 +1452,7 @@ _layout(Efl_Ui_List_Data *pd)
if (!pd->model)
return;
- Eina_Accessor* accessor = efl_ui_list_segarray_accessor_get(&pd->segarray);
+ Eina_Accessor* accessor = efl_ui_list_segarray_node_accessor_get(&pd->segarray);
efl_ui_list_relayout_layout_do(pd->relayout, pd->obj, pd->segarray_first,
efl_ui_list_segarray_count(&pd->segarray), accessor);
diff --git a/src/lib/elementary/efl_ui_list_precise_layouter.c b/src/lib/elementary/efl_ui_list_precise_layouter.c
index 03c8ec1726..6298ecdfdc 100644
--- a/src/lib/elementary/efl_ui_list_precise_layouter.c
+++ b/src/lib/elementary/efl_ui_list_precise_layouter.c
@@ -7,6 +7,7 @@
#include <assert.h>
#include "elm_priv.h"
+#include "efl_ui_list_segarray.h"
#undef DBG
#define DBG(...) do { \
@@ -218,11 +219,12 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_model_set(Eo *obj EINA_UNUSED
EOLIAN static void
_efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
(Eo *obj EINA_UNUSED, Efl_Ui_List_Precise_Layouter_Data *pd
- , Efl_Ui_List_Model *modeler, int first, int count, Eina_Accessor *items)
+ , Efl_Ui_List_Model *modeler, int first, int count, Eina_Accessor *nodes)
{
Efl_Ui_List_LayoutItem* layout_item;
+ Efl_Ui_List_SegArray_Node* items_node;
Efl_Ui_List_Precise_Layouter_Size* size;
- int i = 0;
+ int i = 0, j = 0;
Eina_Bool horiz = EINA_FALSE/*_horiz(pd->orient)*/, zeroweight = EINA_FALSE;
Evas_Coord ow, oh, want, minw, minh, scr_x, scr_y;
int boxx, boxy, boxw, boxh, length, /*pad, */extra = 0, rounding = 0;
@@ -231,25 +233,29 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
Eina_Bool box_fill[2] = { EINA_FALSE, EINA_FALSE };
DBG("layout_do first %d count %d", first, count);
- EINA_SAFETY_ON_NULL_RETURN(items);
+ /* EINA_SAFETY_ON_NULL_RETURN(items); */
_initilize(obj, pd, modeler);
// cache size of new items
- EINA_ACCESSOR_FOREACH(items, i, layout_item)
+ EINA_ACCESSOR_FOREACH(nodes, i, items_node)
{
+ DBG("node first %d", items_node->first);
+ for(j = 0; j != items_node->length; ++j)
+ {
+ layout_item = items_node->pointers[j];
+
size = eina_hash_find(pd->size_information, &layout_item);
-// DBG("size %p", size);
if(!size)
{
if(!layout_item->layout)
{
-// DBG("no layout, realizing");
+ DBG("no layout, realizing");
efl_ui_list_model_realize(modeler, layout_item);
}
else
{
-// DBG("already realized");
+ DBG("already realized");
/* if(!layout_item->layout) */
/* { */
/* // error */
@@ -270,6 +276,7 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
cb_data->size = size;
evas_object_event_callback_add(layout_item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change, cb_data);
}
+ }
}
evas_object_geometry_get(modeler, &boxx, &boxy, &boxw, &boxh);
@@ -375,8 +382,12 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
/* cur_pos += average_item_size * pd->realized.start; */
/* // scan all items, get their properties, calculate total weight & min size */
// cache size of new items
- EINA_ACCESSOR_FOREACH(items, i, layout_item)
+ /* EINA_ACCESSOR_FOREACH(items, i, layout_item) */
+ EINA_ACCESSOR_FOREACH(nodes, i, items_node)
{
+ for(j = 0; j != items_node->length;++j)
+ {
+ layout_item = items_node->pointers[j];
double cx, cy, cw, ch, x, y, w, h;
double align[2];
int item_pad[4];
@@ -496,6 +507,7 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
/* // printf("obj=%d currpos=%.2f moved to X=%.2f, Y=%.2f average_item_size %d\n", litem->index, cur_pos, x, y */
/* // , eina_inarray_count(&pd->items.array) ? (/\*horz*\/ EINA_FALSE ? pd->realized.w : pd->realized.h) / eina_inarray_count(&pd->items.array) : AVERAGE_SIZE_INIT); */
}
+ }
}
}
diff --git a/src/lib/elementary/efl_ui_list_private.h b/src/lib/elementary/efl_ui_list_private.h
index be88bf34d1..7c4d2541ea 100644
--- a/src/lib/elementary/efl_ui_list_private.h
+++ b/src/lib/elementary/efl_ui_list_private.h
@@ -17,11 +17,9 @@ typedef struct _Efl_Ui_List_Data Efl_Ui_List_Data;
struct _Efl_Ui_List_Item
{
- Efl_Ui_List *list;
- Efl_Model *model;
- Efl_Ui_Layout *layout;
+ Efl_Ui_List_LayoutItem item;
Efl_Future *future;
- unsigned int index;
+ Efl_Ui_List *list;
// Evas_Coord x, y, minw, minh, w, h;
// // double h, v, wx, wy;
// double wx, wy;
diff --git a/src/lib/elementary/efl_ui_list_segarray.c b/src/lib/elementary/efl_ui_list_segarray.c
index dcdf61026f..fced099e52 100644
--- a/src/lib/elementary/efl_ui_list_segarray.c
+++ b/src/lib/elementary/efl_ui_list_segarray.c
@@ -92,8 +92,8 @@ void efl_ui_list_segarray_setup(Efl_Ui_List_SegArray* segarray, //int member_siz
static Efl_Ui_List_Item* _create_item(Efl_Model* model, unsigned int index)
{
Efl_Ui_List_Item* item = calloc(1, sizeof(Efl_Ui_List_Item));
- item->model = model;
- item->index = index;
+ item->item.children = model;
+ item->item.index = index;
return item;
}
@@ -234,7 +234,7 @@ _efl_ui_list_segarray_node_accessor_get_at(Efl_Ui_List_Segarray_Node_Accessor* a
}
else
{
- if(acc->current_index > idx && acc->current_node)
+ if(acc->current_index >= idx || !acc->current_node)
{
eina_iterator_free(acc->pre_iterator);
acc->pre_iterator = NULL;
@@ -242,16 +242,19 @@ _efl_ui_list_segarray_node_accessor_get_at(Efl_Ui_List_Segarray_Node_Accessor* a
acc->current_index = -1;
}
- if(!acc->pre_iterator) // && acc->current_index <= idx
- acc->pre_iterator = eina_rbtree_iterator_prefix((void*)acc->segarray->root);
+ if(!acc->pre_iterator)
+ acc->pre_iterator = eina_rbtree_iterator_infix((void*)acc->segarray->root);
-
- for(;acc->current_index < idx;++acc->current_index)
+ for(;acc->current_index != idx;++acc->current_index)
+ {
+ DBG("for current_index: %d idx: %d", acc->current_index, idx);
if(!eina_iterator_next(acc->pre_iterator, (void**)&acc->current_node))
{
--acc->current_index;
return EINA_FALSE;
}
+ }
+ DBG("out of loop");
(*data) = acc->current_node;
return EINA_TRUE;
}
diff --git a/src/lib/elementary/efl_ui_list_segarray.h b/src/lib/elementary/efl_ui_list_segarray.h
index 904151499d..630593c2e5 100644
--- a/src/lib/elementary/efl_ui_list_segarray.h
+++ b/src/lib/elementary/efl_ui_list_segarray.h
@@ -3,6 +3,8 @@
#include "efl_ui_list_segarray.h"
+typedef struct _Efl_Ui_List_Item Efl_Ui_List_Item;
+
typedef struct _Efl_Ui_List_SegArray_Node
{
EINA_RBTREE;
@@ -27,6 +29,8 @@ typedef struct _Efl_Ui_List_SegArray
Eina_Accessor* efl_ui_list_segarray_accessor_get(Efl_Ui_List_SegArray* segarray);
Eina_Accessor* efl_ui_list_segarray_node_accessor_get(Efl_Ui_List_SegArray* segarray);
+Efl_Ui_List_SegArray_Node* efl_ui_list_segarray_item_node_get(Efl_Ui_List_SegArray* segarray,
+ Efl_Ui_List_Item* item);
void efl_ui_list_segarray_insert_accessor(Efl_Ui_List_SegArray* segarray, int first, Eina_Accessor* accessor);
int efl_ui_list_segarray_count(Efl_Ui_List_SegArray const* segarray);
void efl_ui_list_segarray_setup(Efl_Ui_List_SegArray* segarray, //int member_size,