Attached there are 3 patches for elm_thumb. If they are all ok, can
someone apply them, please?
B.R.
--
Rafael Fonseca
ProFUSION embedded systems
http://www.profusion.mobi
>From 75ebce735e6458f618c1e18b8ec80adb41e32158 Mon Sep 17 00:00:00 2001
From: Rafael Fonseca <rfons...@profusion.mobi>
Date: Tue, 20 Jul 2010 14:00:21 -0300
Subject: [PATCH 1/3] Set size min hint to elm_thumb.
---
src/lib/elm_thumb.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/lib/elm_thumb.c b/src/lib/elm_thumb.c
index 6390d05..f04c098 100644
--- a/src/lib/elm_thumb.c
+++ b/src/lib/elm_thumb.c
@@ -152,6 +152,7 @@ _finished_thumb(Widget_Data *wd, const char *thumb_path,
const char *thumb_key)
{
Eina_Bool new_view = EINA_FALSE;
int r;
+ Evas_Coord mw, mh;
Evas *evas;
evas = evas_object_evas_get(wd->self);
@@ -208,6 +209,9 @@ _finished_thumb(Widget_Data *wd, const char *thumb_path,
const char *thumb_key)
if (new_view) elm_widget_sub_object_add(wd->self, wd->children.view);
edje_object_part_swallow(wd->children.frm, "elm.swallow.content",
wd->children.view);
+ edje_object_size_min_get(wd->children.frm, &mw, &mh);
+ edje_object_size_min_restricted_calc(wd->children.frm, &mw, &mh, mw, mh);
+ evas_object_size_hint_min_set(wd->self, mw, mh);
eina_stringshare_replace(&(wd->thumb.file), thumb_path);
eina_stringshare_replace(&(wd->thumb.key), thumb_key);
edje_object_signal_emit(wd->children.frm, EDJE_SIGNAL_GENERATE_STOP, "elm");
--
1.7.1.1
>From 316b9c9616dd980a6e47a1b0dec0434d3cb49672 Mon Sep 17 00:00:00 2001
From: Rafael Fonseca <rfons...@profusion.mobi>
Date: Tue, 20 Jul 2010 14:04:15 -0300
Subject: [PATCH 2/3] Remove unneeded functions from elm_thumb.
After Sachiel's changes about making the edje_object a sub_object of
elm_thumb widget, all the stuff about alignenment and crop are not
used anymore.
---
src/bin/test_thumb.c | 2 -
src/lib/Elementary.h.in | 4 --
src/lib/elm_thumb.c | 102 -----------------------------------------------
3 files changed, 0 insertions(+), 108 deletions(-)
diff --git a/src/bin/test_thumb.c b/src/bin/test_thumb.c
index d55242b..c90d4ae 100644
--- a/src/bin/test_thumb.c
+++ b/src/bin/test_thumb.c
@@ -47,8 +47,6 @@ test_thumb(void *data, Evas_Object *obj, void *event_info)
EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(th, EVAS_HINT_FILL,
EVAS_HINT_FILL);
- elm_thumb_align_set(th, 0.5, 0.5);
- elm_thumb_keep_aspect_set(th, EINA_TRUE);
elm_table_pack(tb, th, i, j, 1, 1);
evas_object_show(th);
}
diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in
index d865754..4c02df6 100644
--- a/src/lib/Elementary.h.in
+++ b/src/lib/Elementary.h.in
@@ -889,10 +889,6 @@ extern "C" {
EAPI void elm_thumb_file_set(Evas_Object *obj, const char *file,
const char *key);
EAPI void elm_thumb_file_get(const Evas_Object *obj, const char
**file, const char **key);
EAPI void elm_thumb_path_get(const Evas_Object *obj, const char
**file, const char **key);
- EAPI void elm_thumb_keep_aspect_set(Evas_Object *obj, Eina_Bool
setting);
- EAPI Eina_Bool elm_thumb_keep_aspect_get(const Evas_Object *obj);
- EAPI void elm_thumb_align_set(Evas_Object *obj, float x_align, float
y_align);
- EAPI void elm_thumb_align_get(const Evas_Object *obj, float *x,
float *y);
EAPI void elm_thumb_animate_set(Evas_Object *obj,
Elm_Thumb_Animation_Setting s);
EAPI Elm_Thumb_Animation_Setting elm_thumb_animate_get(const Evas_Object
*obj);
EAPI Eina_Bool elm_thumb_ethumb_client_connected(void);
diff --git a/src/lib/elm_thumb.c b/src/lib/elm_thumb.c
index f04c098..56624b2 100644
--- a/src/lib/elm_thumb.c
+++ b/src/lib/elm_thumb.c
@@ -35,9 +35,6 @@ struct _Widget_Data
struct {
Evas_Object *frm;
Evas_Object *view;
- struct {
- float x, y;
- } align;
} children;
const char *file;
const char *key;
@@ -52,7 +49,6 @@ struct _Widget_Data
Eina_Bool on_hold : 1;
Eina_Bool is_video : 1;
Eina_Bool was_video : 1;
- Eina_Bool keep_aspect : 1;
};
static const char *widtype = NULL;
@@ -403,9 +399,6 @@ elm_need_ethumb(void)
*
* @see elm_thumb_file_set()
* @see elm_thumb_ethumb_client_get()
- * @see elm_thumb_keep_aspect_set()
- * @see elm_thumb_align_set()
- * @see elm_thumb_align_get()
*
* @ingroup Thumb
*/
@@ -439,13 +432,10 @@ elm_thumb_add(Evas_Object *parent)
wd->file = NULL;
wd->key = NULL;
wd->eeh = NULL;
- wd->children.align.x = 0.5;
- wd->children.align.y = 0.5;
wd->id = -1;
wd->on_hold = EINA_FALSE;
wd->is_video = EINA_FALSE;
wd->was_video = EINA_FALSE;
- wd->keep_aspect = EINA_FALSE;
#ifdef HAVE_ELEMENTARY_ETHUMB
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN,
@@ -624,98 +614,6 @@ elm_thumb_animate_get(const Evas_Object *obj)
}
/**
- * Set whether the thumbnail exhibition should keep the image or video aspect.
- *
- * For positioning the image/video within the object use the function
- * elm_thumb_align_set().
- *
- * @param obj The thumb object.
- * @param setting Whether keep or not the aspect.
- *
- * @see elm_thumb_file_set()
- * @see elm_thumb_align_set()
- *
- * @ingroup Thumb
- */
-EAPI void
-elm_thumb_keep_aspect_set(Evas_Object *obj, Eina_Bool setting)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- wd->keep_aspect = setting;
-}
-
-/**
- * Get back the aspect info set with @c elm_thumb_keep_aspect_set().
- *
- * @param obj The thumb object.
- * @return Whether the thumb object keeps or not the aspect for its content.
- *
- * @see elm_thumb_file_get()
- * @see elm_thumb_align_get()
- *
- * @ingroup Thumb
- */
-EAPI Eina_Bool
-elm_thumb_keep_aspect_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- Widget_Data *wd = elm_widget_data_get(obj);
- return wd->keep_aspect;
-}
-
-/**
- * Set image/video's alignment within the thumbnail.
- *
- * @param obj The thumb object.
- * @param x_align The x alignment (0 <= x <= 1).
- * @param y_align The y alignment (0 <= y <= 1).
- *
- * @see elm_thumb_keep_aspect_set()
- * @see elm_thumb_align_get()
- *
- * @ingroup Thumb
- */
-EAPI void
-elm_thumb_align_set(Evas_Object *obj, float x_align, float y_align)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (x_align > 1.0)
- x_align = 1.0;
- else if (x_align < 0.0)
- x_align = 0.0;
- wd->children.align.x = x_align;
-
- if (y_align > 1.0)
- y_align = 1.0;
- else if (y_align < 0.0)
- y_align = 0.0;
- wd->children.align.y = y_align;
-}
-
-/**
- * Get the alignenment set for the thumb object.
- *
- * @param obj The thumb object.
- * @param x Pointer to x alignenment.
- * @param y Pointer to y alignenment.
- *
- * @see elm_thumb_align_set()
- *
- * @ingroup Thumb
- */
-EAPI void
-elm_thumb_align_get(const Evas_Object *obj, float *x, float *y)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (x) *x = wd->children.align.x;
- if (y) *y = wd->children.align.y;
-}
-
-/**
* Get the ethumb_client handle so custom configuration can be made.
* This must be called before the objects are created to be sure no object is
* visible and no generation started.
--
1.7.1.1
>From 9cdb3ddca5d6f02358158dc18392bf4fe4014823 Mon Sep 17 00:00:00 2001
From: Rafael Fonseca <rfons...@profusion.mobi>
Date: Tue, 20 Jul 2010 14:22:49 -0300
Subject: [PATCH 3/3] Better variable naming for elm_thumb.
---
src/lib/elm_thumb.c | 104 +++++++++++++++++++++++++--------------------------
1 files changed, 51 insertions(+), 53 deletions(-)
diff --git a/src/lib/elm_thumb.c b/src/lib/elm_thumb.c
index 56624b2..493290b 100644
--- a/src/lib/elm_thumb.c
+++ b/src/lib/elm_thumb.c
@@ -32,19 +32,17 @@ typedef struct _Widget_Data Widget_Data;
struct _Widget_Data
{
Evas_Object *self;
- struct {
- Evas_Object *frm;
- Evas_Object *view;
- } children;
+ Evas_Object *frame;
+ Evas_Object *view;
const char *file;
const char *key;
struct
{
+ int id;
const char *file;
const char *key;
} thumb;
Ecore_Event_Handler *eeh;
- int id;
Elm_Thumb_Animation_Setting anim_setting;
Eina_Bool on_hold : 1;
Eina_Bool is_video : 1;
@@ -91,8 +89,9 @@ _del_hook(Evas_Object *obj)
Widget_Data *wd = elm_widget_data_get(obj);
#ifdef HAVE_ELEMENTARY_ETHUMB
- if (wd->id >= 0)
- ethumb_client_generate_cancel(_elm_ethumb_client, wd->id, NULL, NULL,
NULL);
+ if (wd->thumb.id >= 0)
+ ethumb_client_generate_cancel(_elm_ethumb_client, wd->thumb.id,
+ NULL, NULL, NULL);
#endif
eina_stringshare_del(wd->file);
@@ -105,7 +104,7 @@ static void
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- _elm_theme_object_set(obj, wd->children.frm, "thumb", "base",
elm_widget_style_get(obj));
+ _elm_theme_object_set(obj, wd->frame, "thumb", "base",
elm_widget_style_get(obj));
}
#ifdef HAVE_ELEMENTARY_ETHUMB
@@ -152,20 +151,20 @@ _finished_thumb(Widget_Data *wd, const char *thumb_path,
const char *thumb_key)
Evas *evas;
evas = evas_object_evas_get(wd->self);
- if ((wd->children.view) && (wd->is_video ^ wd->was_video))
+ if ((wd->view) && (wd->is_video ^ wd->was_video))
{
- evas_object_del(wd->children.view);
- wd->children.view = NULL;
+ evas_object_del(wd->view);
+ wd->view = NULL;
}
wd->was_video = wd->is_video;
if ((wd->is_video) &&
(ethumb_client_format_get(_elm_ethumb_client) == ETHUMB_THUMB_EET))
{
- if (!wd->children.view)
+ if (!wd->view)
{
- wd->children.view = edje_object_add(evas);
- if (!wd->children.view)
+ wd->view = edje_object_add(evas);
+ if (!wd->view)
{
ERR("could not create edje object");
goto err;
@@ -173,7 +172,7 @@ _finished_thumb(Widget_Data *wd, const char *thumb_path,
const char *thumb_key)
new_view = EINA_TRUE;
}
- if (!edje_object_file_set(wd->children.view, thumb_path, "movie/thumb"))
+ if (!edje_object_file_set(wd->view, thumb_path, "movie/thumb"))
{
ERR("could not set file=%s key=%s for %s", thumb_path, thumb_key,
wd->file);
@@ -182,10 +181,10 @@ _finished_thumb(Widget_Data *wd, const char *thumb_path,
const char *thumb_key)
}
else
{
- if (!wd->children.view)
+ if (!wd->view)
{
- wd->children.view = evas_object_image_filled_add(evas);
- if (!wd->children.view)
+ wd->view = evas_object_image_filled_add(evas);
+ if (!wd->view)
{
ERR("could not create image object");
goto err;
@@ -193,8 +192,8 @@ _finished_thumb(Widget_Data *wd, const char *thumb_path,
const char *thumb_key)
new_view = EINA_TRUE;
}
- evas_object_image_file_set(wd->children.view, thumb_path, thumb_key);
- r = evas_object_image_load_error_get(wd->children.view);
+ evas_object_image_file_set(wd->view, thumb_path, thumb_key);
+ r = evas_object_image_load_error_get(wd->view);
if (r != EVAS_LOAD_ERROR_NONE)
{
ERR("%s: %s", thumb_path, evas_load_error_str(r));
@@ -202,23 +201,22 @@ _finished_thumb(Widget_Data *wd, const char *thumb_path,
const char *thumb_key)
}
}
- if (new_view) elm_widget_sub_object_add(wd->self, wd->children.view);
- edje_object_part_swallow(wd->children.frm, "elm.swallow.content",
- wd->children.view);
- edje_object_size_min_get(wd->children.frm, &mw, &mh);
- edje_object_size_min_restricted_calc(wd->children.frm, &mw, &mh, mw, mh);
+ if (new_view) elm_widget_sub_object_add(wd->self, wd->view);
+ edje_object_part_swallow(wd->frame, "elm.swallow.content", wd->view);
+ edje_object_size_min_get(wd->frame, &mw, &mh);
+ edje_object_size_min_restricted_calc(wd->frame, &mw, &mh, mw, mh);
evas_object_size_hint_min_set(wd->self, mw, mh);
eina_stringshare_replace(&(wd->thumb.file), thumb_path);
eina_stringshare_replace(&(wd->thumb.key), thumb_key);
- edje_object_signal_emit(wd->children.frm, EDJE_SIGNAL_GENERATE_STOP, "elm");
+ edje_object_signal_emit(wd->frame, EDJE_SIGNAL_GENERATE_STOP, "elm");
evas_object_smart_callback_call(wd->self, SIG_GENERATE_STOP, NULL);
return;
view_err:
- evas_object_del(wd->children.view);
- wd->children.view = NULL;
+ evas_object_del(wd->view);
+ wd->view = NULL;
err:
- edje_object_signal_emit(wd->children.frm, EDJE_SIGNAL_LOAD_ERROR, "elm");
+ edje_object_signal_emit(wd->frame, EDJE_SIGNAL_LOAD_ERROR, "elm");
evas_object_smart_callback_call(wd->self, SIG_LOAD_ERROR, NULL);
}
@@ -227,10 +225,10 @@ _finished_thumb_cb(void *data, Ethumb_Client *c
__UNUSED__, int id, const char *
{
Widget_Data *wd = data;
- EINA_SAFETY_ON_FALSE_RETURN(wd->id == id);
- wd->id = -1;
+ EINA_SAFETY_ON_FALSE_RETURN(wd->thumb.id == id);
+ wd->thumb.id = -1;
- edje_object_signal_emit(wd->children.frm, EDJE_SIGNAL_PULSE_STOP, "elm");
+ edje_object_signal_emit(wd->frame, EDJE_SIGNAL_PULSE_STOP, "elm");
if (success)
{
@@ -239,7 +237,7 @@ _finished_thumb_cb(void *data, Ethumb_Client *c __UNUSED__,
int id, const char *
}
ERR("could not generate thumbnail for %s (key: %s)", file, key ? key : "");
- edje_object_signal_emit(wd->children.frm, EDJE_SIGNAL_GENERATE_ERROR,
"elm");
+ edje_object_signal_emit(wd->frame, EDJE_SIGNAL_GENERATE_ERROR, "elm");
evas_object_smart_callback_call(wd->self, SIG_GENERATE_ERROR, NULL);
}
@@ -250,25 +248,25 @@ _thumb_apply(Widget_Data *wd)
if (ethumb_client_thumb_exists(_elm_ethumb_client))
{
const char *thumb_path, *thumb_key;
- wd->id = -1;
+ wd->thumb.id = -1;
ethumb_client_thumb_path_get(_elm_ethumb_client, &thumb_path,
&thumb_key);
_finished_thumb(wd, thumb_path, thumb_key);
return;
}
- else if ((wd->id = ethumb_client_generate
+ else if ((wd->thumb.id = ethumb_client_generate
(_elm_ethumb_client, _finished_thumb_cb, wd, NULL)) != -1)
{
- edje_object_signal_emit(wd->children.frm, EDJE_SIGNAL_PULSE_START,
+ edje_object_signal_emit(wd->frame, EDJE_SIGNAL_PULSE_START,
"elm");
- edje_object_signal_emit(wd->children.frm, EDJE_SIGNAL_GENERATE_START,
+ edje_object_signal_emit(wd->frame, EDJE_SIGNAL_GENERATE_START,
"elm");
evas_object_smart_callback_call(wd->self, SIG_GENERATE_START, NULL);
}
else
{
- wd->id = -1;
- edje_object_signal_emit(wd->children.frm, EDJE_SIGNAL_GENERATE_ERROR,
+ wd->thumb.id = -1;
+ edje_object_signal_emit(wd->frame, EDJE_SIGNAL_GENERATE_ERROR,
"elm");
evas_object_smart_callback_call(wd->self, SIG_GENERATE_ERROR, NULL);
}
@@ -284,7 +282,7 @@ _thumb_apply_cb(void *data, int type __UNUSED__, void *ev
__UNUSED__)
static void
_thumb_show(Widget_Data *wd)
{
- evas_object_show(wd->children.frm);
+ evas_object_show(wd->frame);
if (elm_thumb_ethumb_client_connected())
{
@@ -308,15 +306,15 @@ _thumb_hide_cb(void *data, Evas *e __UNUSED__,
Evas_Object *obj __UNUSED__, void
{
Widget_Data *wd = data;
- evas_object_hide(wd->children.frm);
+ evas_object_hide(wd->frame);
- if (wd->id >= 0)
+ if (wd->thumb.id >= 0)
{
ethumb_client_generate_cancel
- (_elm_ethumb_client, wd->id, NULL, NULL, NULL);
- wd->id = -1;
+ (_elm_ethumb_client, wd->thumb.id, NULL, NULL, NULL);
+ wd->thumb.id = -1;
- edje_object_signal_emit(wd->children.frm, EDJE_SIGNAL_GENERATE_STOP,
"elm");
+ edje_object_signal_emit(wd->frame, EDJE_SIGNAL_GENERATE_STOP, "elm");
evas_object_smart_callback_call(wd->self, SIG_GENERATE_STOP, NULL);
}
@@ -420,19 +418,19 @@ elm_thumb_add(Evas_Object *parent)
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
- wd->children.frm = edje_object_add(evas);
- _elm_theme_object_set(obj, wd->children.frm, "thumb", "base", "default");
- elm_widget_resize_object_set(obj, wd->children.frm);
+ wd->frame = edje_object_add(evas);
+ _elm_theme_object_set(obj, wd->frame, "thumb", "base", "default");
+ elm_widget_resize_object_set(obj, wd->frame);
edje_object_size_min_calc(obj, &minw, &minh);
evas_object_size_hint_min_set(obj, minw, minh);
wd->self = obj;
- wd->children.view = NULL;
+ wd->view = NULL;
wd->file = NULL;
wd->key = NULL;
wd->eeh = NULL;
- wd->id = -1;
+ wd->thumb.id = -1;
wd->on_hold = EINA_FALSE;
wd->is_video = EINA_FALSE;
wd->was_video = EINA_FALSE;
@@ -586,11 +584,11 @@ elm_thumb_animate_set(Evas_Object *obj,
Elm_Thumb_Animation_Setting setting)
wd->anim_setting = setting;
if (setting == ELM_THUMB_ANIMATION_LOOP)
- edje_object_signal_emit(wd->children.view, "animate_loop", "");
+ edje_object_signal_emit(wd->view, "animate_loop", "");
else if (setting == ELM_THUMB_ANIMATION_START)
- edje_object_signal_emit(wd->children.view, "animate", "");
+ edje_object_signal_emit(wd->view, "animate", "");
else if (setting == ELM_THUMB_ANIMATION_STOP)
- edje_object_signal_emit(wd->children.view, "animate_stop", "");
+ edje_object_signal_emit(wd->view, "animate_stop", "");
}
/**
--
1.7.1.1
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel