aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2013-02-21 01:11:00 +0000
committerCarsten Haitzler <raster@rasterman.com>2013-02-21 01:11:00 +0000
commit9f530e27d255e396fd6bc79025d3cbead90d2089 (patch)
treee7650346173721da2ef9e0ca55422fe43eb1c73d
parente84828759b7f7a27aefa8678de47ed51a9ca7e9a (diff)
downloadenlightenment-9f530e27d255e396fd6bc79025d3cbead90d2089.tar.gz
enlightenment-9f530e27d255e396fd6bc79025d3cbead90d2089.tar.xz
enlightenment-9f530e27d255e396fd6bc79025d3cbead90d2089.zip
fix valgrind null evas problem with preview.
fix preview aspect ratio out-of-bounds packing with videos when not widescreen. :) SVN revision: 84267
-rw-r--r--src/bin/e_widget_filepreview.c20
-rw-r--r--src/bin/e_widget_preview.c58
2 files changed, 39 insertions, 39 deletions
diff --git a/src/bin/e_widget_filepreview.c b/src/bin/e_widget_filepreview.c
index 8d5a179b1..8f587dc6f 100644
--- a/src/bin/e_widget_filepreview.c
+++ b/src/bin/e_widget_filepreview.c
@@ -220,8 +220,9 @@ _e_wid_fprev_preview_video_position(E_Widget_Data *wd, Evas_Object *obj, void *e
{
double t, tot, ratio;
int iw, ih;
- Evas_Coord w, h;
+ Evas_Coord w, h, mw, mh, ow, oh;
+ evas_object_geometry_get(wd->o_preview_preview, NULL, NULL, &ow, &oh);
evas_object_geometry_get(wd->o_preview_properties_table, NULL, NULL, &w, &h);
tot = emotion_object_play_length_get(obj);
@@ -236,10 +237,23 @@ _e_wid_fprev_preview_video_position(E_Widget_Data *wd, Evas_Object *obj, void *e
if (ratio > 0.0) iw = (ih * ratio) + 0.5;
if (iw < 1) iw = 1;
if (ih < 1) ih = 1;
- e_widget_preview_vsize_set(wd->o_preview_preview, w, (w * ih) / iw);
- e_widget_size_min_set(wd->o_preview_preview, w, (w * ih) / iw);
+
+ w = w;
+ h = (w * ih) / iw;
+ e_widget_preview_vsize_set(wd->o_preview_preview, w, h);
+ if (h > oh)
+ {
+ w = (w * oh) / h;
+ h = oh;
+ }
+ e_widget_size_min_set(wd->o_preview_preview, w, h);
e_widget_table_object_repack(wd->o_preview_properties_table,
wd->o_preview_preview, 0, 0, 2, 2, 0, 0, 1, 1);
+ e_widget_list_object_repack(wd->o_preview_list,
+ wd->o_preview_properties_table,
+ 1, 1, 0.5);
+ e_widget_size_min_get(wd->o_preview_list, &mw, &mh);
+ e_widget_size_min_set(wd->obj, mw, mh);
}
static void
diff --git a/src/bin/e_widget_preview.c b/src/bin/e_widget_preview.c
index 7b9b28463..c52924b4a 100644
--- a/src/bin/e_widget_preview.c
+++ b/src/bin/e_widget_preview.c
@@ -25,23 +25,23 @@ e_widget_preview_add(Evas *evas, int minw, int minh)
if (!wd) return NULL;
wd->obj = obj;
-
+
wd->o_frame = edje_object_add(evas);
e_theme_edje_object_set(wd->o_frame, "base/theme/widgets",
"e/widgets/preview");
evas_object_show(wd->o_frame);
e_widget_sub_object_add(obj, wd->o_frame);
e_widget_resize_object_set(obj, wd->o_frame);
-
+
wd->img = e_livethumb_add(evas);
e_livethumb_vsize_set(wd->img, minw * 2, minh * 2);
edje_extern_object_min_size_set(wd->img, minw, minh);
/* Why do we set max size? This prevents from being nicely resized. */
/* edje_extern_object_max_size_set(o, minw, minh); */
-// evas_object_show(wd->img);
- edje_object_part_swallow(wd->o_frame, "e.swallow.content", wd->img);
+ evas_object_show(wd->img);
e_widget_sub_object_add(obj, wd->img);
-
+ edje_object_part_swallow(wd->o_frame, "e.swallow.content", wd->img);
+
e_widget_data_set(obj, wd);
e_widget_can_focus_set(obj, 0);
edje_object_size_min_calc(wd->o_frame, &mw, &mh);
@@ -78,7 +78,6 @@ e_widget_preview_file_set(Evas_Object *obj, const char *file, const char *key)
wd = e_widget_data_get(obj);
if (wd->o_thumb) evas_object_del(wd->o_thumb);
-
wd->o_thumb = e_icon_add(e_livethumb_evas_get(wd->img));
e_icon_fill_inside_set(wd->o_thumb, 0);
e_icon_file_key_set(wd->o_thumb, file, key);
@@ -96,35 +95,28 @@ e_widget_preview_thumb_set(Evas_Object *obj, const char *file, const char *key,
E_Widget_Data *wd;
wd = e_widget_data_get(obj);
- if (wd->img)
- {
- e_widget_sub_object_del(obj, wd->img);
- evas_object_del(wd->img);
- }
-
- wd->img = e_thumb_icon_add(evas_object_evas_get(obj));
- e_widget_sub_object_add(obj, wd->img);
+ if (wd->o_thumb) evas_object_del(wd->o_thumb);
+ wd->o_thumb = e_thumb_icon_add(e_livethumb_evas_get(wd->img));
if (eina_str_has_extension(file, "edj"))
{
if (key)
- e_thumb_icon_file_set(wd->img, file, key);
+ e_thumb_icon_file_set(wd->o_thumb, file, key);
else
/* FIXME: There is probably a quicker way of doing this. */
if (edje_file_group_exists(file, "icon"))
- e_thumb_icon_file_set(wd->img, file, "icon");
+ e_thumb_icon_file_set(wd->o_thumb, file, "icon");
else if (edje_file_group_exists(file, "e/desktop/background"))
- e_thumb_icon_file_set(wd->img, file, "e/desktop/background");
+ e_thumb_icon_file_set(wd->o_thumb, file, "e/desktop/background");
else if (edje_file_group_exists(file, "e/init/splash"))
- e_thumb_icon_file_set(wd->img, file, "e/init/splash");
+ e_thumb_icon_file_set(wd->o_thumb, file, "e/init/splash");
}
else
- e_thumb_icon_file_set(wd->img, file, NULL);
- evas_object_smart_callback_add(wd->img, "e_thumb_gen", _e_wid_preview_thumb_gen, wd);
- e_thumb_icon_size_set(wd->img, w, h);
- e_thumb_icon_begin(wd->img);
-
- edje_object_part_swallow(wd->o_frame, "e.swallow.content", wd->img);
- evas_object_show(wd->img);
+ e_thumb_icon_file_set(wd->o_thumb, file, NULL);
+ evas_object_smart_callback_add(wd->o_thumb, "e_thumb_gen",
+ _e_wid_preview_thumb_gen, wd);
+ e_thumb_icon_size_set(wd->o_thumb, w, h);
+ e_thumb_icon_begin(wd->o_thumb);
+ e_livethumb_thumb_set(wd->img, wd->o_thumb);
e_widget_change(obj);
@@ -138,24 +130,20 @@ e_widget_preview_vsize_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
wd = e_widget_data_get(obj);
e_livethumb_vsize_set(wd->img, w, h);
+ e_widget_size_min_set(wd->obj, w, h);
+ evas_object_smart_callback_call(wd->obj, "preview_update", NULL);
+ e_widget_change(wd->obj);
}
static void
_e_wid_preview_thumb_gen(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
- Evas_Coord w, h;
E_Widget_Data *wd;
wd = data;
- e_icon_size_get(wd->img, &w, &h);
- edje_extern_object_min_size_set(wd->img, w, h);
- /* Why do we set max size? This prevents from being nicely resized. */
- /* edje_extern_object_max_size_set(wd->img, w, h); */
- edje_object_part_swallow(wd->o_frame, "e.swallow.content", wd->img);
- edje_object_size_min_calc(wd->o_frame, &w, &h);
- e_widget_size_min_set(wd->obj, w, h);
- evas_object_resize(wd->obj, w, h);
+ evas_object_show(wd->o_thumb);
evas_object_smart_callback_call(wd->obj, "preview_update", NULL);
+ e_widget_change(wd->obj);
}
EAPI void
@@ -178,9 +166,7 @@ e_widget_preview_edje_set(Evas_Object *obj, const char *file, const char *group)
wd->o_thumb = edje_object_add(e_livethumb_evas_get(wd->img));
ret = edje_object_file_set(wd->o_thumb, file, group);
e_livethumb_thumb_set(wd->img, wd->o_thumb);
-
e_widget_change(obj);
-
return ret;
}