rimmed pushed a commit to branch master.

http://git.enlightenment.org/tools/eflete.git/commit/?id=a219d13fca2be9a6e47a931c3eb02134316f25e5

commit a219d13fca2be9a6e47a931c3eb02134316f25e5
Author: Vyacheslav Reutskiy <v.reuts...@samsung.com>
Date:   Thu Nov 26 10:11:52 2015 +0200

    groupedit: hilight item when it selected
    
    Change-Id: Ia16728cce487be399114bb673740df3db3330cfc
---
 src/bin/ui/workspace/groupedit.c         | 30 +++++++++++++++++++++++-------
 src/bin/ui/workspace/groupedit.h         |  4 +---
 src/bin/ui/workspace/groupedit_calc.c    | 25 ++++++++++++++++++++++---
 src/bin/ui/workspace/groupedit_private.h |  4 ++++
 src/bin/ui/workspace/workspace.c         |  6 ++++--
 5 files changed, 54 insertions(+), 15 deletions(-)

diff --git a/src/bin/ui/workspace/groupedit.c b/src/bin/ui/workspace/groupedit.c
index 562efcc..cd5a7ed 100644
--- a/src/bin/ui/workspace/groupedit.c
+++ b/src/bin/ui/workspace/groupedit.c
@@ -554,6 +554,9 @@ groupedit_edit_object_part_select(Evas_Object *obj, const 
char *part)
    else
      gp = NULL;
 
+   if (sd->selected && sd->selected->current_item)
+     elm_object_signal_emit(sd->selected->current_item->layout, 
"border,part_item,hilight,off", "eflete");
+
    if (!sd->separated) sd->selected = gp;
    else
      {
@@ -659,20 +662,33 @@ groupedit_zoom_factor_set(Evas_Object *obj, double factor)
    return true;
 }
 
-Eina_Bool
+void
 groupedit_edit_object_part_item_selected_set(Evas_Object *obj,
                                              Eina_Stringshare *item_name,
-                                             Eina_Bool selected __UNUSED__)
+                                             Eina_Bool selected)
 {
+   Groupedit_Part *gp;
+   Groupedit_Item *item;
    WS_GROUPEDIT_DATA_GET(obj, sd);
-   Groupedit_Part *gp = sd->selected;
 
-   if (!gp) return false;
+   gp = sd->selected;
+   if (!gp) return;
 
-   assert(item_name != NULL);
+   if (!item_name) return;
+   item = _part_item_search(gp->items, item_name);
+   if (gp->current_item)
+     elm_object_signal_emit(gp->current_item->layout, 
"border,part_item,hilight,off", "eflete");
 
-   TODO("need to find a item in the list and emit signal for hilight it. NOT 
RECALC!!!!")
-   return false;
+   if (selected)
+     {
+        elm_object_signal_emit(item->layout, "border,part_item,hilight,on", 
"eflete");
+        gp->current_item = item;
+     }
+   else
+     {
+        elm_object_signal_emit(item->layout, "border,part_item,hilight,off", 
"eflete");
+        gp->current_item = NULL;
+     }
 }
 
 #undef MY_CLASS_NAME
diff --git a/src/bin/ui/workspace/groupedit.h b/src/bin/ui/workspace/groupedit.h
index a90692b..d7445d2 100644
--- a/src/bin/ui/workspace/groupedit.h
+++ b/src/bin/ui/workspace/groupedit.h
@@ -397,11 +397,9 @@ groupedit_zoom_factor_set(Evas_Object *obj, double factor);
  * @param item_name The name of item, which selection should be changed.
  * @param selected If EINA_TRUE - item will be selected, otherwise unselected.
  *
- * @return EINA_FALSE on failure, EINA_TRUE on success.
- *
  * @ingroup Groupedit
  */
-Eina_Bool
+void
 groupedit_edit_object_part_item_selected_set(Evas_Object *obj,
                                              Eina_Stringshare *item_name,
                                              Eina_Bool selected);
diff --git a/src/bin/ui/workspace/groupedit_calc.c 
b/src/bin/ui/workspace/groupedit_calc.c
index 38b2ce6..da881fe 100644
--- a/src/bin/ui/workspace/groupedit_calc.c
+++ b/src/bin/ui/workspace/groupedit_calc.c
@@ -37,7 +37,6 @@ _part_draw_add(Ws_Groupedit_Smart_Data *sd, Part_ *part);
 static void
 _move_border_to_top(Ws_Groupedit_Smart_Data *sd);
 
-
 static void
 _part_draw_del(Ws_Groupedit_Smart_Data *sd, Part_ *part);
 
@@ -311,6 +310,26 @@ _parts_list_find(Eina_List *parts, const char *part)
    return NULL;
 }
 
