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.
This commit is contained in:
Ji-Youn Park 2016-03-23 17:53:47 +08:30
parent 10c807ed35
commit f8d1db017e
3 changed files with 56 additions and 30 deletions

View File

@ -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"

View File

@ -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.

View File

@ -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"