summaryrefslogtreecommitdiff
path: root/main/src/view/ivug-slider.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/view/ivug-slider.c')
-rwxr-xr-xmain/src/view/ivug-slider.c1245
1 files changed, 0 insertions, 1245 deletions
diff --git a/main/src/view/ivug-slider.c b/main/src/view/ivug-slider.c
deleted file mode 100755
index fe5645b..0000000
--- a/main/src/view/ivug-slider.c
+++ /dev/null
@@ -1,1245 +0,0 @@
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.tizenopensource.org/license
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include <ui-gadget-module.h> // ug_destroy_me, ug_send_result
-
-#include "ivug-slider.h"
-#include "ivug-common.h"
-#include "ivug-main.h"
-
-#include "ivug-parameter.h"
-#include "ivug-define.h"
-#include "ivug-effect.h"
-#include "ivug-config.h"
-
-#include "ivug-util.h"
-#include "ivug-data.h"
-#include "ivug-data-shuffle.h"
-
-#include "ivug-mouse-event.h"
-#include "ivug-slider-item.h"
-#include "ivug-anim.h"
-#include "ivug-slider-priv.h"
-
-#undef LOG_TAG
-#define LOG_TAG "IV-SLIDER"
-
-#define DEFFERED_LOADING
-
-#define ANI_TIME_FLICK (0.2f)
-
-static Eina_Bool _ivug_slider_on_animation(void *data);
-
-//smart object
-static void
-_ivug_slider_smart_init(void);
-static void
-_ivug_slider_smart_add(Evas_Object *obj);
-static void
-_ivug_slider_smart_del(Evas_Object *obj);
-static void
-_ivug_slider_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
-static void
-_ivug_slider_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
-static void
-_ivug_slider_smart_show(Evas_Object *obj);
-static void
-_ivug_slider_smart_hide(Evas_Object *obj);
-static void
-_ivug_slider_smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
-static void
-_ivug_slider_smart_clip_set(Evas_Object *obj, Evas_Object * clip);
-static void
-_ivug_slider_smart_clip_unset(Evas_Object *obj);
-
-/* local subsystem globals */
-static Evas_Smart *_smart_ = NULL;
-
-// Smart Object
-static void
-_ivug_slider_smart_init(void)
-{
- if (_smart_) return;
- {
- const char* name = eina_stringshare_add("ivug-slider");
- MSG_SLIDER_MED("name=%s", name);
- static Evas_Smart_Class sc =
- {
- NULL,
- EVAS_SMART_CLASS_VERSION,
- _ivug_slider_smart_add,
- _ivug_slider_smart_del,
- _ivug_slider_smart_move,
- _ivug_slider_smart_resize,
- _ivug_slider_smart_show,
- _ivug_slider_smart_hide,
- _ivug_slider_smart_color_set,
- _ivug_slider_smart_clip_set,
- _ivug_slider_smart_clip_unset,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
- }; //Evas_smart_Class
- sc.name = name;
- _smart_ = evas_smart_class_new(&sc);
- }
-}
-
-
-void
-_ivug_slider_pass_event_to_item(struct Smart_Data *sd, Eina_Bool bPass)
-{
- int i = 0;
-
- if ( bPass == EINA_TRUE)
- {
- MSG_SLIDER_HIGH("Photocam can get Event");
-// Later, will enable below code.
-// evas_object_repeat_events_set(sd->event_obj, EINA_TRUE );
- }
- else
- {
- MSG_SLIDER_MED("Photocam can not get Event");
-// evas_object_repeat_events_set(sd->event_obj, EINA_FALSE );
- }
-
- for (i = 0; i < MAX_SLIDE; i++)
- {
- ivug_slider_item_hold_set(sd->slide[i], !bPass);
- }
-}
-
-
-#define _ivug_slider_edge_state_get(si) __ivug_slider_edge_state_get(si, __func__, __LINE__)
-
-slide_edge_t __ivug_slider_edge_state_get(Slide_Item *si, const char *func, int line)
-{
- int nx, ny, nw, nh;
-
- slide_edge_t result = SLIDE_NO_EDGE;
-
- if ( ivug_slider_item_region_size_get(si, &nx, &ny, &nw, &nh) == false)
- {
- // false means video file item. in this case, no photocam exists.
- MSG_SLIDER_HIGH("[%20s:%4d] Slide fit. Thumbnail only", func, line);
- result = SLIDE_FIT;
- }
- else
- {
- if ( nw <= (si->w + IMAGE_SCROLL_MARGIN) && (nh <= si->h + IMAGE_SCROLL_MARGIN))
- {
- MSG_SLIDER_HIGH("[%20s:%4d] Slide fit", func, line);
- result = SLIDE_FIT;
- }
- else
- {
- MSG_SLIDER_HIGH("No edge!!");
- return SLIDE_NO_EDGE;
- }
- }
-
- if ( result == SLIDE_NO_EDGE )
- {
- MSG_SLIDER_HIGH("[%20s:%4d] image over screen. %d", func, line, result);
- }
-
- return result;
-}
-
-static Eina_Bool _idler_loading_func(void* data)
-{
- struct Smart_Data *sd = data;
-
- int i;
- sd->load_idler = NULL;
-
- if ( sd->slide[CENTER_SLIDE]->state == SLIDE_STATE_READY ) // Center image must be loaded even while other image is loading.
- {
- ivug_slider_item_data_loading(sd->slide[CENTER_SLIDE]);
- goto end;
- }
-
- for ( i = 0; i < MAX_SLIDE ; i++)
- {
- if ( sd->slide[i]->state == SLIDE_STATE_LOADING )
- {
- goto end;
- }
- }
-
- if ( sd->slide[NEXT_SLIDE]->state == SLIDE_STATE_READY )
- {
- ivug_slider_item_data_loading(sd->slide[NEXT_SLIDE]);
- goto end;
- }
-
- if ( sd->slide[PREV_SLIDE]->state == SLIDE_STATE_READY )
- {
- ivug_slider_item_data_loading(sd->slide[PREV_SLIDE]);
- goto end;
- }
-
- MSG_SLIDER_WARN("Set Data loading State=%d,%d,%d",
- sd->slide[PREV_SLIDE]->state,
- sd->slide[CENTER_SLIDE]->state,
- sd->slide[NEXT_SLIDE]->state
- );
-
-
-end:
- return ECORE_CALLBACK_CANCEL;
-
-}
-
-
-static Eina_Bool
-_ivug_slider_set_window_loading_idler(void* data)
-{
- ivug_retv_if(!data, ECORE_CALLBACK_CANCEL);
-
- struct Smart_Data *sd = (struct Smart_Data *)data;
- ivug_retv_if(!sd, ECORE_CALLBACK_CANCEL);
-
- Load_State status = IVUG_SLIDER_LOADED_NONE;
-
- if(sd->ss_state != SLIDE_SHOW_RUNNING)
- {
- status = ivug_data_set_window_loading(sd->media_list, sd->cur_list_idx, sd->list_total_count);
- switch(status)
- {
- case IVUG_SLIDER_LOADED_RIGHT:
- if(sd->slide[NEXT_SLIDE]->mitem == NULL)
- {
- Media_Item *item = ivug_data_get_next(sd->slide[CENTER_SLIDE]->mitem);
- if(item != NULL) /* loaded but not set yet */
- {
- MSG_SLIDER_HIGH("SET NEXT!!!!!!!!!!");
- ivug_slider_item_data_set(sd->slide[NEXT_SLIDE], item); //set data.
-#ifdef DEFFERED_LOADING
- if ( sd->load_idler == NULL )
- {
- sd->load_idler = ecore_idler_add(_idler_loading_func, sd);
- }
-#else
- ivug_slider_item_data_loading(sd->slide[NEXT_SLIDE]); //set data.
-#endif
-
- }
- }
- break;
- case IVUG_SLIDER_LOADED_LEFT:
- if(sd->slide[PREV_SLIDE]->mitem == NULL)
- {
- Media_Item *item = ivug_data_get_prev(sd->slide[CENTER_SLIDE]->mitem);
- if(item != NULL) /* loaded but not set yet */
- {
- MSG_SLIDER_HIGH("SET PREV!!!!!!!!!!");
- ivug_slider_item_data_set(sd->slide[PREV_SLIDE], item); //set data.
-#ifdef DEFFERED_LOADING
- if ( sd->load_idler == NULL )
- {
- sd->load_idler = ecore_idler_add(_idler_loading_func, sd);
- }
-#else
- ivug_slider_item_data_loading(sd->slide[PREV_SLIDE]); //set data.
-#endif
-
- }
- }
- break;
- default :
- MSG_SLIDER_WARN("Unhandled state : %d", status);
- break;
- }
- }
- else
- {
- MSG_SLIDER_HIGH("SLIDE_SHOW_RUNNING!!!!!!!!!!");
- ivug_data_set_next_slide_show_item(sd->media_list, sd->ss_mode, &(sd->next_list_idx), sd->list_total_count);
- }
-
- if (sd->idler_list)
- {
- ecore_idler_del(sd->idler_list);
- sd->idler_list = NULL;
- }
-
- return ECORE_CALLBACK_CANCEL;
-}
-
-void _ivug_slider_item_changed(slide_state_t state, Slide_Item *si, void *client_data)
-{
- struct Smart_Data *sd = client_data;
- IV_ASSERT(sd != NULL);
-
- if ( state == SLIDE_STATE_LOADED )
- {
- if ( sd->slide[CENTER_SLIDE] == si )
- {
- MSG_SLIDER_HIGH("Call Item state changed callback State=%d Si->State=%d", state, si->state);
- evas_object_smart_callback_call(sd->obj, "slider,item,state,changed", si);
- }
- }
- else if (state == SLIDE_STATE_ERROR)
- {
- if ( sd->slide[CENTER_SLIDE] == si )
- {
- MSG_SLIDER_ERROR("Decoding failed");
- evas_object_smart_callback_call(sd->obj, "slider,item,state,changed", si);
- }
- }
- else
- {
- MSG_SLIDER_ERROR("Unknown state : %d", state);
- if ( sd->slide[CENTER_SLIDE] == si )
- {
- MSG_SLIDER_ERROR("Unknown state");
- evas_object_smart_callback_call(sd->obj, "slider,item,state,changed", si);
- }
- }
-
- if ( sd->load_idler == NULL )
- {
- MSG_SLIDER_HIGH("Add idler for loading.");
- sd->load_idler = ecore_idler_add(_idler_loading_func, sd);
- }
-
-}
-
-void ivug_slider_restore_window_list(Evas_Object *obj)
-{
- struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
-
- MSG_SDATA_HIGH("******* restore slide show index %d", sd->cur_list_idx);
-
- Media_Item *item = NULL;
- Eina_List *new_list = NULL;
- int start_index = sd->cur_list_idx;
- int list_total_count = sd->list_total_count;
-
- Media_Data *mdata = ivug_data_get_data(sd->slide[CENTER_SLIDE]->mitem);
- if(mdata == NULL)
- {
- MSG_SLIDER_ERROR("mdata is NULL");
- return;
- }
-
- char *path = mdata->filepath;
- if(path == NULL)
- {
- path = mdata->fileurl;
- }
- ivug_data_reset_window_load_count(sd->media_list); /* TODO : it is temp */
- item = ivug_data_create_media_list_from_param
- (sd->media_list, &new_list, path, &start_index, &list_total_count); //get list by file path.
- if(item == NULL)
- {
- MSG_SLIDER_ERROR("create media list failed");
- ug_destroy_me(gGetUGHandle());
- return;
- }
-
- if (!ivug_slider_set_slide_list(sd->obj, sd->media_list, new_list, item, start_index, list_total_count))
- {
- MSG_SLIDER_ERROR("slide list set Error");
- ug_destroy_me(gGetUGHandle());
- return ;
- }
-}
-
-
-static void
-_ivug_slider_smart_add(Evas_Object *obj)
-{
- MSG_SLIDER_HIGH("Slider Add : 0x%08x", obj);
-
- PERF_CHECK_BEGIN(LVL4 "add slider item");
-
- struct Smart_Data *sd = calloc(1, sizeof(struct Smart_Data));
- ivug_ret_if(!sd);
-
- sd->obj = obj;
- evas_object_smart_data_set(obj, sd);
- int idx = 0;
-
-//create slider item.
- for (idx = 0; idx < MAX_SLIDE; idx++)
- {
- sd->slide[idx] = ivug_slider_item_add(obj);
- ivug_slider_item_set_callback(sd->slide[idx], _ivug_slider_item_changed, sd);
- }
-
- PERF_CHECK_END(LVL4 "add slider item");
-
- PERF_CHECK_BEGIN(LVL4 "remants");
-
- sd->event_obj = evas_object_rectangle_add(evas_object_evas_get(obj));
- evas_object_color_set(sd->event_obj , 0, 0, 0, 0); // Fully Transparent object.
- evas_object_size_hint_align_set(sd->event_obj, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(sd->event_obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
- evas_object_show(sd->event_obj);
-
- evas_object_smart_member_add(sd->event_obj, obj);
- evas_object_repeat_events_set(sd->event_obj, EINA_TRUE); // mouse event should pass to phocam
-
- mouse_callback_t cb = {0,};
-
- cb.onMouseDown = _ivug_on_mouse_down;
- cb.onMouseUp = _ivug_on_mouse_up;
-
- cb.onMouseMove = _ivug_on_mouse_move;
-
- sd->mouse_event = ivug_mouse_event_add(sd->event_obj, &cb, obj, "SLIDER");
- sd->edge = SLIDE_FIT;
-
- sd->idler_list = NULL;
-
- sd->anim = create_animation();
- set_animation_type(sd->anim,ANIM_TYPE_QUARTIC_INOUT);
-
- PERF_CHECK_END(LVL4 "remants");
- return;
-
-}
-
-static void
-_ivug_slider_smart_del(Evas_Object *obj)
-{
- MSG_SLIDER_HIGH("Slider delete");
-
- struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
- ivug_ret_if(!sd);
-
- if(sd->click_timer)
- {
- ecore_timer_del(sd->click_timer);
- sd->click_timer = NULL;
- }
-
- if ( sd->load_idler )
- {
- ecore_idler_del(sd->load_idler);
- sd->load_idler = NULL;
- }
-
- if(sd->animator)
- {
- ecore_animator_del(sd->animator);
- sd->animator = NULL;
- }
-
- if ( sd->anim )
- {
- delete_animation(sd->anim);
- sd->anim = NULL;
- }
- if (sd->long_timer)
- {
- ecore_timer_del(sd->long_timer);
- sd->long_timer = NULL;
- }
-
- if(sd->ss_timer)
- {
- ecore_timer_del(sd->ss_timer);
- sd->ss_timer = NULL;
- }
-
- if (sd->idler_list)
- {
- ecore_idler_del(sd->idler_list);
- sd->idler_list = NULL;
- }
-
- if ( sd->event_obj )
- {
- ivug_mouse_event_del(sd->mouse_event);
-
- evas_object_del(sd->event_obj);
- sd->event_obj = NULL;
- }
-
- int i=0;
- for (i = 0; i < MAX_SLIDE ; i++) //delete layout
- {
- ivug_slider_item_del(sd->slide[i]);
- sd->slide[i] = NULL;
- }
-
- if (sd->media_list)
- {
- ivug_data_delete_media_list(sd->media_list);
- }
-
- free(sd);
-
- IVUG_FUNC_LEAVE();
-}
-
-
-static void
-_ivug_slider_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
-{
- struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
- ivug_ret_if(!sd);
-
- if ((sd->x == x) && (sd->y == y)) return;
-
- MSG_SLIDER_MED("Slider Move : XY(%d,%d)", x, y);
-
- sd->x = x;
- sd->y = y;
- _ivug_slider_slide_update_pos(sd, x, y);
-
- evas_object_move(sd->event_obj, sd->x, sd->y);
-}
-
-static void
-_ivug_slider_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
-{
- MSG_SLIDER_HIGH("Slider Resize : WH(%d,%d)", w,h);
-
- struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
- ivug_ret_if(!sd);
-
- if ((sd->w == w) && (sd->h == h)) return;
-
- sd->w = w;
- sd->h = h;
-
- if ( sd->animator != NULL )
- {
- // Remove animation during rotation
- ecore_animator_del(sd->animator);
- sd->animator = NULL;
- }
-
- //resize layout
- int i = 0;
- for (i = 0; i < MAX_SLIDE; i++)
- { //set resize
- ivug_slider_item_resize(sd->slide[i], w, h);
- }
-
-// Redraw items.
- ivug_slider_item_move(sd->slide[CENTER_SLIDE], 0, 0);
-
-// TODO : so as to increas perf, dont draw slide under certain condition
- ivug_slider_item_move(sd->slide[PREV_SLIDE], - sd->slide[PREV_SLIDE]->w - IMAGE_BETWEEN_MARGIN ,0);
-
- int right_x;
-
- if ( sd->w < sd->slide[CENTER_SLIDE]->w )
- {
- right_x = sd->w + IMAGE_BETWEEN_MARGIN;
- }
- else
- {
- right_x = sd->slide[CENTER_SLIDE]->w + IMAGE_BETWEEN_MARGIN;
- }
-
- ivug_slider_item_move(sd->slide[NEXT_SLIDE], right_x, 0);
-
-// evas_object_move(sd->event_obj, sd->x, sd->y);
- evas_object_resize(sd->event_obj, sd->w, sd->h);
-}
-
-static void
-_ivug_slider_smart_show(Evas_Object *obj)
-{
- struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
- ivug_ret_if(!sd);
-
- if ( sd->bShow == EINA_TRUE) return;
-
- sd->bShow = EINA_TRUE;
-
- MSG_SLIDER_HIGH("Slider Show");
-
- ivug_slider_item_show(sd->slide[CENTER_SLIDE]);
- ivug_slider_item_show(sd->slide[NEXT_SLIDE]);
- ivug_slider_item_show(sd->slide[PREV_SLIDE]);
-
- evas_object_show(sd->event_obj);
-}
-
-static void
-_ivug_slider_smart_hide(Evas_Object *obj)
-{
- ivug_ret_if(!obj);
- struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
-
- if ( sd->bShow == EINA_FALSE) return;
-
- sd->bShow = EINA_FALSE;
-
- MSG_SLIDER_HIGH("Slider Hide");
-
- ivug_slider_item_hide(sd->slide[CENTER_SLIDE]);
- ivug_slider_item_hide(sd->slide[NEXT_SLIDE]);
- ivug_slider_item_hide(sd->slide[PREV_SLIDE]);
-
- evas_object_hide(sd->event_obj);
-}
-
-static void
-_ivug_slider_smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
-{
- MSG_SLIDER_HIGH("Slider Color set : RGBA(%d,%d,%d,%d)", r, g, b, a);
- ivug_ret_if(!obj);
-// struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
-}
-
-static void
-_ivug_slider_smart_clip_set(Evas_Object *obj, Evas_Object * clip)
-{
- MSG_SLIDER_HIGH("Slider Clip set : Clipper=0x%08x");
- ivug_ret_if(!obj);
- struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
-
- int i = 0;
- for (i = 0; i < MAX_SLIDE; i++)
- { //set resize
- ivug_slider_item_clip_set(sd->slide[i], clip);
- }
-
- evas_object_clip_set(sd->event_obj, clip);
-}
-
-static void
-_ivug_slider_smart_clip_unset(Evas_Object *obj)
-{
- MSG_SLIDER_HIGH("Slider Clip unset");
-
- ivug_ret_if(!obj);
- struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
-
- int i = 0;
- for (i = 0; i < MAX_SLIDE; i++)
- { //set resize
- ivug_slider_item_clip_unset(sd->slide[i]);
- }
-
- evas_object_clip_unset(sd->event_obj);
-}
-
-/******* slide UI function *******/
-
-void
-_ivug_slider_slide_update_pos(struct Smart_Data *sd, Evas_Coord x, Evas_Coord y)
-{
- IV_ASSERT(sd != NULL);
-
-// TODO : If size is smaller than screen's, image should be put in middle
- ivug_slider_item_move(sd->slide[CENTER_SLIDE], x, y);
-
-// TODO : so as to increas perf, dont draw slide under certain condition
- ivug_slider_item_move(sd->slide[PREV_SLIDE], x - sd->slide[PREV_SLIDE]->w - IMAGE_BETWEEN_MARGIN , y);
-
- ivug_slider_item_move(sd->slide[NEXT_SLIDE], x + sd->slide[CENTER_SLIDE]->w + IMAGE_BETWEEN_MARGIN , y);
-}
-
-
- void
-_ivug_slider_slide_update(struct Smart_Data *sd, int x, int y)
- {
- IV_ASSERT(sd != NULL);
-
- sd->t_base = ecore_loop_time_get();
- set_animation(sd->anim, x, y, ANI_TIME_FLICK);
-
- if (sd->animator == NULL)
- {
-// In elm_config_scroll_zoom_friction_get() returns 0.5. this means 500ms.
- if(sd->animator)
- {
- ecore_animator_del(sd->animator);
- sd->animator = NULL;
- }
-
- sd->animator = ecore_animator_add(_ivug_slider_on_animation, sd);
-
- return;
- }
-
- MSG_SLIDER_WARN("Updata animation is alreay exists.");
-}
-
-
-void
-_ivug_slider_slide_update_shift_right(struct Smart_Data *sd)
-{
- ivug_ret_if(!sd);
-
- Slide_Item* PrevSlide = NULL;
-
- MSG_SLIDER_HIGH( "Slide shited. <-----");
-
- Media_Item *item = ivug_data_get_next(sd->slide[NEXT_SLIDE]->mitem); //get interator
-
- PrevSlide = sd->slide[PREV_SLIDE];
- ivug_slider_item_data_unset(PrevSlide);
-
- //set init
- sd->slide[PREV_SLIDE] = sd->slide[CENTER_SLIDE];
- sd->slide[CENTER_SLIDE] = sd->slide[NEXT_SLIDE];
- sd->slide[NEXT_SLIDE] = PrevSlide;
-
- if ( item != NULL )
- {
- ivug_slider_item_data_set(sd->slide[NEXT_SLIDE], item); //set iterator
-#ifdef DEFFERED_LOADING
- if ( sd->load_idler == NULL )
- {
- sd->load_idler = ecore_idler_add(_idler_loading_func, sd);
- }
-#else
- ivug_slider_item_data_loading(sd->slide[NEXT_SLIDE]); //set data.
-#endif
- }
-
- if(sd->ss_state == SLIDE_SHOW_RUNNING )
- {
- MSG_SLIDER_HIGH("Slide show.. Update position. XY(%d,%d)", sd->x , sd->y);
- _ivug_slider_slide_update_pos(sd, sd->x , sd->y); //update
-
- ivug_slider_item_show(sd->slide[CENTER_SLIDE]);
- ivug_slider_item_show(sd->slide[NEXT_SLIDE]);
- ivug_slider_item_show(sd->slide[PREV_SLIDE]);
- }
- else
- {
- _ivug_slider_slide_update_pos(sd, sd->slide[CENTER_SLIDE]->x , sd->slide[CENTER_SLIDE]->y); //update
- }
-
- if(sd->ss_state != SLIDE_SHOW_RUNNING)
- {
- sd->cur_list_idx++;
- }
- else /* (sd->ss_state == SLIDE_SHOW_RUNNING) */
- {
- int ret = 0;
- sd->cur_list_idx = sd->next_list_idx;
- ret = ivug_data_get_next_slide_show_index(sd->media_list, sd->ss_mode, sd->next_list_idx, sd->list_total_count, true);
- if(ret > 0)
- {
- sd->next_list_idx = ret;
- }
- }
- //call callback function.
-
- MSG_SLIDER_HIGH( ">>>cur index %d, total count %d, list_count %d <<<",
- sd->cur_list_idx, sd->list_total_count, eina_list_count(ivug_data_get_first(sd->media_list)));
-
-
- ivug_slider_item_zoom_reset(sd->slide[PREV_SLIDE], EINA_FALSE, 0,0);
-
- evas_object_smart_callback_call(sd->obj, "slider,item,changed", sd->slide[CENTER_SLIDE]);
-
- if(sd->idler_list == NULL)
- {
- sd->idler_list = ecore_idler_add(_ivug_slider_set_window_loading_idler, (void *)sd);
- }
-}
-
-
-void
-_ivug_slider_slide_update_shift_left(struct Smart_Data *sd)
-{
- ivug_ret_if(!sd);
-
- Slide_Item* NextSlide = NULL;
-
- MSG_SLIDER_HIGH( "Slide shited. ----->");
-
- Media_Item *item = ivug_data_get_prev(sd->slide[PREV_SLIDE]->mitem); //get interator
-
- NextSlide = sd->slide[NEXT_SLIDE];
- ivug_slider_item_data_unset(NextSlide);
-
- sd->slide[NEXT_SLIDE] = sd->slide[CENTER_SLIDE];
- sd->slide[CENTER_SLIDE] = sd->slide[PREV_SLIDE];
- sd->slide[PREV_SLIDE] = NextSlide;
-
- if ( item != NULL )
- {
- ivug_slider_item_data_set(sd->slide[PREV_SLIDE], item); //set data.
-#ifdef DEFFERED_LOADING
- if ( sd->load_idler == NULL )
- {
- sd->load_idler = ecore_idler_add(_idler_loading_func, sd);
- }
-#else
- ivug_slider_item_data_loading(sd->slide[PREV_SLIDE]); //set data.
-#endif
- }
-
- _ivug_slider_slide_update_pos(sd, sd->slide[CENTER_SLIDE]->x , sd->slide[CENTER_SLIDE]->y); //update
-
- sd->cur_list_idx--;
- //call callback function.
-
- ivug_slider_item_zoom_reset(sd->slide[NEXT_SLIDE], EINA_FALSE, 0,0);
-
- evas_object_smart_callback_call(sd->obj, "slider,item,changed", sd->slide[CENTER_SLIDE]);
-
- if(sd->idler_list == NULL)
- {
- sd->idler_list = ecore_idler_add(_ivug_slider_set_window_loading_idler, (void *)sd);
- }
-
-
-}
-
- void
-_ivug_slider_slide_update_shift(struct Smart_Data *sd)
-{
- ivug_ret_if(!sd);
-
- shift_direction_t shift_direction = SLIDE_SHIFT_NONE;
-
- if ( sd->slide[CENTER_SLIDE]->x + sd->slide[CENTER_SLIDE]->w < 0 )
- {
- shift_direction = SLIDE_SHIFT_TO_RIGHT;
- if ( sd->slide[NEXT_SLIDE]->mitem == NULL ) // most right position.
- {
- MSG_SLIDER_HIGH("Most right position");
-
- _ivug_slider_slide_update(sd, sd->slide[CENTER_SLIDE]->x , 0);
-
- return;
- }
- }
- else if ( sd->slide[CENTER_SLIDE]->x > sd->w )
- {
- shift_direction = SLIDE_SHIFT_TO_LEFT;
-
- if ( sd->slide[PREV_SLIDE]->mitem == NULL ) // most right position.
- {
- MSG_SLIDER_HIGH("Most left position");
-
- _ivug_slider_slide_update(sd, sd->slide[CENTER_SLIDE]->x , 0);
-
- return;
- }
- }
-
- if ( shift_direction == SLIDE_SHIFT_TO_RIGHT) // <--------------
- {
- _ivug_slider_slide_update_shift_right(sd);
- }
- else if (shift_direction == SLIDE_SHIFT_TO_LEFT) // -------------->
- {
- _ivug_slider_slide_update_shift_left(sd);
- }
-
-}
-
-static Eina_Bool
-_ivug_slider_on_animation(void *data)
-{
- ivug_retv_if(!data, ECORE_CALLBACK_CANCEL);
- struct Smart_Data* sd = (struct Smart_Data*) data;
-
- int value = 0;
-
- if ( update_animation(sd->anim, ecore_loop_time_get() - sd->t_base, &value) == false ) // If last frame
- {
- if(sd->animator)
- {
- ecore_animator_del(sd->animator);
- sd->animator = NULL;
- }
-
- MSG_SLIDER_HIGH("Last ani frame : X pos(%d,%d,%d)",
- sd->slide[PREV_SLIDE]->x, sd->slide[CENTER_SLIDE]->x, sd->slide[NEXT_SLIDE]->x);
-
- _ivug_slider_slide_update_pos(sd, value , sd->y); //update
-
- _ivug_slider_slide_update_shift(sd);
-
-// Update edge state
- sd->edge = _ivug_slider_edge_state_get(sd->slide[CENTER_SLIDE]);
-
- return ECORE_CALLBACK_CANCEL;
- }
-
- _ivug_slider_slide_update_pos(sd, value, sd->y);
-
- return ECORE_CALLBACK_RENEW;
-
-
- }
-
-
-Evas_Object*
-ivug_slider_add(Evas_Object* parent)
-{
- Evas_Object *obj = NULL;
- _ivug_slider_smart_init(); //init smart object for ivug slider
-
- PERF_CHECK_BEGIN(LVL3 "evas_object_smart_add");
-
- obj = evas_object_smart_add(evas_object_evas_get(parent), _smart_); //create smart object.
- ivug_retv_if(!obj, NULL);
-
-
- PERF_CHECK_END(LVL3 "evas_object_smart_add");
-
- MSG_SLIDER_HIGH("Slider Added Obj(0x%08x) Evas(0x%08x) Parent(0x%08x)", obj, evas_object_evas_get(parent), parent);
-
- return obj;
-}
-
-
-int
-ivug_slider_get_total_slide_count(Evas_Object* obj)
-{
- ivug_retv_if(!obj, -1); // TODO
- struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
- ivug_retv_if(!sd, -1);
-
- if(sd->list_total_count <= 0) //sd->media_list->left_end == -1 ||
- {
- sd->list_total_count = eina_list_count(ivug_data_get_first(sd->media_list));
- }
- return sd->list_total_count;
-
-}
-
-int
-ivug_slider_get_current_slide_count(Evas_Object* obj)
-{
- ivug_retv_if(!obj, -1); // TODO
- struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
- ivug_retv_if(!sd, -1);
-
- return sd->cur_list_idx;
-}
-
-Slide_Item *
-ivug_slider_get_current_slide_item(Evas_Object* obj)
-{
- ivug_retv_if(!obj, NULL);
- struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
- ivug_retv_if(!sd, NULL);
-
- return sd->slide[CENTER_SLIDE];
-}
-
-
-void
-ivug_slider_delete_current_slide(Evas_Object* obj)
-{
- ivug_ret_if(!obj);
- struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
- IVUG_FUNC_ENTER();
-
- if (sd == NULL)
- {
- MSG_SLIDER_ERROR("Slide data is NULL");
- return;
- }
-
- shift_direction_t direction = SLIDE_SHIFT_NONE;
- if (sd->slide[NEXT_SLIDE]->state != SLIDE_STATE_NONE)
- {
- MSG_SLIDER_HIGH("right slide state = %d ", sd->slide[NEXT_SLIDE]->state);
- direction = SLIDE_SHIFT_TO_RIGHT;
- }
- else if (sd->slide[PREV_SLIDE]->state != SLIDE_STATE_NONE)
- {
- MSG_SLIDER_HIGH("left slide state = %d ", sd->slide[PREV_SLIDE]->state);
- direction = SLIDE_SHIFT_TO_LEFT;
- }
-
- MSG_SLIDER_HIGH("shift direction = %d ", direction);
-
- ivug_data_delete_media_item( sd->media_list , sd->slide[CENTER_SLIDE]->mitem ); //delete data.
- sd->slide[CENTER_SLIDE]->mitem = NULL;
-
- ivug_slider_item_data_unset(sd->slide[CENTER_SLIDE]);
-
- Media_Item* item = NULL;
-
- //move slide.
- if ( direction == SLIDE_SHIFT_TO_RIGHT )
- {
- Slide_Item *tmp = sd->slide[CENTER_SLIDE];
-
- item = ivug_data_get_next(sd->slide[NEXT_SLIDE]->mitem); //get next data.
-
- sd->slide[CENTER_SLIDE] = sd->slide[NEXT_SLIDE];
- sd->slide[NEXT_SLIDE] = tmp;
-
- if(item != NULL)
- {
- ivug_slider_item_data_set(sd->slide[NEXT_SLIDE], item);
- ivug_slider_item_data_loading(sd->slide[NEXT_SLIDE]);
- }
- }
- else if ( direction == SLIDE_SHIFT_TO_LEFT) // ----------->
- {
- Slide_Item *tmp = sd->slide[CENTER_SLIDE];
-
- item = ivug_data_get_prev(sd->slide[PREV_SLIDE]->mitem); //get next data.
-
- sd->slide[CENTER_SLIDE] = sd->slide[PREV_SLIDE];
- sd->slide[PREV_SLIDE] = tmp;
-
- sd->cur_list_idx--;
-
- if(item != NULL)
- {
- ivug_slider_item_data_set(sd->slide[PREV_SLIDE], item);
- ivug_slider_item_data_loading(sd->slide[PREV_SLIDE]);
- }
- }
- else // Shift none
- {
- }
-
- _ivug_slider_slide_update_pos(sd, 0 , 0); //update
-
- Media_Data *sdata = NULL;
-
- if ( sd->slide[CENTER_SLIDE]->mitem != NULL )
- {
- sdata = ivug_data_get_data(sd->slide[CENTER_SLIDE]->mitem);
- }
-
- sd->list_total_count--;
-
- evas_object_smart_callback_call(sd->obj, "slider,item,deleted", sd->slide[CENTER_SLIDE]);
-
- if(sd->idler_list == NULL)
- {
- sd->idler_list = ecore_idler_add(_ivug_slider_set_window_loading_idler, (void *)sd);
- }
-
- IVUG_FUNC_LEAVE();
-}
-
-Eina_Bool
-ivug_slider_set_slide_list(Evas_Object* obj, Media_List *mList, Eina_List *new_list, Media_Item *current, int index, int total_count)
-
-{
- IV_ASSERT(obj != NULL);
- struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
-
- ivug_retv_if(!sd, EINA_FALSE); //check smart data.
-
- sd->media_list = mList;
- sd->cur_list_idx = index;
- sd->current = current;
- sd->list_total_count = total_count;
-
- //set init
- PERF_CHECK_BEGIN(LVL4 "unset prev&next");
-
- ivug_slider_item_data_unset(sd->slide[PREV_SLIDE]);
- ivug_slider_item_data_unset(sd->slide[NEXT_SLIDE]);
-
- PERF_CHECK_END(LVL4 "unset prev&next");
-
- if(new_list != NULL)
- {
- ivug_slider_item_change_mitem_pointer(sd->slide[CENTER_SLIDE], current);
-
- ivug_data_delete_all_window_list(sd->media_list); // clear window list
- ivug_data_append_media_item(sd->media_list, new_list);
- }
- else
- {
- PERF_CHECK_BEGIN(LVL4 "set center");
-
- ivug_slider_item_data_unset( sd->slide[CENTER_SLIDE]);
- ivug_slider_item_data_set(sd->slide[CENTER_SLIDE], current);
-
- ivug_slider_item_data_loading(sd->slide[CENTER_SLIDE]);
-
- PERF_CHECK_END(LVL4 "set center");
- }
-
- Media_Item *item = ivug_data_get_next(current);
- if(item != NULL)
- {
- PERF_CHECK_BEGIN(LVL4 "set next");
-
- ivug_slider_item_data_set(sd->slide[NEXT_SLIDE], item);
-
-#ifdef DEFFERED_LOADING
- if ( sd->load_idler == NULL )
- {
- sd->load_idler = ecore_idler_add(_idler_loading_func, sd);
- }
-#else
- ivug_slider_item_data_loading(sd->slide[NEXT_SLIDE]); //set data.
-#endif
-
-
- PERF_CHECK_END(LVL4 "set next");
- }
- item = ivug_data_get_prev(current);
- if(item != NULL)
- {
- PERF_CHECK_BEGIN(LVL4 "set prev");
-
- ivug_slider_item_data_set(sd->slide[PREV_SLIDE], item);
-
-#ifdef DEFFERED_LOADING
- if ( sd->load_idler == NULL )
- {
- sd->load_idler = ecore_idler_add(_idler_loading_func, sd);
- }
-#else
- ivug_slider_item_data_loading(sd->slide[PREV_SLIDE]); //set data.
-#endif
-
-
- PERF_CHECK_END(LVL4 "set prev");
- }
-
- PERF_CHECK_BEGIN(LVL4 "slider,item,changed");
-
- evas_object_smart_callback_call(sd->obj, "slider,item,changed", sd->slide[CENTER_SLIDE]);
-
- PERF_CHECK_END(LVL4 "slider,item,changed");
-
- return EINA_TRUE;
-}//ivug slider set list
-
-Media_Data *
-ivug_slider_create_media_list(Evas_Object* obj, ivug_parameter* ivug_param)
-{
- // Data List
- int list_total_count = 0;
- int start_index = ivug_param->start_index;
- Media_Item *item = NULL;
- Media_List *mList = ivug_data_init_media_list(ivug_param);
- Media_Data *mdata = NULL;
-
- if (mList == NULL)
- {
- MSG_SLIDER_ERROR("media list is NULL");
- return NULL;
- }
-
- PERF_CHECK_BEGIN(LVL3 "get media list");
- item = ivug_data_create_media_list_from_param
- (mList, NULL, ivug_param->filepath, &start_index, &list_total_count); //get list by file path.
- if(item == NULL)
- {
- MSG_SLIDER_ERROR("create media list failed");
- free(mList);
- return NULL;
- }
- PERF_CHECK_END(LVL3 "get media list");
-
- PERF_CHECK_BEGIN(LVL3 "set slide list");
-
- if (!ivug_slider_set_slide_list(obj, mList, NULL, item, start_index, list_total_count))
- {
- MSG_SLIDER_ERROR("slide list set Error");
- free(mList);
- return NULL;
- }
-
- PERF_CHECK_END(LVL3 "set slide list");
-
-// struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
-// if(sd->ss_mode & SLIDE_SHOW_MODE_SHUFFLE)
- {
- PERF_CHECK_BEGIN(LVL3 "make shuffled list");
-
- ivug_data_create_shuffled_list(mList, list_total_count);
-
- PERF_CHECK_END(LVL3 "make shuffled list");
- }
-
- mdata = ivug_data_get_data(item);
- return mdata;
-}
-
-
-char*
-ivug_slider_get_next_exist_filepath(Evas_Object* obj)
-{
- IVUG_FUNC_ENTER();
- ivug_retv_if(!obj, NULL);
- struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
- ivug_retv_if(!sd, NULL);
-
- char* file_path = NULL;
-
- Media_Item* next_item = ivug_data_get_next(sd->slide[CENTER_SLIDE]->mitem);
- Media_Data *sdata = NULL;
-
- while(next_item)
- {
- sdata = ivug_data_get_data(next_item);
-
- if(sdata != NULL) // TODO : Should review
- {
- MSG_SLIDER_HIGH("sl_data%s", sdata->filepath);
-
- if(sdata->filepath && ecore_file_exists(sdata->filepath))
- {
- MSG_SLIDER_HIGH("exist filepath %s", sdata->filepath);
- file_path = sdata->filepath;
- break;
- }
- }
-
- next_item = ivug_data_get_next(next_item);
- }
-
- //All files from current are deleted, search from beginning
- if(!file_path)
- {
- next_item = ivug_data_get_first(sd->media_list);
- while(next_item && next_item != ivug_data_get_next(sd->slide[CENTER_SLIDE]->mitem))
- {
- sdata = ivug_data_get_data(next_item);
-
- if(sdata != NULL) // TODO : Should review
- {
- MSG_SLIDER_HIGH("sl_data%s", sdata->filepath);
-
- if(sdata->filepath && ecore_file_exists(sdata->filepath))
- {
- MSG_SLIDER_HIGH("exist filepath %s", sdata->filepath);
- file_path = sdata->filepath;
- break;
- }
- }
-
- next_item = ivug_data_get_next(next_item);
- }
- }
-
- IVUG_FUNC_LEAVE();
-
- return file_path;
-}
-
-