rimmed pushed a commit to branch master.

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

commit e93ddbee638deb962892b29b9c5bbb5d7e81d927
Author: Vitalii Vorobiov <vi.vorob...@samsung.com>
Date:   Fri Nov 6 16:48:34 2015 +0200

    property_macros: use frame to show image preview
    
    Move FRAME_PROPERTY_ADD, since it will be used in
    editor props (image, group etc).
    Set default size for image preview since it will be used inside of a frame
---
 data/themes/default/widgets/layout.edc | 24 +----------------
 src/bin/ui/property.c                  | 29 +++++++++++++++++++++
 src/bin/ui/property_group.c            | 47 ----------------------------------
 src/bin/ui/property_image.c            | 13 +++-------
 src/bin/ui/property_macros.h           | 17 ++++++++++++
 src/bin/ui/property_private.h          |  6 +++++
 6 files changed, 57 insertions(+), 79 deletions(-)

diff --git a/data/themes/default/widgets/layout.edc 
b/data/themes/default/widgets/layout.edc
index acc1a6c..3ec6fa7 100644
--- a/data/themes/default/widgets/layout.edc
+++ b/data/themes/default/widgets/layout.edc
@@ -2422,32 +2422,10 @@ group { name: "elm/layout/image_editor/default";
 
 group { name: "elm/layout/image_editor/preview";
    parts {
-      part { name: "image_preview_decoration";
-         type: IMAGE;
-         description { state: "default" 0.0;
-            align: 0.0 0.0;
-            fixed: 1 1;
-            aspect: 1.0 1.0;
-            aspect_preference: BOTH;
-            color: 48 48 48 255;
-            image {
-               normal: "border_1.png";
-               border: 1 1 1 1;
-               middle: NONE;
-            }
-         }
-      }
       part { name: "eflete.swallow.image";
          type: SWALLOW;
          description { state: "default" 0.0;
-            rel1 {
-               offset: 2 2;
-               to: "image_preview_decoration";
-            }
-            rel2 {
-               offset: -3 -3;
-               to: "image_preview_decoration";
-            }
+            min: 1 300;
          }
       }
    }
diff --git a/src/bin/ui/property.c b/src/bin/ui/property.c
index c0123bc..5295d56 100644
--- a/src/bin/ui/property.c
+++ b/src/bin/ui/property.c
@@ -44,6 +44,35 @@
    Prop_Data *pd = evas_object_data_get(property, PROP_DATA); \
    assert(pd != NULL);
 
+TODO("remove this hack after scroller would be fixed")
+/*
+ * Hack start
+ */
+void
+_on_frame_click(void *data,
+                Evas_Object *obj,
+                void *event_info __UNUSED__)
+{
+   Evas_Object *scroller = (Evas_Object *)data;
+   Evas_Object *box, *frame_box;
+   int h_box, h_frame_box, h_scr, y_reg, h_reg, y_frame;
+   box = elm_object_content_get(scroller);
+   evas_object_geometry_get(scroller, NULL, NULL, NULL, &h_scr);
+   evas_object_geometry_get(box, NULL, NULL, NULL, &h_box);
+   frame_box = elm_object_content_get(obj);
+   evas_object_geometry_get(frame_box, NULL, &y_frame, NULL, &h_frame_box);
+   elm_scroller_region_get(scroller, NULL, &y_reg, NULL, &h_reg);
+   elm_scroller_region_bring_in(scroller, 0.0, y_reg + 1, 0.0, h_reg);
+   if (!elm_frame_collapse_get(obj))
+     {
+        if (h_box == h_scr + y_reg)
+          elm_scroller_region_show(scroller, 0.0, y_reg + h_frame_box, 0.0, 
h_reg);
+        else
+          elm_scroller_region_bring_in(scroller, 0.0, y_reg + 1, 0.0, h_reg);
+     }
+}
+/* Hack end */
+
 /* enum for identifying current property
  (group's, image's, sound's or other kind of peroperty) */
 enum _Property_Type {
diff --git a/src/bin/ui/property_group.c b/src/bin/ui/property_group.c
index 3af2071..1dbe93c 100644
--- a/src/bin/ui/property_group.c
+++ b/src/bin/ui/property_group.c
@@ -44,14 +44,6 @@
    Group_Prop_Data *pd = evas_object_data_get(property, GROUP_PROP_DATA); \
    assert(pd != NULL);
 
-/*
- * Callback is added for frames at property box to correct scroller
- * work while each frame would be expanded/collapsed
- */
-#define FRAME_PROPERTY_ADD(PARENT, FRAME, AUTOCOLLAPSE, TITLE, SCROLLER) \
-FRAME_ADD(PARENT, FRAME, AUTOCOLLAPSE, TITLE) \
-evas_object_smart_callback_add(FRAME, "clicked", _on_frame_click, SCROLLER);
-
 struct _Group_Prop_Data
 {
    Group *group;
@@ -453,35 +445,6 @@ _on_spinner_mouse_wheel(void *data __UNUSED__,
    mev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
 }
 
-TODO("remove this hack after scroller would be fixed")
-/*
- * Hack start
- */
-static void
-_on_frame_click(void *data,
-                Evas_Object *obj,
-                void *event_info __UNUSED__)
-{
-   Evas_Object *scroller = (Evas_Object *)data;
-   Evas_Object *box, *frame_box;
-   int h_box, h_frame_box, h_scr, y_reg, h_reg, y_frame;
-   box = elm_object_content_get(scroller);
-   evas_object_geometry_get(scroller, NULL, NULL, NULL, &h_scr);
-   evas_object_geometry_get(box, NULL, NULL, NULL, &h_box);
-   frame_box = elm_object_content_get(obj);
-   evas_object_geometry_get(frame_box, NULL, &y_frame, NULL, &h_frame_box);
-   elm_scroller_region_get(scroller, NULL, &y_reg, NULL, &h_reg);
-   elm_scroller_region_bring_in(scroller, 0.0, y_reg + 1, 0.0, h_reg);
-   if (!elm_frame_collapse_get(obj))
-     {
-        if (h_box == h_scr + y_reg)
-          elm_scroller_region_show(scroller, 0.0, y_reg + h_frame_box, 0.0, 
h_reg);
-        else
-          elm_scroller_region_bring_in(scroller, 0.0, y_reg + 1, 0.0, h_reg);
-     }
-}
-/* Hack end */
-
 static Evas_Object *
 prop_item_label_add(Evas_Object *parent,
                     Evas_Object **label,
@@ -1576,15 +1539,6 @@ ui_property_part_set(Evas_Object *property, Part_ *part)
      elm_scroller_region_show(pd->scroller, 0.0, y_reg + h_box, 0.0, h_reg);
 }
 
-#define PROP_ITEM_UNSET(BOX, ITEM) \
-   if (ITEM) \
-     {\
-        evas_object_smart_callback_del(ITEM, "clicked", _on_frame_click); \
-        elm_box_unpack(BOX, ITEM); \
-        evas_object_del(ITEM); \
-        ITEM = NULL; \
-     }
-
 static void
 _ui_property_part_unset(Evas_Object *property)
 {
@@ -1616,7 +1570,6 @@ _ui_property_part_unset(Evas_Object *property)
    PROP_ITEM_UNSET(prop_box, pd->attributes.part_item.frame)
 }
 
-#undef PROP_ITEM_UNSET
 #undef pd_part
 #undef pd_drag
 
diff --git a/src/bin/ui/property_image.c b/src/bin/ui/property_image.c
index 49bb851..0170321 100644
--- a/src/bin/ui/property_image.c
+++ b/src/bin/ui/property_image.c
@@ -34,18 +34,11 @@
    Image_Prop_Data *pd = evas_object_data_get(property, IMAGE_PROP_DATA); \
    assert(pd != NULL);
 
-/*
- * Callback is added for frames at property box to correct scroller
- * work while each frame would be expanded/collapsed
- */
-#define FRAME_PROPERTY_ADD(PARENT, FRAME, AUTOCOLLAPSE, TITLE, SCROLLER) \
-FRAME_ADD(PARENT, FRAME, AUTOCOLLAPSE, TITLE) \
-evas_object_smart_callback_add(FRAME, "clicked", _on_frame_click, SCROLLER);
-
 struct _Image_Prop_Data
 {
    Evas_Object *box;
    Evas_Object *image_preview;
+   Evas_Object *preview_frame;
 
    Evas_Object *name;
    Evas_Object *location;
@@ -243,12 +236,14 @@ ui_property_image_add(Evas_Object *parent)
    elm_box_align_set(pd->box, 0.5, 0.0);
    evas_object_hide(pd->box);
 
+   FRAME_PROPERTY_ADD(pd->box, pd->preview_frame, true, _("Preview"), pd->box)
    pd->image_preview = elm_layout_add(parent);
    elm_layout_theme_set(pd->image_preview, "layout", "image_editor", 
"preview");
-   elm_box_pack_end(pd->box, pd->image_preview);
    evas_object_size_hint_weight_set(pd->image_preview, EVAS_HINT_EXPAND, 
EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(pd->image_preview, EVAS_HINT_FILL, 
EVAS_HINT_FILL);
    evas_object_show(pd->image_preview);
+   elm_object_content_set(pd->preview_frame, pd->image_preview);
+   elm_box_pack_end(pd->box, pd->preview_frame);
 
    evas_object_data_set(pd->box, IMAGE_PROP_DATA, pd);
 
diff --git a/src/bin/ui/property_macros.h b/src/bin/ui/property_macros.h
index d25b4f7..ca79afc 100644
--- a/src/bin/ui/property_macros.h
+++ b/src/bin/ui/property_macros.h
@@ -28,6 +28,23 @@
  * be used.
  */
 
+#define PROP_ITEM_UNSET(BOX, ITEM) \
+   if (ITEM) \
+     {\
+        evas_object_smart_callback_del(ITEM, "clicked", _on_frame_click); \
+        elm_box_unpack(BOX, ITEM); \
+        evas_object_del(ITEM); \
+        ITEM = NULL; \
+     }
+/*
+ * Callback is added for frames at property box to correct scroller
+ * work while each frame would be expanded/collapsed
+ * TODO: Documentation
+ */
+#define FRAME_PROPERTY_ADD(PARENT, FRAME, AUTOCOLLAPSE, TITLE, SCROLLER) \
+FRAME_ADD(PARENT, FRAME, AUTOCOLLAPSE, TITLE) \
+evas_object_smart_callback_add(FRAME, "clicked", _on_frame_click, SCROLLER);
+
 /**
  * Create new layout with style "elm/layout/property/STYLE".
  * Macro develop for property items, can use in simular cases.
diff --git a/src/bin/ui/property_private.h b/src/bin/ui/property_private.h
index 86b0fd6..d8d3ffc 100644
--- a/src/bin/ui/property_private.h
+++ b/src/bin/ui/property_private.h
@@ -52,4 +52,10 @@ ui_property_part_state_set(Evas_Object *parent, Part_ *part);
 Evas_Object *
 ui_property_image_add(Evas_Object *parent);
 
+/* TODO: put this function into a certain place */
+void
+_on_frame_click(void *data,
+                Evas_Object *obj,
+                void *event_info);
+
 #endif /* UI_PROPERTY_1_H */

-- 


Reply via email to