Dear all

when drag&drop image from elm_photo, elm_cnp_helper makes elm_icon
from the source.
but some non-square images are displayed correctly(due to aspect
ratio, some region is black).
I added aspect_fixed functions to elm_icon and using it in elm_cnp_helper

Thanks.
Index: elementary/src/lib/elm_icon.c
===================================================================
--- elementary/src/lib/elm_icon.c       (리비전 66953)
+++ elementary/src/lib/elm_icon.c       (작업 사본)
@@ -983,3 +983,21 @@
    if (!wd) return;
    _els_smart_icon_preload_set(wd->img, disable);
 }
+
+EAPI void
+elm_icon_aspect_fixed_set(Evas_Object *obj, Eina_Bool fixed)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   return _els_smart_icon_aspect_fixed_set(wd->img, fixed);
+}
+
+EAPI Eina_Bool
+elm_icon_aspect_fixed_get(const Evas_Object *obj)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return EINA_FALSE;
+   return _els_smart_icon_aspect_fixed_get(wd->img);
+}
Index: elementary/src/lib/elm_icon.h
===================================================================
--- elementary/src/lib/elm_icon.h       (리비전 66953)
+++ elementary/src/lib/elm_icon.h       (작업 사본)
@@ -526,5 +526,35 @@
 EAPI Eina_Bool             elm_icon_animated_play_get(const Evas_Object *obj);
 
 /**
+ * Set whether the original aspect ratio of the icon should be kept on resize.
+ *
+ * @param obj The icon object.
+ * @param fixed @c EINA_TRUE if the icon should retain the aspect,
+ * @c EINA_FALSE otherwise.
+ *
+ * The original aspect ratio (width / height) of the icon is usually
+ * distorted to match the object's size. Enabling this option will retain
+ * this original aspect, and the way that the icon is fit into the object's
+ * area depends on the option set by elm_icon_fill_outside_set().
+ *
+ * @see elm_icon_aspect_fixed_get()
+ * @see elm_icon_fill_outside_set()
+ *
+ * @ingroup Icon
+ */
+EAPI void             elm_icon_aspect_fixed_set(Evas_Object *obj, Eina_Bool 
fixed);
+
+/**
+ * Get if the object retains the original aspect ratio.
+ *
+ * @param obj The icon object.
+ * @return @c EINA_TRUE if the object keeps the original aspect, @c EINA_FALSE
+ * otherwise.
+ *
+ * @ingroup Icon
+ */
+EAPI Eina_Bool        elm_icon_aspect_fixed_get(const Evas_Object *obj);
+
+/**
  * @}
  */
Index: elementary/src/lib/elm_cnp_helper.c
===================================================================
--- elementary/src/lib/elm_cnp_helper.c (리비전 66953)
+++ elementary/src/lib/elm_cnp_helper.c (작업 사본)
@@ -1629,6 +1629,7 @@
    /* FIXME: Images only */
    icon = elm_icon_add(dragwin);
    elm_icon_file_set(icon, data + 7, NULL); /* 7!? "file://" */
+   elm_icon_aspect_fixed_set(icon, EINA_FALSE);
    elm_win_resize_object_add(dragwin, icon);
    evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL);
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to