From dfb8599530bcb86e8307f0403525930bd85397d0 Mon Sep 17 00:00:00 2001 From: Rafael Antognolli Date: Mon, 18 May 2009 21:26:56 +0000 Subject: [PATCH] Added some missing getters to ethumb API. SVN revision: 40730 --- legacy/ethumb/src/lib/Ethumb.c | 43 +++++++++++++++++++++ legacy/ethumb/src/lib/Ethumb.h | 4 ++ legacy/ethumb/src/lib/Ethumb_Plugin.h | 1 + legacy/ethumb/src/plugins/emotion/emotion.c | 12 ++++-- legacy/ethumb/src/plugins/epdf/epdf.c | 9 +++-- 5 files changed, 61 insertions(+), 8 deletions(-) diff --git a/legacy/ethumb/src/lib/Ethumb.c b/legacy/ethumb/src/lib/Ethumb.c index 5e94be5c46..1b706d1965 100644 --- a/legacy/ethumb/src/lib/Ethumb.c +++ b/legacy/ethumb/src/lib/Ethumb.c @@ -427,6 +427,25 @@ ethumb_frame_set(Ethumb *e, const char *theme_file, const char *group, const cha return 1; } +EAPI void +ethumb_frame_get(const Ethumb *e, const char **theme_file, const char **group, const char **swallow) +{ + EINA_SAFETY_ON_NULL_RETURN(e); + + if (e->frame) + { + if (theme_file) *theme_file = e->frame->file; + if (group) *group = e->frame->group; + if (swallow) *swallow = e->frame->swallow; + } + else + { + if (theme_file) *theme_file = NULL; + if (group) *group = NULL; + if (swallow) *swallow = NULL; + } +} + EAPI void ethumb_thumb_dir_path_set(Ethumb *e, const char *path) { @@ -467,6 +486,14 @@ ethumb_video_time_set(Ethumb *e, float time) e->video.time = time; } +EAPI float +ethumb_video_time_get(const Ethumb *e) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(e, 0); + + return e->video.time; +} + EAPI void ethumb_document_page_set(Ethumb *e, int page) { @@ -475,6 +502,14 @@ ethumb_document_page_set(Ethumb *e, int page) e->document.page = page; } +EAPI int +ethumb_document_page_get(const Ethumb *e) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(e, 0); + + return e->document.page; +} + EAPI int ethumb_file_set(Ethumb *e, const char *path, const char *key) { @@ -955,3 +990,11 @@ ethumb_exists(Ethumb *e) return r; } + +Evas * +ethumb_evas_get(Ethumb *e) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(e, NULL); + + return e->sub_e; +} diff --git a/legacy/ethumb/src/lib/Ethumb.h b/legacy/ethumb/src/lib/Ethumb.h index 3cd41a70fc..05b15c87f5 100644 --- a/legacy/ethumb/src/lib/Ethumb.h +++ b/legacy/ethumb/src/lib/Ethumb.h @@ -89,6 +89,7 @@ EAPI void ethumb_thumb_crop_align_set(Ethumb *e, float x, float y) EINA_ARG_NONN EAPI void ethumb_thumb_crop_align_get(Ethumb *e, float *x, float *y) EINA_ARG_NONNULL(1); EAPI int ethumb_frame_set(Ethumb *e, const char *theme_file, const char *group, const char *swallow) EINA_ARG_NONNULL(1); +EAPI void ethumb_frame_get(const Ethumb *e, const char **theme_file, const char **group, const char **swallow) EINA_ARG_NONNULL(1); EAPI void ethumb_thumb_dir_path_set(Ethumb *e, const char *path) EINA_ARG_NONNULL(1); EAPI const char * ethumb_thumb_dir_path_get(Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; @@ -97,7 +98,10 @@ EAPI void ethumb_thumb_category_set(Ethumb *e, const char *category) EINA_ARG_NO EAPI const char * ethumb_thumb_category_get(Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; EAPI void ethumb_video_time_set(Ethumb *e, float time) EINA_ARG_NONNULL(1); +EAPI float ethumb_video_time_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; + EAPI void ethumb_document_page_set(Ethumb *e, int page) EINA_ARG_NONNULL(1); +EAPI int ethumb_document_page_get(const Ethumb *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; EAPI int ethumb_file_set(Ethumb *e, const char *path, const char *key) EINA_ARG_NONNULL(1, 2); EAPI void ethumb_file_get(Ethumb *e, const char **path, const char **key) EINA_ARG_NONNULL(1); diff --git a/legacy/ethumb/src/lib/Ethumb_Plugin.h b/legacy/ethumb/src/lib/Ethumb_Plugin.h index 49e320dcbb..e262c78d7f 100644 --- a/legacy/ethumb/src/lib/Ethumb_Plugin.h +++ b/legacy/ethumb/src/lib/Ethumb_Plugin.h @@ -18,5 +18,6 @@ void ethumb_calculate_fill(Ethumb *e, int iw, int ih, int *fx, int *fy, int *fw, int ethumb_plugin_image_resize(Ethumb *e, int w, int h); int ethumb_image_save(Ethumb *e); void ethumb_finished_callback_call(Ethumb *e); +Evas * ethumb_evas_get(Ethumb *e); #endif /* _ETHUMB_PLUGIN_H_ */ diff --git a/legacy/ethumb/src/plugins/emotion/emotion.c b/legacy/ethumb/src/plugins/emotion/emotion.c index fcf53878c5..2ca1066da1 100644 --- a/legacy/ethumb/src/plugins/emotion/emotion.c +++ b/legacy/ethumb/src/plugins/emotion/emotion.c @@ -1,5 +1,4 @@ #include "Ethumb.h" -#include "ethumb_private.h" #include "Ethumb_Plugin.h" #include "config.h" @@ -38,8 +37,10 @@ _generate_thumb(Ethumb *e) { Evas_Object *o; int r; + const char *file; + float time; - o = emotion_object_add(e->sub_e); + o = emotion_object_add(ethumb_evas_get(e)); r = emotion_object_init(o, "xine"); if (!r) { @@ -49,8 +50,11 @@ _generate_thumb(Ethumb *e) return r; } - emotion_object_file_set(o, e->src_path); - emotion_object_position_set(o, e->video.time); + ethumb_file_get(e, &file, NULL); + time = ethumb_video_time_get(e); + + emotion_object_file_set(o, file); + emotion_object_position_set(o, time); emotion_object_play_set(o, 1); evas_object_smart_callback_add(o, "frame_resize", _frame_resized_cb, e); diff --git a/legacy/ethumb/src/plugins/epdf/epdf.c b/legacy/ethumb/src/plugins/epdf/epdf.c index 7498acf5a6..43111ebbf2 100644 --- a/legacy/ethumb/src/plugins/epdf/epdf.c +++ b/legacy/ethumb/src/plugins/epdf/epdf.c @@ -1,5 +1,4 @@ #include "Ethumb.h" -#include "ethumb_private.h" #include "Ethumb_Plugin.h" #include "config.h" @@ -18,6 +17,7 @@ _generate_thumb(Ethumb *e) int w, h, ww, hh; int fx, fy, fw, fh; int npages; + int pagenum; document = epdf_document_new(e->src_path); if (!document) @@ -35,13 +35,14 @@ _generate_thumb(Ethumb *e) } npages = epdf_document_page_count_get(document); - if (e->document.page < npages) - epdf_page_page_set(page, e->document.page); + pagenum = ethumb_document_page_get(e); + if (pagenum < npages) + epdf_page_page_set(page, pagenum); epdf_page_size_get(page, &w, &h); ethumb_calculate_aspect(e, w, h, &ww, &hh); ethumb_plugin_image_resize(e, ww, hh); - o = evas_object_image_add(e->sub_e); + o = evas_object_image_add(ethumb_evas_get(e)); epdf_page_render(page, o); evas_object_resize(o, ww, hh); evas_object_move(o, 0, 0);