summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChunEon Park <hermet@hermet.pe.kr>2015-01-08 17:53:53 +0900
committerChunEon Park <hermet@hermet.pe.kr>2015-01-08 17:55:11 +0900
commit2955ebc5dd01fbfb5a3286b724c8a40915864ad8 (patch)
tree47e05918b8b3c8d1b9c9d7f7d618589cdad259fc
parent7d6c0d12e676d5981b4110a74ffc6fe00699add3 (diff)
genlist: code refactoring.
there are 2 variables that has same purpose. cut off one dependency.
-rw-r--r--src/lib/elm_genlist.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index b8e3b6590..b98007156 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -617,7 +617,7 @@ _item_block_unrealize(Item_Block *itb)
617 617
618 EINA_LIST_FOREACH(itb->items, l, it) 618 EINA_LIST_FOREACH(itb->items, l, it)
619 { 619 {
620 if (itb->must_recalc || !it->group) 620 if (itb->must_recalc || (GL_IT(it)->type != ELM_GENLIST_ITEM_GROUP))
621 { 621 {
622 if (it->dragging) 622 if (it->dragging)
623 { 623 {
@@ -1705,10 +1705,10 @@ _item_realize(Elm_Gen_Item *it,
1705 1705
1706 /* homogeneous genlist shortcut */ 1706 /* homogeneous genlist shortcut */
1707 if ((calc) && (sd->homogeneous) && (!it->item->mincalcd) && 1707 if ((calc) && (sd->homogeneous) && (!it->item->mincalcd) &&
1708 ((it->group && sd->group_item_width) || 1708 (((GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP) && sd->group_item_width) ||
1709 (!it->group && sd->item_width))) 1709 ((GL_IT(it)->type != ELM_GENLIST_ITEM_GROUP) && sd->item_width)))
1710 { 1710 {
1711 if (it->group) 1711 if (GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP)
1712 { 1712 {
1713 it->item->w = it->item->minw = sd->group_item_width; 1713 it->item->w = it->item->minw = sd->group_item_width;
1714 it->item->h = it->item->minh = sd->group_item_height; 1714 it->item->h = it->item->minh = sd->group_item_height;
@@ -1756,7 +1756,8 @@ _item_realize(Elm_Gen_Item *it,
1756 it->item->h = it->item->minh = mh; 1756 it->item->h = it->item->minh = mh;
1757 it->item->mincalcd = EINA_TRUE; 1757 it->item->mincalcd = EINA_TRUE;
1758 1758
1759 if ((!sd->group_item_width) && (it->group)) 1759 if ((!sd->group_item_width) &&
1760 (GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP))
1760 { 1761 {
1761 sd->group_item_width = mw; 1762 sd->group_item_width = mw;
1762 sd->group_item_height = mh; 1763 sd->group_item_height = mh;
@@ -2169,7 +2170,7 @@ _item_block_position(Item_Block *itb,
2169 vis = (ELM_RECTS_INTERSECT 2170 vis = (ELM_RECTS_INTERSECT
2170 (it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h, 2171 (it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h,
2171 cvx, cvy, cvw, cvh)); 2172 cvx, cvy, cvw, cvh));
2172 if (!it->group) 2173 if (GL_IT(it)->type != ELM_GENLIST_ITEM_GROUP)
2173 { 2174 {
2174 if ((itb->realized) && (!it->realized)) 2175 if ((itb->realized) && (!it->realized))
2175 { 2176 {
@@ -3588,7 +3589,7 @@ _elm_genlist_item_del_serious(Elm_Gen_Item *it)
3588 it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it); 3589 it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
3589 sd->walking -= it->walking; 3590 sd->walking -= it->walking;
3590 ELM_SAFE_FREE(it->long_timer, ecore_timer_del); 3591 ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
3591 if (it->group) 3592 if (GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP)
3592 sd->group_items = eina_list_remove(sd->group_items, it); 3593 sd->group_items = eina_list_remove(sd->group_items, it);
3593 3594
3594 ELM_SAFE_FREE(sd->state, eina_inlist_sorted_state_free); 3595 ELM_SAFE_FREE(sd->state, eina_inlist_sorted_state_free);
@@ -3853,7 +3854,7 @@ _long_press_cb(void *data)
3853 3854
3854 sd->longpressed = EINA_TRUE; 3855 sd->longpressed = EINA_TRUE;
3855 evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, EO_OBJ(it)); 3856 evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, EO_OBJ(it));
3856 if ((sd->reorder_mode) && (!it->group)) 3857 if ((sd->reorder_mode) && (GL_IT(it)->type != ELM_GENLIST_ITEM_GROUP))
3857 { 3858 {
3858 sd->reorder_it = it; 3859 sd->reorder_it = it;
3859 sd->reorder_start_y = 0; 3860 sd->reorder_start_y = 0;
@@ -5015,8 +5016,10 @@ _item_block_recalc(Item_Block *itb,
5015 if (!itb->realized) 5016 if (!itb->realized)
5016 { 5017 {
5017 if (qadd || (itb->sd->homogeneous && 5018 if (qadd || (itb->sd->homogeneous &&
5018 ((it->group && (!itb->sd->group_item_height)) || 5019 (((GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP) &&
5019 ((!it->group) && (!itb->sd->item_height))))) 5020 (!itb->sd->group_item_height)) ||
5021 ((GL_IT(it)->type != ELM_GENLIST_ITEM_GROUP) &&
5022 (!itb->sd->item_height)))))
5020 { 5023 {
5021 if (!it->item->mincalcd) changed = EINA_TRUE; 5024 if (!it->item->mincalcd) changed = EINA_TRUE;
5022 if (changed) 5025 if (changed)
@@ -5025,7 +5028,8 @@ _item_block_recalc(Item_Block *itb,
5025 5028
5026 if (itb->sd->homogeneous) 5029 if (itb->sd->homogeneous)
5027 { 5030 {
5028 if ((it->group) && (itb->sd->group_item_height == 0)) 5031 if ((GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP) &&
5032 (itb->sd->group_item_height == 0))
5029 doit = EINA_TRUE; 5033 doit = EINA_TRUE;
5030 else if (itb->sd->item_height == 0) 5034 else if (itb->sd->item_height == 0)
5031 doit = EINA_TRUE; 5035 doit = EINA_TRUE;
@@ -5039,7 +5043,7 @@ _item_block_recalc(Item_Block *itb,
5039 } 5043 }
5040 else 5044 else
5041 { 5045 {
5042 if (it->group) 5046 if (GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP)
5043 { 5047 {
5044 it->item->w = it->item->minw = 5048 it->item->w = it->item->minw =
5045 sd->group_item_width; 5049 sd->group_item_width;
@@ -5062,7 +5066,7 @@ _item_block_recalc(Item_Block *itb,
5062 if ((itb->sd->homogeneous) && 5066 if ((itb->sd->homogeneous) &&
5063 (itb->sd->mode == ELM_LIST_COMPRESS)) 5067 (itb->sd->mode == ELM_LIST_COMPRESS))
5064 { 5068 {
5065 if (it->group) 5069 if (GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP)
5066 { 5070 {
5067 it->item->w = it->item->minw = 5071 it->item->w = it->item->minw =
5068 sd->group_item_width; 5072 sd->group_item_width;
@@ -5981,18 +5985,17 @@ _elm_genlist_item_new(Elm_Genlist_Data *sd,
5981 GL_IT(it) = ELM_NEW(Elm_Gen_Item_Type); 5985 GL_IT(it) = ELM_NEW(Elm_Gen_Item_Type);
5982 GL_IT(it)->wsd = sd; 5986 GL_IT(it)->wsd = sd;
5983 GL_IT(it)->type = type; 5987 GL_IT(it)->type = type;
5984 if (type & ELM_GENLIST_ITEM_GROUP) it->group++;
5985 5988
5986 if (it->parent) 5989 if (it->parent)
5987 { 5990 {
5988 if (it->parent->group) 5991 if (GL_IT(it->parent)->type == ELM_GENLIST_ITEM_GROUP)
5989 GL_IT(it)->group_item = parent; 5992 GL_IT(it)->group_item = parent;
5990 else if (GL_IT(it->parent)->group_item) 5993 else if (GL_IT(it->parent)->group_item)
5991 GL_IT(it)->group_item = GL_IT(it->parent)->group_item; 5994 GL_IT(it)->group_item = GL_IT(it->parent)->group_item;
5992 } 5995 }
5993 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent) 5996 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
5994 { 5997 {
5995 if (!it2->parent->group) depth += 1; 5998 if (!GL_IT(it2->parent)->type == ELM_GENLIST_ITEM_GROUP) depth += 1;
5996 } 5999 }
5997 GL_IT(it)->expanded_depth = depth; 6000 GL_IT(it)->expanded_depth = depth;
5998 sd->item_count++; 6001 sd->item_count++;
@@ -6073,7 +6076,7 @@ _elm_genlist_item_append(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const Elm_Ge
6073 6076
6074 if (!it->parent) 6077 if (!it->parent)
6075 { 6078 {
6076 if (it->group) 6079 if (GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP)
6077 sd->group_items = eina_list_append(sd->group_items, it); 6080 sd->group_items = eina_list_append(sd->group_items, it);
6078 sd->items = eina_inlist_append(sd->items, EINA_INLIST_GET(it)); 6081 sd->items = eina_inlist_append(sd->items, EINA_INLIST_GET(it));
6079 it->item->rel = NULL; 6082 it->item->rel = NULL;
@@ -6110,7 +6113,7 @@ _elm_genlist_item_prepend(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const Elm_G
6110 6113
6111 if (!it->parent) 6114 if (!it->parent)
6112 { 6115 {
6113 if (it->group) 6116 if (GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP)
6114 sd->group_items = eina_list_prepend(sd->group_items, it); 6117 sd->group_items = eina_list_prepend(sd->group_items, it);
6115 sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(it)); 6118 sd->items = eina_inlist_prepend(sd->items, EINA_INLIST_GET(it));
6116 it->item->rel = NULL; 6119 it->item->rel = NULL;
@@ -6161,9 +6164,10 @@ _elm_genlist_item_insert_after(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd, const
6161 6164
6162 if (!it->parent) 6165 if (!it->parent)
6163 { 6166 {
6164 if ((it->group) && (after->group)) 6167 if ((GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP) &&
6168 (GL_IT(after)->type == ELM_GENLIST_ITEM_GROUP))
6165 sd->group_items = eina_list_append_relative 6169 sd->group_items = eina_list_append_relative
6166 (sd->group_items, it, after); 6170 (sd->group_items, it, after);
6167 } 6171 }
6168 else 6172 else
6169 { 6173 {
@@ -6206,7 +6210,8 @@ _elm_genlist_item_insert_before(Eo *obj, Elm_Genlist_Data *sd, const Elm_Genlist
6206 6210
6207 if (!it->parent) 6211 if (!it->parent)
6208 { 6212 {
6209 if (it->group && before->group) 6213 if ((GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP) &&
6214 (GL_IT(before)->type == ELM_GENLIST_ITEM_GROUP))
6210 sd->group_items = 6215 sd->group_items =
6211 eina_list_prepend_relative(sd->group_items, it, before); 6216 eina_list_prepend_relative(sd->group_items, it, before);
6212 } 6217 }
@@ -7696,7 +7701,7 @@ _elm_genlist_item_select_mode_set(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it,
7696 // reset homogeneous item size 7701 // reset homogeneous item size
7697 if (sd->homogeneous) 7702 if (sd->homogeneous)
7698 { 7703 {
7699 if (it->group) 7704 if (GL_IT(it)->type == ELM_GENLIST_ITEM_GROUP)
7700 sd->group_item_width = sd->group_item_height = 0; 7705 sd->group_item_width = sd->group_item_height = 0;
7701 else 7706 else
7702 sd->item_width = sd->item_height = 0; 7707 sd->item_width = sd->item_height = 0;