rimmed pushed a commit to branch master.

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

commit b3658130179f6cc89acc88309207ce7f99346ee0
Author: Andrii Kroitor <an.kroi...@samsung.com>
Date:   Tue Dec 15 12:02:24 2015 +0200

    workspace: remake parts restack routines
---
 src/bin/ui/group_navigator.h             |   9 +++
 src/bin/ui/workspace/groupedit.c         |  40 ++----------
 src/bin/ui/workspace/groupedit.h         |  48 +-------------
 src/bin/ui/workspace/groupedit_calc.c    | 109 +++++--------------------------
 src/bin/ui/workspace/groupedit_private.h |  21 ------
 src/bin/ui/workspace/workspace.c         |  49 +++++---------
 src/bin/ui/workspace/workspace.h         |  45 -------------
 7 files changed, 47 insertions(+), 274 deletions(-)

diff --git a/src/bin/ui/group_navigator.h b/src/bin/ui/group_navigator.h
index 967136e..f602a57 100644
--- a/src/bin/ui/group_navigator.h
+++ b/src/bin/ui/group_navigator.h
@@ -37,6 +37,15 @@
  */
 #define SIGNAL_GROUP_NAVIGATOR_PART_SELECTED 
"SIGNAL_GROUP_NAVIGATOR_PART_SELECTED"
 
+
+/**
+ * emited when part is restacked in part list.
+ * eventinfo - pointer to Editor_Part_Restack structure
+ *
+ * @ingroup Partlist
+ */
+#define SIGNAL_GROUP_NAVIGATOR_PART_RESTACKED 
"SIGNAL_GROUP_NAVIGATOR_PART_RESTACKED"
+
 /**
  * emited when part state is activated in part list.
  * eventinfo - pointer to Part_ structure
diff --git a/src/bin/ui/workspace/groupedit.c b/src/bin/ui/workspace/groupedit.c
index 9a91203..fe44102 100644
--- a/src/bin/ui/workspace/groupedit.c
+++ b/src/bin/ui/workspace/groupedit.c
@@ -293,47 +293,15 @@ groupedit_edit_object_part_del(Evas_Object *obj, Part_ 
*part)
 }
 
 Eina_Bool
-groupedit_edit_object_part_above(Evas_Object *obj, const char *part)
+groupedit_edit_object_part_restack(Evas_Object *obj,
+                                   const char *part,
+                                   const char *rel_part)
 {
    WS_GROUPEDIT_DATA_GET(obj, sd);
 
    assert(part != NULL);
 
-   return _edit_object_part_restack_above(sd, part, NULL);
-}
-
-Eina_Bool
-groupedit_edit_object_part_below(Evas_Object *obj, const char *part)
-{
-   WS_GROUPEDIT_DATA_GET(obj, sd);
-
-   assert(part != NULL);
-
-   return _edit_object_part_restack_below(sd, part, NULL);
-}
-
-Eina_Bool
-groupedit_edit_object_part_move_above(Evas_Object *obj,
-                                      const char *part,
-                                      const char *above)
-{
-   WS_GROUPEDIT_DATA_GET(obj, sd);
-
-   assert(part != NULL);
-
-   return _edit_object_part_restack_above(sd, part, above);
-}
-
-Eina_Bool
-groupedit_edit_object_part_move_below(Evas_Object *obj,
-                                      const char *part,
-                                      const char *below)
-{
-   WS_GROUPEDIT_DATA_GET(obj, sd);
-
-   assert(part != NULL);
-
-   return _edit_object_part_restack_below(sd, part, below);
+   return _edit_object_part_restack_below(sd, part, rel_part);
 }
 
 Eina_Bool
diff --git a/src/bin/ui/workspace/groupedit.h b/src/bin/ui/workspace/groupedit.h
index 32f68ae..ecf9cbb 100644
--- a/src/bin/ui/workspace/groupedit.h
+++ b/src/bin/ui/workspace/groupedit.h
@@ -261,22 +261,6 @@ void
 groupedit_part_visible_set(Evas_Object *obj, Part_ *part);
 
 /**
- * Restack part above another part in groupedit module.
- *
- * @param obj The groupedit object.
- * @param part The name of part, which need above above.
- * @param above Name of part for which will be moved 'part'.
- *
- * @return EINA_FALSE on failure, EINA_TRUE on success.
- *
- * @ingroup Groupedit
- */
-Eina_Bool
-groupedit_edit_object_part_move_above(Evas_Object *obj,
-                                      const char *part,
-                                      const char *above);
-
-/**
  * Restack part below another part in groupedit module.
  *
  * @param obj The groupedit object.
@@ -288,35 +272,9 @@ groupedit_edit_object_part_move_above(Evas_Object *obj,
  * @ingroup Groupedit
  */
 Eina_Bool