+Groupedit_Item *
+_part_item_search(Eina_List *items, const char *item_name)
+{
+   Eina_List *l;
+   Groupedit_Item *item;
+
+   assert(items != NULL);
+   assert(item_name != NULL);
+
+   EINA_LIST_FOREACH(items, l, item)
+     {
+        /* we are sure that all strings are stringshare, and for compare two
+         * strings enough compare they pointers */
+        if ((item->name == item_name))
+          return item;
+     }
+   return NULL;
+}
+
+
 void
 _selected_item_return_to_place(Ws_Groupedit_Smart_Data *sd)
 {
@@ -544,7 +563,7 @@ _part_table_add(Ws_Groupedit_Smart_Data *sd, Groupedit_Part 
*gp)
    assert(gp->container == NULL);
 
    gp->container = evas_object_table_add(sd->e);
-   elm_box_pack_end(gp->draw, gp->container);
+   elm_box_pack_before(gp->draw, gp->container, gp->proxy_part);
    evas_object_show(gp->container);
 
    table = edje_object_part_object_get(sd->group->edit_object, gp->part->name);
@@ -649,7 +668,7 @@ _part_box_add(Ws_Groupedit_Smart_Data *sd, Groupedit_Part 
*gp)
 
    fprintf(stdout, "%s\n", gp->part->name);
    gp->container = evas_object_box_add(sd->e);
-   elm_box_pack_end(gp->draw, gp->container);
+   elm_box_pack_before(gp->draw, gp->container, gp->proxy_part);
    evas_object_show(gp->container);
 
    EINA_LIST_FOREACH(gp->part->items, l, str)
diff --git a/src/bin/ui/workspace/groupedit_private.h 
b/src/bin/ui/workspace/groupedit_private.h
index 4f54ee9..bc2bf10 100644
--- a/src/bin/ui/workspace/groupedit_private.h
+++ b/src/bin/ui/workspace/groupedit_private.h
@@ -147,6 +147,7 @@ struct _Groupedit_Part
    Evas_Object *container;    /**< Used for box/table parts */
    Evas_Object *item;         /**< The object border in the separete mode */
    Eina_List *items;          /**< The items, for TABLE, BOX part types */
+   Groupedit_Item *current_item;
 };
 
 struct _Groupedit_Item
@@ -164,6 +165,9 @@ _parts_list_free(Ws_Groupedit_Smart_Data *sd);
 Groupedit_Part *
 _parts_list_find(Eina_List *parts, const char *part);
 
+Groupedit_Item *
+_part_item_search(Eina_List *items, const char *item_name);
+
 Eina_Bool
 _parts_recalc(Ws_Groupedit_Smart_Data *sd);
 
diff --git a/src/bin/ui/workspace/workspace.c b/src/bin/ui/workspace/workspace.c
index 08e9a89..5535cc0 100644
--- a/src/bin/ui/workspace/workspace.c
+++ b/src/bin/ui/workspace/workspace.c
@@ -913,6 +913,7 @@ Eina_Bool
 workspace_highlight_unset(Evas_Object *obj)
 {
    WS_DATA_GET(obj, sd)
+
    if ((!sd->highlight.highlight) || (!sd->highlight.space_hl)) return false;
    highlight_object_unfollow(sd->highlight.highlight);
    highlight_object_unfollow(sd->highlight.space_hl);
@@ -1439,6 +1440,7 @@ _on_group_navigator_part_select(void *data,
    TODO("Combine this methods to one")
    workspace_highlight_unset(workspace);
    _workspace_highlight_set(workspace, part);
+   groupedit_edit_object_part_item_selected_set(sd->groupedit, 
part->current_item_name, true);
 
    evas_object_smart_callback_call(ap.win, SIGNAL_PART_SELECTED, (void *)part);
 }
@@ -1879,6 +1881,6 @@ workspace_edit_object_part_item_selected_set(Evas_Object 
*obj,
    WS_DATA_GET(obj, sd);
    assert(item_name != NULL);
 
-   return groupedit_edit_object_part_item_selected_set(sd->groupedit, 
item_name,
-                                                       selected);
+   groupedit_edit_object_part_item_selected_set(sd->groupedit, item_name, 
selected);
+   return true;
 }

-- 


Reply via email to