From f8d1db017edab8809e597591456751837deba68d Mon Sep 17 00:00:00 2001 From: Ji-Youn Park Date: Wed, 23 Mar 2016 17:53:47 +0830 Subject: [PATCH] Elm_Image: remove Elm.Image.scale property. use the Elm.Widget.scale. elm image don't need to manage scale value itself. Just modify eo part. legacy c part(ex: remove scale data in elm image)is still remains. --- legacy/elementary/src/lib/elm_image.c | 50 +++++++++++++++++++--------- legacy/elementary/src/lib/elm_image.eo | 14 -------- legacy/elementary/src/lib/elm_image_legacy.h | 22 ++++++++++++ 3 files changed, 56 insertions(+), 30 deletions(-) diff --git a/legacy/elementary/src/lib/elm_image.c b/legacy/elementary/src/lib/elm_image.c index c3025bf..e5b533e 100644 --- a/legacy/elementary/src/lib/elm_image.c +++ b/legacy/elementary/src/lib/elm_image.c @@ -797,6 +797,15 @@ _elm_image_elm_widget_event(Eo *obj, Elm_Image_Data *_pd EINA_UNUSED, Evas_Objec return EINA_TRUE; } +// TODO: remove this function after using the widget's scale value instead of image's scale value, + +static void +_elm_image_internal_scale_set(Evas_Object *obj, Elm_Image_Data *sd, double scale) +{ + sd->scale = scale; + _elm_image_internal_sizing_eval(obj, sd); +} + EOLIAN static void _elm_image_sizing_eval(Eo *obj, Elm_Image_Data *sd) { @@ -807,9 +816,9 @@ _elm_image_sizing_eval(Eo *obj, Elm_Image_Data *sd) efl_image_smooth_scale_set(obj, sd->smooth); if (sd->no_scale) - elm_obj_image_scale_set(obj, 1.0); + _elm_image_internal_scale_set(obj, sd, 1.0); else - elm_obj_image_scale_set(obj, elm_widget_scale_get(obj) * elm_config_scale_get()); + _elm_image_internal_scale_set(obj, sd, elm_widget_scale_get(obj) * elm_config_scale_get()); ts = sd->scale; sd->scale = 1.0; @@ -883,20 +892,6 @@ _elm_image_file_set_do(Evas_Object *obj) } } -EOLIAN static void -_elm_image_scale_set(Eo *obj, Elm_Image_Data *sd, double scale) -{ - sd->scale = scale; - - _elm_image_internal_sizing_eval(obj, sd); -} - -EOLIAN static double -_elm_image_scale_get(Eo *obj EINA_UNUSED, Elm_Image_Data *sd) -{ - return sd->scale; -} - EAPI Evas_Object * elm_image_add(Evas_Object *parent) { @@ -1644,4 +1639,27 @@ elm_image_memfile_set(Evas_Object *obj, const void *img, size_t size, const char return EINA_TRUE; } +// TODO: use the widget's scale value instead of image's scale value. + +EAPI void +elm_image_scale_set(Evas_Object *obj, + double scale) +{ + ELM_IMAGE_CHECK(obj); + ELM_IMAGE_DATA_GET(obj, sd); + + sd->scale = scale; + + _elm_image_internal_sizing_eval(obj, sd); +} + +EAPI double +elm_image_scale_get(const Evas_Object *obj) +{ + ELM_IMAGE_CHECK(obj) -1; + ELM_IMAGE_DATA_GET(obj, sd); + + return sd->scale; +} + #include "elm_image.eo.c" diff --git a/legacy/elementary/src/lib/elm_image.eo b/legacy/elementary/src/lib/elm_image.eo index 52ca4b0..de511e0 100644 --- a/legacy/elementary/src/lib/elm_image.eo +++ b/legacy/elementary/src/lib/elm_image.eo @@ -91,20 +91,6 @@ class Elm.Image (Elm.Widget, Efl.File, Efl.Image_Load, Evas.Clickable_Interface, no_scale: bool; [[$true if the object is not scalable, $false otherwise. Default is $false.]] } } - @property scale { - [[Control the scale of the object's image. - - @since 1.7]] - set { - legacy: null; - } - get { - legacy: null; - } - values { - scale: double; [[Object's image scale.]] - } - } @property fill_inside { [[Control the resize method for the object's internal image when maintaining a given aspect ratio. diff --git a/legacy/elementary/src/lib/elm_image_legacy.h b/legacy/elementary/src/lib/elm_image_legacy.h index db79883..ff402dc 100644 --- a/legacy/elementary/src/lib/elm_image_legacy.h +++ b/legacy/elementary/src/lib/elm_image_legacy.h @@ -298,4 +298,26 @@ EAPI Eina_Bool elm_image_editable_get(const Evas_Object *obj); * @ingroup Elm_Image */ EAPI Eina_Bool elm_image_memfile_set(Evas_Object *obj, const void *img, size_t size, const char *format, const char *key); + +/** + * @brief Control the scale of the object's image. + * + * @param[in] scale Object's image scale. + * + * @since 1.7 + * + * @ingroup Elm_Image + */ +EAPI void elm_image_scale_set(Evas_Object *obj, double scale); + +/** + * @brief Control the scale of the object's image. + * + * @return Object's image scale. + * + * @since 1.7 + * + * @ingroup Elm_Image + */ +EAPI double elm_image_scale_get(const Evas_Object *obj); #include "elm_image.eo.legacy.h" -- 2.7.4