-groupedit_edit_object_part_move_below(Evas_Object *obj,
-                                      const char *part,
-                                      const char *below);
-
-/**
- * Stack part above above in groupedit module.
- *
- * @param obj The groupedit object.
- * @param part The name of part, which need above above.
- *
- * @return EINA_FALSE on failure, EINA_TRUE on success.
- *
- * @ingroup Groupedit
- */
-Eina_Bool
-groupedit_edit_object_part_above(Evas_Object *obj, const char *part);
-
-/**
- * Stack part below below in groupedit module.
- *
- * @param obj The groupedit object.
- * @param part The name of part, which need below below.
- *
- * @return EINA_FALSE on failure, EINA_TRUE on success.
- *
- * @ingroup Groupedit
- */
-Eina_Bool
-groupedit_edit_object_part_below(Evas_Object *obj, const char *part);
+groupedit_edit_object_part_restack(Evas_Object *obj,
+                                   const char *part,
+                                   const char *below);
 
 /**
  * Set zoom factor for view zoommed style in groupedit object.
diff --git a/src/bin/ui/workspace/groupedit_calc.c 
b/src/bin/ui/workspace/groupedit_calc.c
index 3a54441..8d03e4e 100644
--- a/src/bin/ui/workspace/groupedit_calc.c
+++ b/src/bin/ui/workspace/groupedit_calc.c
@@ -87,113 +87,35 @@ _edit_object_part_del(Ws_Groupedit_Smart_Data *sd, Part_ 
*part)
    return true;
 }
 
-/**
-  * Internal function, which provide restack parts at parts list and restack
-  * part primitives at canvas.
-  * If param part_to is NULL, part, which name stored at param part, will
-  * restack below or above at one position. Else part will restack to part 
which
-  * name stored at part_to.
-  *
-  * @param sd The groupedit smart data structure for get access to parts list.
-  * @param part The name of part to stack.
-  * @param part_to The name of part which to stack.
-  * @param mode If true operation restack above will be process, else is
-  * restack below.
-  *
-  * @return false on failure, true on success.
-  */
-static Eina_Bool
-_part_restack(Ws_Groupedit_Smart_Data *sd,
-              const char *part,
-              const char *part_to,
-              Eina_Bool mode)
-{
-   Eina_List *l = NULL;
-   Groupedit_Part *ge_part_to, *ge_part;
-
-   assert(sd != NULL);
-   assert(part != NULL);
-
-   ge_part = _parts_list_find(sd->parts, part);
-   if (!ge_part) return false;
-   /* Here find part_to in parts stack. ge_part will be restack abow or below
-    * ge_part_to object. */
-   if (part_to)
-     ge_part_to = _parts_list_find(sd->parts, part_to);
-   else
-     {
-        l = eina_list_data_find_list(sd->parts, ge_part);
-        if (mode)
-          ge_part_to = eina_list_data_get(eina_list_prev(l));
-        else
-          ge_part_to = eina_list_data_get(eina_list_next(l));
-     }
-
-   if (!ge_part_to) return false;
-
-   /* For changing position ge_part in Eina_List of parts, at first need to
-    * remove node with data ge_part, and for second prepend/append ge_part to
-    * list of parts. (Operation prepend use when restack above, and
-    * append if restack below)
-    */
-   sd->parts = eina_list_remove(sd->parts, ge_part);
-
-   if (mode)
-     sd->parts = eina_list_prepend_relative(sd->parts, ge_part, ge_part_to);
-   else
-     sd->parts = eina_list_append_relative(sd->parts, ge_part, ge_part_to);
-
-   return true;
-}
-
 Eina_Bool
