summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-02-23 17:10:16 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-02-27 09:26:41 +0900
commitbb38083287b963a63439f87a619ba514d89ded9c (patch)
treeb8ef893fdaec5edc1203af3f1bd398d38bfd496d /src/lib/elementary
parent519b782ff297ddacd03b34d5d20ca90f0d9b5861 (diff)
genlist: (Mostly) fix item index odd/even styles
This fixes the internal item order index. Note that groups don't reset the odd/even styles. The original code wasn't very clear on the intent (setting to 0 in one case, not increasing the counter in another, but that was not consistent all over the place). I believe resetting the odd/even styles at a group boundary would look great, but this might be for another patch :) This amends part of another commit, but keeps its feature: b40a6eb85bf44a genlist: implement list position signals. See T3086 PS: I've discovered more odd/even issues with the fileselector in particular. Still working on it... @fix
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/elm_genlist.c58
-rw-r--r--src/lib/elementary/elm_widget_genlist.h3
2 files changed, 27 insertions, 34 deletions
diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c
index 1404f41ae0..7a49e47a6c 100644
--- a/src/lib/elementary/elm_genlist.c
+++ b/src/lib/elementary/elm_genlist.c
@@ -781,7 +781,7 @@ _calc_job(void *data)
781 itb->w = minw; 781 itb->w = minw;
782 itb->h = itb->minh; 782 itb->h = itb->minh;
783 y += itb->h; 783 y += itb->h;
784 in += itb->count; 784 in += itb->vis_count;
785 if ((show_me) && (sd->show_item) && (!sd->show_item->item->queued)) 785 if ((show_me) && (sd->show_item) && (!sd->show_item->item->queued))
786 sd->check_scroll = EINA_TRUE; 786 sd->check_scroll = EINA_TRUE;
787 } 787 }
@@ -1277,32 +1277,24 @@ _elm_genlist_item_position_state_update(Elm_Gen_Item *it)
1277} 1277}
1278 1278
1279static void 1279static void
1280_item_order_update(const Eina_Inlist *l, 1280_item_order_update(Elm_Gen_Item *it_base, const int start)
1281 int start)
1282{ 1281{
1283 Elm_Gen_Item *it, *it2; 1282 Elm_Gen_Item *it;
1284 1283 Item_Block *itb_base;
1285 /* 1284 int index = start;
1286 * always update position state of previous item, it may have been
1287 * marked as "single" if it was the only element at the time, or
1288 * "middle", "first" or "last" in the case of insert into different
1289 * positions.
1290 */
1291 if ((l->prev) && (start > 0))
1292 {
1293 it = ELM_GEN_ITEM_FROM_INLIST(l->prev);
1294 it->item->order_num_in = start - 1;
1295 _elm_genlist_item_position_state_update(it);
1296 }
1297 1285
1298 for (it = ELM_GEN_ITEM_FROM_INLIST(l); l; l = l->next, 1286 itb_base = it_base->item->block;
1299 it = ELM_GEN_ITEM_FROM_INLIST(l)) 1287 EINA_INLIST_FOREACH(EINA_INLIST_GET(it_base), it)
1300 { 1288 {
1301 it->item->order_num_in = start++; 1289 if (it->hide) continue;
1290 if (it->item->block != itb_base)
1291 {
1292 if (it->item->block && (it->item->block->num != index))
1293 it->item->block->changed = EINA_TRUE;
1294 break;
1295 }
1296 it->item->order_num_in = index++;
1302 _elm_genlist_item_position_state_update(it); 1297 _elm_genlist_item_position_state_update(it);
1303 it2 = ELM_GEN_ITEM_FROM_INLIST(l->next);
1304 if (it2 && (it->item->order_num_in != it2->item->order_num_in))
1305 return;
1306 } 1298 }
1307} 1299}
1308 1300
@@ -1792,26 +1784,23 @@ _elm_genlist_item_focus_update(Elm_Gen_Item *it)
1792} 1784}
1793 1785
1794static void 1786static void
1795_item_realize(Elm_Gen_Item *it, 1787_item_realize(Elm_Gen_Item *it, const int index, Eina_Bool calc)
1796 int in,
1797 Eina_Bool calc)
1798{ 1788{
1799 const char *treesize; 1789 const char *treesize;
1800 Item_Size *size = NULL; 1790 Item_Size *size = NULL;
1801 int tsize = 20; 1791 int tsize = 20;
1792 int in = index;
1802 ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd); 1793 ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
1803 1794
1804 if (it->realized) 1795 if (it->realized)
1805 { 1796 {
1806 if (it->item->order_num_in != in) 1797 if (it->item->order_num_in != in)
1807 { 1798 {
1808 _item_order_update(EINA_INLIST_GET(it), in); 1799 _item_order_update(it, in);
1809 _elm_genlist_item_state_update(it);
1810 _elm_genlist_item_index_update(it); 1800 _elm_genlist_item_index_update(it);
1811 } 1801 }
1812 return; 1802 return;
1813 } 1803 }
1814 it->item->order_num_in = in;
1815 1804
1816 if (sd->tree_effect_enabled || 1805 if (sd->tree_effect_enabled ||
1817 (!_item_cache_find(it))) 1806 (!_item_cache_find(it)))
@@ -1824,7 +1813,7 @@ _item_realize(Elm_Gen_Item *it,
1824 /* access */ 1813 /* access */
1825 if (_elm_config->access_mode) _access_widget_item_register(it); 1814 if (_elm_config->access_mode) _access_widget_item_register(it);
1826 1815
1827 _item_order_update(EINA_INLIST_GET(it), in); 1816 _item_order_update(it, in);
1828 1817
1829 if (sd->reorder_mode) 1818 if (sd->reorder_mode)
1830 edje_object_signal_emit(VIEW(it), SIGNAL_REORDER_MODE_SET, "elm"); 1819 edje_object_signal_emit(VIEW(it), SIGNAL_REORDER_MODE_SET, "elm");
@@ -2201,7 +2190,7 @@ _group_items_recalc(void *data)
2201 { 2190 {
2202 if (git->item->want_realize) 2191 if (git->item->want_realize)
2203 { 2192 {
2204 if (!git->realized) _item_realize(git, 0, EINA_FALSE); 2193 if (!git->realized) _item_realize(git, git->item->order_num_in, EINA_FALSE);
2205 evas_object_resize(VIEW(git), sd->minw, git->item->h); 2194 evas_object_resize(VIEW(git), sd->minw, git->item->h);
2206 evas_object_move(VIEW(git), git->item->scrl_x, git->item->scrl_y); 2195 evas_object_move(VIEW(git), git->item->scrl_x, git->item->scrl_y);
2207 evas_object_stack_above(VIEW(git), sd->stack[1]); 2196 evas_object_stack_above(VIEW(git), sd->stack[1]);
@@ -2421,13 +2410,13 @@ _item_block_position(Item_Block *itb,
2421 _elm_genlist_item_unrealize(it, EINA_FALSE); 2410 _elm_genlist_item_unrealize(it, EINA_FALSE);
2422 } 2411 }
2423 } 2412 }
2424 in++;
2425 } 2413 }
2426 else 2414 else
2427 { 2415 {
2428 if (vis) it->item->want_realize = EINA_TRUE; 2416 if (vis) it->item->want_realize = EINA_TRUE;
2429 } 2417 }
2430 y += it->item->h; 2418 y += it->item->h;
2419 in++;
2431 } 2420 }
2432 evas_event_thaw(evas_object_evas_get((itb->sd)->obj)); 2421 evas_event_thaw(evas_object_evas_get((itb->sd)->obj));
2433 evas_event_thaw_eval(evas_object_evas_get((itb->sd)->obj)); 2422 evas_event_thaw_eval(evas_object_evas_get((itb->sd)->obj));
@@ -2516,7 +2505,7 @@ _elm_genlist_pan_efl_canvas_group_group_calculate(Eo *obj, Elm_Genlist_Pan_Data
2516 { 2505 {
2517 if (itb->realized) _item_block_unrealize(itb); 2506 if (itb->realized) _item_block_unrealize(itb);
2518 } 2507 }
2519 in += itb->count; 2508 in += itb->vis_count;
2520 } 2509 }
2521 if ((!sd->reorder_it) || (sd->reorder_pan_move)) 2510 if ((!sd->reorder_it) || (sd->reorder_pan_move))
2522 _group_items_recalc(sd); 2511 _group_items_recalc(sd);
@@ -5195,6 +5184,7 @@ _item_block_recalc(Item_Block *itb,
5195 Eina_Bool show_me = EINA_FALSE, changed = EINA_FALSE; 5184 Eina_Bool show_me = EINA_FALSE, changed = EINA_FALSE;
5196 Evas_Coord y = 0; 5185 Evas_Coord y = 0;
5197 Item_Size *size = NULL; 5186 Item_Size *size = NULL;
5187 int vis_count = 0;
5198 5188
5199 itb->num = in; 5189 itb->num = in;
5200 EINA_LIST_FOREACH(itb->items, l, it) 5190 EINA_LIST_FOREACH(itb->items, l, it)
@@ -5207,6 +5197,7 @@ _item_block_recalc(Item_Block *itb,
5207 if (it->realized) evas_object_hide(VIEW(it)); 5197 if (it->realized) evas_object_hide(VIEW(it));
5208 continue; 5198 continue;
5209 } 5199 }
5200 vis_count++;
5210 if (!itb->realized) 5201 if (!itb->realized)
5211 { 5202 {
5212 if (itb->sd->homogeneous && 5203 if (itb->sd->homogeneous &&
@@ -5264,6 +5255,7 @@ _item_block_recalc(Item_Block *itb,
5264 itb->minh = minh; 5255 itb->minh = minh;
5265 itb->changed = EINA_FALSE; 5256 itb->changed = EINA_FALSE;
5266 itb->position_update = EINA_FALSE; 5257 itb->position_update = EINA_FALSE;
5258 itb->vis_count = vis_count;
5267 5259
5268 return show_me; 5260 return show_me;
5269} 5261}
diff --git a/src/lib/elementary/elm_widget_genlist.h b/src/lib/elementary/elm_widget_genlist.h
index f215d8dd5b..5a1f4e8008 100644
--- a/src/lib/elementary/elm_widget_genlist.h
+++ b/src/lib/elementary/elm_widget_genlist.h
@@ -228,7 +228,7 @@ struct Elm_Gen_Item_Type
228 Eina_List *rel_revs; // FIXME: find better way not to use this 228 Eina_List *rel_revs; // FIXME: find better way not to use this
229 Evas_Object *deco_it_view; 229 Evas_Object *deco_it_view;
230 int expanded_depth; 230 int expanded_depth;
231 int order_num_in; 231 int order_num_in; // Written by _item_order_update()
232 232
233 Eina_Bool decorate_all_item_realized : 1; 233 Eina_Bool decorate_all_item_realized : 1;
234 Eina_Bool tree_effect_finished : 1; /* tree effect */ 234 Eina_Bool tree_effect_finished : 1; /* tree effect */
@@ -255,6 +255,7 @@ struct _Item_Block
255 EINA_INLIST; 255 EINA_INLIST;
256 256
257 int count; 257 int count;
258 int vis_count;
258 int num; 259 int num;
259 int reorder_offset; 260 int reorder_offset;
260 Elm_Genlist_Data *sd; 261 Elm_Genlist_Data *sd;