rimmed pushed a commit to branch master.

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

commit ea43189d761308567720ee9ef4f2779568c212a0
Author: Vyacheslav Reutskiy <v.reuts...@samsung.com>
Date:   Thu Mar 24 15:36:03 2016 +0200

    groupview: apply zoom to viewed parts
    
    Change-Id: I1910c438ab844bee826f5638b2300f93ed0a75fd
---
 src/bin/ui/workspace/groupview.c         | 61 +++++++++++++++++++++-----------
 src/bin/ui/workspace/groupview.h         | 21 ++++++++---
 src/bin/ui/workspace/groupview_calc.c    |  8 ++---
 src/bin/ui/workspace/groupview_private.h |  2 ++
 src/bin/ui/workspace/workspace.c         |  8 ++---
 5 files changed, 68 insertions(+), 32 deletions(-)

diff --git a/src/bin/ui/workspace/groupview.c b/src/bin/ui/workspace/groupview.c
index 356556e..818814f 100644
--- a/src/bin/ui/workspace/groupview.c
+++ b/src/bin/ui/workspace/groupview.c
@@ -33,17 +33,30 @@ EVAS_SMART_SUBCLASS_NEW(MY_CLASS_NAME, _groupview,
 
/******************************************************************************/
 /*                            HIGHLIGHT CALLBACKS                             
*/
 
/******************************************************************************/
+static Groupview_HL_Event *
+_grouopview_hl_event_new(Highlight_Events *event, Groupview_Smart_Data *sd)
+{
+   Groupview_HL_Event *ev;
+
+   ev = mem_malloc(sizeof(Groupview_HL_Event));
+
+   ev->part = sd->selected->part;
+   ev->x = event->x / sd->zoom;
+   ev->y = event->y / sd->zoom;
+   ev->w = event->w / sd->zoom;
+   ev->h = event->h / sd->zoom;
+   ev->hl_type = event->descr;
+
+   return ev;
+}
+
 static void
 _hl_part_drag_start_cb(void *data,
                        Evas_Object *obj __UNUSED__,
-                       void *event_info __UNUSED__)
+                       void *event_info)
 {
    Groupview_Smart_Data *sd = data;
-   Groupview_HL_Event *event;
-
-   event = mem_malloc(sizeof(Groupview_HL_Event));
-   event->hl_event = event_info;
-   event->part = sd->selected->part;
+   Groupview_HL_Event *event = _grouopview_hl_event_new(event_info, sd);
 
    evas_object_smart_callback_call(sd->obj, 
SIGNAL_GROUPVIEW_HL_PART_DRAG_START, event);
 
@@ -56,11 +69,7 @@ _hl_part_changed_cb(void *data,
                     void *event_info)
 {
    Groupview_Smart_Data *sd = data;
-   Groupview_HL_Event *event;
-
-   event = mem_malloc(sizeof(Groupview_HL_Event));
-   event->hl_event = event_info;
-   event->part = sd->selected->part;
+   Groupview_HL_Event *event = _grouopview_hl_event_new(event_info, sd);
 
    evas_object_smart_callback_call(sd->obj, SIGNAL_GROUPVIEW_HL_PART_CHANGED, 
event);
 
@@ -73,11 +82,7 @@ _hl_part_drag_stop_cb(void *data,
                       void *event_info)
 {
    Groupview_Smart_Data *sd = data;
-   Groupview_HL_Event *event;
-
-   event = mem_malloc(sizeof(Groupview_HL_Event));
-   event->hl_event = event_info;
-   event->part = sd->selected->part;
+   Groupview_HL_Event *event = _grouopview_hl_event_new(event_info, sd);
 
    evas_object_smart_callback_call(sd->obj, 
SIGNAL_GROUPVIEW_HL_PART_DRAG_STOP, event);
 
@@ -181,6 +186,9 @@ _groupview_smart_move(Evas_Object *o,
    evas_object_move(sd->group->edit_object,x ,y);
    evas_object_move(sd->box, x, y);
 
+   sd->zoom1.x = x;
+   sd->zoom1.y = y;
+
    evas_object_smart_changed(o);
 }
 
@@ -195,6 +203,9 @@ _groupview_smart_resize(Evas_Object *o,
    evas_object_geometry_get(o, NULL, NULL, &ow, &oh);
    if ((ow == w) && (oh == h)) return;
 
+   sd->zoom1.w = w / sd->zoom;
+   sd->zoom1.h = h / sd->zoom;
+
    evas_object_smart_changed(o);
 }
 
@@ -218,7 +229,7 @@ _groupview_smart_calculate(Evas_Object *o)
         sd->geom.w = w;
         sd->geom.h = h;
 
-        evas_object_resize(sd->group->edit_object, w, h);
+        evas_object_resize(sd->group->edit_object, sd->zoom1.w, sd->zoom1.h);
         evas_object_resize(sd->box, w, h);
      }
    else
@@ -227,6 +238,7 @@ _groupview_smart_calculate(Evas_Object *o)
    sd->manual_calc = false;
 
    DBG("Groupview geometry: x[%i] y[%i] w[%i] h[%i]", x, y, w, h);
+   DBG("Edit object geometry: x[%i] y[%i] w[%i] h[%i]", sd->zoom1.x, 
sd->zoom1.y, sd->zoom1.w, sd->zoom1.h);
    evas_object_smart_callback_call(o, SIG_GEOMETRY_CHANGED, &sd->geom);
 }
 
@@ -263,6 +275,7 @@ groupview_add(Evas_Object *parent, Group *group)
    obj = evas_object_smart_add(e, _groupview_smart_class_new());
    GROUPVIEW_DATA_GET(obj, sd);
    sd->parent = parent;
+   sd->zoom = 1.0;
 
    TODO("set the state for all parts to default 0.0")
    sd->group = group;
@@ -497,12 +510,20 @@ groupview_part_visible_set(Evas_Object *obj, Part *part)
      evas_object_hide(gp->draw);
 }
 