-_edit_object_part_restack_above(Ws_Groupedit_Smart_Data *sd,
+_edit_object_part_restack_below(Ws_Groupedit_Smart_Data *sd,
                                 const char *part,
-                                const char *part_above)
+                                const char *rel_part)
 {
-   Eina_Bool ret = false;
+   Groupedit_Part *ge_rel_part, *ge_part;
 
    assert(sd != NULL);
    assert(sd->parts != NULL);
    assert(part != NULL);
 
-   if (part_above)
-     ret = edje_edit_part_restack_part_below(sd->group->edit_object, part, 
part_above);
-   else
-     ret = edje_edit_part_restack_below(sd->group->edit_object, part);
+   ge_part = _parts_list_find(sd->parts, part);
+   assert(ge_part != NULL);
 
-   if (!ret)
+   sd->parts = eina_list_remove(sd->parts, ge_part);
+   elm_box_unpack(sd->box, ge_part->draw);
+   if (rel_part)
      {
-        ERR("Failed restack in edje_edit object");
-        abort();
+        ge_rel_part = _parts_list_find(sd->parts, rel_part);
+        assert(ge_rel_part != NULL);
+        sd->parts = eina_list_prepend_relative(sd->parts, ge_part, 
ge_rel_part);
+        elm_box_pack_before(sd->box, ge_part->draw, ge_rel_part->draw);
      }
-   _part_restack(sd, part, part_above, true);
-   evas_object_smart_changed(sd->obj);
-   return true;
-}
-
-Eina_Bool
-_edit_object_part_restack_below(Ws_Groupedit_Smart_Data *sd,
-                                const char *part,
-                                const char *part_below)
-{
-   Eina_Bool ret = false;
-
-   assert(sd != NULL);
-   assert(sd->parts != NULL);
-   assert(part != NULL);
-
-   if (part_below)
-     ret = edje_edit_part_restack_part_above(sd->group->edit_object, part, 
part_below);
    else
-     ret = edje_edit_part_restack_above(sd->group->edit_object, part);
-
-   if (!ret)
      {
-        ERR("Failed restack in edje_edit object");
-        abort();
+        sd->parts = eina_list_append(sd->parts, ge_part);
+        elm_box_pack_end(sd->box, ge_part->draw);
      }
-   _part_restack(sd, part, part_below, false);
+
    evas_object_smart_changed(sd->obj);
    return true;
 }
@@ -1104,6 +1026,7 @@ _parts_stack_layout(Evas_Object          *o __UNUSED__,
              evas_object_resize(gp->container, gp->geom.w, gp->geom.h);
              evas_object_move(gp->container, gp->geom.x, gp->geom.y);
           }
+        evas_object_raise(gp->draw);
      }
    sd->manual_calc = false;
 }
