forked from enlightenment/efl
genlist: code refactoring.
there are 2 variables that has same purpose. cut off one dependency.
This commit is contained in:
parent
92deae574a
commit
94f530fca9
|
@ -617,7 +617,7 @@ _item_block_unrealize(Item_Block *itb)
|
|||
|
||||
EINA_LIST_FOREACH(itb->items, l, it)
|
||||
{
|
||||
if (itb->must_recalc || !it->group)
|
||||
if (itb->must_recalc || (GL_IT(it)->type != ELM_GENLIST_ITEM_GROUP))
|
||||
{
|
||||
if (it->dragging)
|
||||
{
|
||||
|
@ -1705,10 +1705,10 @@ _item_realize(Elm_Gen_Item *it,
|
|||
|
||||
/* homogeneous genlist shortcut */
|
||||
if ((calc) && (sd->homogeneous) && (!it->item->mincalcd) &&
|
||||
((it->group && sd->group_item_width) ||
|
||||
(!it->group && sd->item_width)))
|
||||
(((GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP) && sd->group_item_width) ||
|
||||
((GL_IT(it)->type != ELM_GENLIST_ITEM_GROUP) && sd->item_width)))
|
||||
{
|
||||
if (it->group)
|
||||
if (GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP)
|
||||
{
|
||||
it->item->w = it->item->minw = sd->group_item_width;
|
||||
it->item->h = it->item->minh = sd->group_item_height;
|
||||
|
@ -1756,7 +1756,8 @@ _item_realize(Elm_Gen_Item *it,
|
|||
it->item->h = it->item->minh = mh;
|
||||
it->item->mincalcd = EINA_TRUE;
|
||||
|
||||
if ((!sd->group_item_width) && (it->group))
|
||||
if ((!sd->group_item_width) &&
|
||||
(GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP))
|
||||
{
|
||||
sd->group_item_width = mw;
|
||||
sd->group_item_height = mh;
|
||||
|
@ -2169,7 +2170,7 @@ _item_block_position(Item_Block *itb,
|
|||
vis = (ELM_RECTS_INTERSECT
|
||||
(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h,
|
||||
cvx, cvy, cvw, cvh));
|
||||
if (!it->group)
|
||||
if (GL_IT(it)->type != ELM_GENLIST_ITEM_GROUP)
|
||||
{
|
||||
if ((itb->realized) && (!it->realized))
|
||||
{
|
||||
|
@ -3588,7 +3589,7 @@ _elm_genlist_item_del_serious(Elm_Gen_Item *it)
|
|||
it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
|
||||
sd->walking -= it->walking;
|
||||
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
||||
if (it->group)
|
||||
if (GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP)
|
||||
sd->group_items = eina_list_remove(sd->group_items, it);
|
||||
|
||||
ELM_SAFE_FREE(sd->state, eina_inlist_sorted_state_free);
|
||||
|
@ -3853,7 +3854,7 @@ _long_press_cb(void *data)
|
|||
|
||||
sd->longpressed = EINA_TRUE;
|
||||
evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, EO_OBJ(it));
|
||||
if ((sd->reorder_mode) && (!it->group))
|
||||
if ((sd->reorder_mode) && (GL_IT(it)->type != ELM_GENLIST_ITEM_GROUP))
|
||||
{
|
||||
sd->reorder_it = it;
|
||||
sd->reorder_start_y = 0;
|
||||
|
@ -5015,8 +5016,10 @@ _item_block_recalc(Item_Block *itb,
|
|||
if (!itb->realized)
|
||||
{
|
||||
if (qadd || (itb->sd->homogeneous &&
|
||||
((it->group && (!itb->sd->group_item_height)) ||
|
||||
((!it->group) && (!itb->sd->item_height)))))
|
||||
(((GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP) &&
|
||||
(!itb->sd->group_item_height)) ||
|
||||
((GL_IT(it)->type != ELM_GENLIST_ITEM_GROUP) &&
|
||||
(!itb->sd->item_height)))))
|
||||
{
|
||||
if (!it->item->mincalcd) changed = EINA_TRUE;
|
||||
if (changed)
|
||||
|
@ -5025,7 +5028,8 @@ _item_block_recalc(Item_Block *itb,
|
|||
|
||||
if (itb->sd->homogeneous)
|
||||
{
|
||||
if ((it->group) && (itb->sd->group_item_height == 0))
|
||||
if ((GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP) &&
|
||||
(itb->sd->group_item_height == 0))
|
||||
doit = EINA_TRUE;
|
||||
else if (itb->sd->item_height == 0)
|
||||
doit = EINA_TRUE;
|
||||
|
@ -5039,7 +5043,7 @@ _item_block_recalc(Item_Block *itb,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (it->group)
|
||||
if (GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP)
|
||||
{
|
||||
it->item->w = it->item->minw =
|
||||
sd->group_item_width;
|
||||
|
@ -5062,7 +5066,7 @@ _item_block_recalc(Item_Block *itb,
|
|||
if ((itb->sd->homogeneous) &&
|
||||
(itb->sd->mode == ELM_LIST_COMPRESS))
|
||||
{
|
||||
if (it->group)
|
||||
if (GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP)
|
||||
{
|
||||
it->item->w = it->item->minw =
|
||||
sd->group_item_width;
|
||||
|
@ -5981,18 +5985,17 @@ _elm_genlist_item_new(Elm_Genlist_Data *sd,
|
|||
GL_IT(it) = ELM_NEW(Elm_Gen_Item_Type);
|
||||
GL_IT(it)->wsd = sd;
|
||||
GL_IT(it)->type = type;
|
||||
if (type & ELM_GENLIST_ITEM_GROUP) it->group++;
|
||||
|
||||
if (it->parent)
|
||||
{
|
||||
if (it->parent->group)
|
||||
if (GL_IT(it->parent)->type == ELM_GENLIST_ITEM_GROUP)
|
||||
GL_IT(it)->group_item = parent;
|
||||
else if (GL_IT(it->parent)->group_item)
|
||||
GL_IT(it)->group_item = GL_IT(it->parent)->group_item;
|
||||
}
|
||||
for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
|
||||
{
|
||||
if (!it2->parent->group) depth += 1;
|
||||
if (!GL_IT(it2->parent)->type == ELM_GENLIST_ITEM_GROUP) depth += 1;
|
||||
}
|
||||
GL_IT(it)->expanded_depth = depth;
|
||||
sd->item_count++;
|
||||
|
@ -6073,7 +6076,7 @@ _elm_genlist_item_append(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const Elm_Ge
|
|||
|
||||
if (!it->parent)
|
||||
{
|
||||
if (it->group)
|
||||
if (GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP)
|
||||
sd->group_items = eina_list_append(sd->group_items, it);
|
||||
sd->items = eina_inlist_append(sd->items, EINA_INLIST_GET(it));
|
||||
it->item->rel = NULL;
|
||||
|
@ -6110,7 +6113,7 @@ _elm_genlist_item_prepend(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const Elm_G
|
|||
|
||||
if (!it->parent)
|
||||
{
|
||||
if (it->group)
|
||||
if (GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP)
|
||||
sd->group_items = eina_list_prepend(sd->group_items, it);
|
||||
sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(it));
|
||||
it->item->rel = NULL;
|
||||
|
@ -6161,9 +6164,10 @@ _elm_genlist_item_insert_after(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const
|
|||
|
||||
if (!it->parent)
|
||||
{
|
||||
if ((it->group) && (after->group))
|
||||
if ((GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP) &&
|
||||
(GL_IT(after)->type == ELM_GENLIST_ITEM_GROUP))
|
||||
sd->group_items = eina_list_append_relative
|
||||
(sd->group_items, it, after);
|
||||
(sd->group_items, it, after);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6206,7 +6210,8 @@ _elm_genlist_item_insert_before(Eo *obj, Elm_Genlist_Data *sd, const Elm_Genlist
|
|||
|
||||
if (!it->parent)
|
||||
{
|
||||
if (it->group && before->group)
|
||||
if ((GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP) &&
|
||||
(GL_IT(before)->type == ELM_GENLIST_ITEM_GROUP))
|
||||
sd->group_items =
|
||||
eina_list_prepend_relative(sd->group_items, it, before);
|
||||
}
|
||||
|
@ -7696,7 +7701,7 @@ _elm_genlist_item_select_mode_set(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it,
|
|||
// reset homogeneous item size
|
||||
if (sd->homogeneous)
|
||||
{
|
||||
if (it->group)
|
||||
if (GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP)
|
||||
sd->group_item_width = sd->group_item_height = 0;
|
||||
else
|
||||
sd->item_width = sd->item_height = 0;
|
||||
|
|
Loading…
Reference in New Issue