-Eina_Bool
-groupview_zoom_factor_set(Evas_Object *obj, double factor __UNUSED__)
+void
+groupview_zoom_factor_set(Evas_Object *obj, double zoom)
 {
    GROUPVIEW_DATA_GET(obj, sd);
 
-   return true;
+   sd->zoom = zoom;
+}
+
+double
+groupview_zoom_factor_get(Evas_Object *obj)
+{
+   GROUPVIEW_DATA_GET(obj, sd);
+
+   return sd->zoom;
 }
 
 void
diff --git a/src/bin/ui/workspace/groupview.h b/src/bin/ui/workspace/groupview.h
index 632e0ed..6261aa1 100644
--- a/src/bin/ui/workspace/groupview.h
+++ b/src/bin/ui/workspace/groupview.h
@@ -70,8 +70,12 @@ struct _Geom{
 typedef struct _Geom Groupview_Geom;
 
 struct _Groupview_HL_Event {
-   Highlight_Events *hl_event;
    Part *part;
+   Evas_Coord x;
+   Evas_Coord y;
+   Evas_Coord w;
+   Evas_Coord h;
+   Handler_Type hl_type;
 };
 
 typedef struct _Groupview_HL_Event Groupview_HL_Event;
@@ -267,13 +271,22 @@ groupview_part_restack(Evas_Object *obj, const char 
*part, const char *below);
  * @param factor A factor for scale. Where value 1.0 = 100% scale (not zoom
  * object). Minimum is 0.01, maximum is 20. (from 1% to 2000% zoom).
  *
- * @return EINA_FALSE on failure, EINA_TRUE on success.
- *
  * @ingroup Groupview
  */
-Eina_Bool
+void
 groupview_zoom_factor_set(Evas_Object *obj, double factor);
 
+/**
+ * Get the zoom factor.
+ *
+ * @param obj The groupview object.
+ *
+ * @return the zoom factor value
+ *
+ * @ingroup Groupview
+ */
+double
+groupview_zoom_factor_get(Evas_Object *obj);
 
 /**
  * Change selection state for given item.
diff --git a/src/bin/ui/workspace/groupview_calc.c 
b/src/bin/ui/workspace/groupview_calc.c
index fbe9da8..a75d552 100644
--- a/src/bin/ui/workspace/groupview_calc.c
+++ b/src/bin/ui/workspace/groupview_calc.c
@@ -508,10 +508,10 @@ _part_calc(Groupview_Smart_Data *sd, Groupview_Part *gp)
    edje_object_part_geometry_get(sd->group->edit_object, gp->part->name, &x, 
&y, &w, &h);
    evas_object_geometry_get(sd->group->edit_object, &xe, &ye, &we, &he);
 
-   gp->geom.x = x + xe;
-   gp->geom.y = y + ye;
-   gp->geom.w = w;
-   gp->geom.h = h;
+   gp->geom.x = x * sd->zoom + xe;
+   gp->geom.y = y * sd->zoom + ye;
+   gp->geom.w = w * sd->zoom;
+   gp->geom.h = h * sd->zoom;
 
    protrusion = abs((x <= 0) ? x : 0);
    sd->protrusion.x = (protrusion > sd->protrusion.x) ? protrusion : 
sd->protrusion.x;
diff --git a/src/bin/ui/workspace/groupview_private.h 
b/src/bin/ui/workspace/groupview_private.h
index 02a48ce..495adf4 100644
--- a/src/bin/ui/workspace/groupview_private.h
+++ b/src/bin/ui/workspace/groupview_private.h
@@ -52,6 +52,7 @@ struct _Groupview_Smart_Data
    Evas_Object *box;
    Groupview_Geom geom;
    Groupview_Geom protrusion;
+   Groupview_Geom zoom1;
    Eina_List *parts;
    Groupview_Part *selected;
    Evas_Object *highlight;
@@ -60,6 +61,7 @@ struct _Groupview_Smart_Data
    Eina_Bool obj_area_visible : 1;
    Eina_Bool separated : 1;
    Eina_Bool manual_calc : 1;
+   double zoom;
 };
 
 #define GROUPVIEW_DATA_GET(o, ptr)  \
diff --git a/src/bin/ui/workspace/workspace.c b/src/bin/ui/workspace/workspace.c
index 589408e..771aa8f 100644
--- a/src/bin/ui/workspace/workspace.c
+++ b/src/bin/ui/workspace/workspace.c
@@ -685,11 +685,11 @@ _groupview_hl_part_changed(void *data,
    editor_state_max_w_set(wd->group->edit_object, change, true, 
event->part->name,
                           event->part->current_state->parsed_name,
                           event->part->current_state->parsed_val,
-                          event->hl_event->w);
+                          event->w);
    editor_state_max_h_set(wd->group->edit_object, change, true, 
event->part->name,
                           event->part->current_state->parsed_name,
                           event->part->current_state->parsed_val,
-                          event->hl_event->h);
+                          event->h);
 }
 
 static void
@@ -701,11 +701,11 @@ _groupview_hl_part_drag_stop(void *data,
    Groupview_HL_Event *event = event_info;
    Eina_Stringshare *msg;
 
-   if ((part_w == event->hl_event->w) && (part_h == event->hl_event->h))
+   if ((part_w == event->w) && (part_h == event->h))
      change_free(change);
    else
      {
-        msg = eina_stringshare_printf(_("max size changed from [%dx%d] to 
[%dx%d]"), part_w, part_h, event->hl_event->w, event->hl_event->h);
+        msg = eina_stringshare_printf(_("max size changed from [%dx%d] to 
[%dx%d]"), part_w, part_h, event->w, event->h);
         change_description_set(change, msg);
         eina_stringshare_del(msg);
         history_change_add(wd->group->history, change);

-- 


Reply via email to