diff --git a/src/bin/ui/workspace/groupedit_private.h 
b/src/bin/ui/workspace/groupedit_private.h
index fbd377c..dfe36ef 100644
--- a/src/bin/ui/workspace/groupedit_private.h
+++ b/src/bin/ui/workspace/groupedit_private.h
@@ -143,27 +143,6 @@ _parts_stack_layout(Evas_Object          *o,
                     void                 *data);
 
 /**
- * Stack part above above in groupedit module.
- * If part_above param is NULL, then part will restack above by one position,
- * in stack, else part will restack above part_above.
- * Restack complete in three steps:
- *  - restack part in edje edit object. (Used edje_edit_part_restack* func's).
- *  - restack part in parts list, which stored in groupedit smart data.
- *  - restack evas primitive of part at canvas (Used evas_object_stack* 
func's).
- *
- * @param sd The groupedit smart data structure.
- * @param part The name of part to stack above.
- * @param part_above The name of part above which to stack.
- *
- * @return EINA_FALSE on failure, EINA_TRUE on success.
- *
- * @ingroup Groupedit
- */
-Eina_Bool
-_edit_object_part_restack_above(Ws_Groupedit_Smart_Data *sd,
-                                const char *part,
-                                const char *part_above);
-/**
  * Stack part below below in groupedit module.
  * If part_below param is NULL, then part will restack below by one position,
  * in stack, else part will restack below part_below.
diff --git a/src/bin/ui/workspace/workspace.c b/src/bin/ui/workspace/workspace.c
index 8a1f51f..8559590 100644
--- a/src/bin/ui/workspace/workspace.c
+++ b/src/bin/ui/workspace/workspace.c
@@ -1446,6 +1446,19 @@ _on_group_navigator_part_select(void *data,
 }
 
 static void
+_on_group_navigator_part_restacked(void *data,
+                                   Evas_Object *obj __UNUSED__,
+                                   void *event_info)
+{
+   Evas_Object *workspace = (Evas_Object *)data;
+   Editor_Part_Restack *ei = event_info;
+
+   WS_DATA_GET(workspace, sd);
+
+   groupedit_edit_object_part_restack(sd->groupedit, ei->part_name, 
ei->relative_part_name);
+}
+
+static void
 _on_group_navigator_part_state_select(void *data,
                                 Evas_Object *obj __UNUSED__,
                                 void *event_info)
@@ -1512,6 +1525,8 @@ workspace_add(Evas_Object *parent, Group *group)
    elm_object_part_content_set(sd->panes, "right", sd->group_navigator);
    evas_object_smart_callback_add(sd->group_navigator, 
SIGNAL_GROUP_NAVIGATOR_PART_SELECTED,
                                   _on_group_navigator_part_select, obj);
+   evas_object_smart_callback_add(sd->group_navigator, 
SIGNAL_GROUP_NAVIGATOR_PART_RESTACKED,
+                                  _on_group_navigator_part_restacked, obj);
    evas_object_smart_callback_add(sd->group_navigator, 
SIGNAL_GROUP_NAVIGATOR_PART_STATE_SELECTED,
                                   _on_group_navigator_part_state_select, obj);
    evas_object_smart_callback_add(sd->group_navigator, 
SIGNAL_GROUP_NAVIGATOR_PART_VISIBLE_CHANGED,
@@ -1719,24 +1734,6 @@ workspace_edit_object_part_del(Evas_Object *obj, Part_ 
*part)
 }
 
 Eina_Bool
-workspace_edit_object_part_above(Evas_Object *obj, const char *part)
-{
-   WS_DATA_GET(obj, sd);
-   assert(part != NULL);
-
-   return groupedit_edit_object_part_above(sd->groupedit, part);
-}
-
-Eina_Bool
-workspace_edit_object_part_below(Evas_Object *obj, const char *part)
-{
-   WS_DATA_GET(obj, sd);
-   assert(part != NULL);
-
-   return groupedit_edit_object_part_below(sd->groupedit, part);
-}
-
-Eina_Bool
 workspace_edit_object_part_state_set(Evas_Object *obj, Part_ *part)
 {
    WS_DATA_GET(obj, sd);
@@ -1747,22 +1744,6 @@ workspace_edit_object_part_state_set(Evas_Object *obj, 
Part_ *part)
 }
 
 Eina_Bool
-workspace_edit_object_part_restack(Evas_Object *obj,
-                                   const char *part,
-                                   const char *rel_part,
-                                   Eina_Bool direct)
-{
-   WS_DATA_GET(obj, sd);
-   assert(part != NULL);
-   assert(rel_part != NULL);
-
-   if (!direct)
-      return groupedit_edit_object_part_move_above(sd->groupedit, part, 
rel_part);
-   else
-      return groupedit_edit_object_part_move_below(sd->groupedit, part, 
rel_part);
-}
-
-Eina_Bool
 workspace_edit_object_visible_set(Evas_Object *obj,
                                   const char *part,
                                   Eina_Bool visible __UNUSED__)
diff --git a/src/bin/ui/workspace/workspace.h b/src/bin/ui/workspace/workspace.h
index e5fc8b5..ad095b3 100644
--- a/src/bin/ui/workspace/workspace.h
+++ b/src/bin/ui/workspace/workspace.h
@@ -131,51 +131,6 @@ Eina_Bool
 workspace_edit_object_part_del(Evas_Object *obj, Part_ *part);
 
 /**
- * Stack part above above in workspace module. This function is a wrapper
- * on _edit_object_part_restack_above();
- *
- * @param obj The workspace object.
- * @param part The name of part, which need above above.
- *
- * @return EINA_FALSE on failure, EINA_TRUE on success.
- *
- * @ingroup Workspace
- */
-Eina_Bool
-workspace_edit_object_part_above(Evas_Object *obj, const char *part);
-
-/**
- * Stack part below below in workspace module. This function is a wrapper
- * on _edit_object_part_restack_below();
- *
- * @param obj The workspace object.
- * @param part The name of part, which need below below.
- *
- * @return EINA_FALSE on failure, EINA_TRUE on success.
- *
- * @ingroup Workspace
- */
-Eina_Bool
-workspace_edit_object_part_below(Evas_Object *obj, const char *part);
-
-/** Move the given part relative the next one.
- *
- * @param obj The workspace object.
- * @param part Name of part, which will reordered.
- * @param rel_part Name of part, which will be relative to reordering 'part'.
- * @param direct If EINA_TRUE, part will restack below, otherwise part will
- *   restack above rel_part.
- *
- * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
- */
-
-Eina_Bool
-workspace_edit_object_part_restack(Evas_Object *obj,
-                                   const char *part,
-                                   const char *rel_part,
-                                   Eina_Bool direct);
-
-/**
  *
  */
 Eina_Bool

-- 


Reply via email to