summaryrefslogtreecommitdiff
path: root/main/src/view/ivug-slider-slideshow.c
diff options
context:
space:
mode:
authorJisung Ahn <jcastle.ahn@samsung.com>2012-08-21 12:33:06 (GMT)
committerJisung Ahn <jcastle.ahn@samsung.com>2012-08-21 12:48:17 (GMT)
commita914248a31229bb81ed4ede970ca23e2490e0387 (patch)
tree8e3d763e83861131c778b442b3333496be1b23b7 /main/src/view/ivug-slider-slideshow.c
parent8b42d4bb33943903b7160bb963bf7e7c6824e9ef (diff)
downloadug-image-viewer-efl-a914248a31229bb81ed4ede970ca23e2490e0387.zip
ug-image-viewer-efl-a914248a31229bb81ed4ede970ca23e2490e0387.tar.gz
ug-image-viewer-efl-a914248a31229bb81ed4ede970ca23e2490e0387.tar.bz2
initial upload
Change-Id: Ie9df15e2a3ce6a47e65f48aa0cfb43c2622b74d7
Diffstat (limited to 'main/src/view/ivug-slider-slideshow.c')
-rwxr-xr-xmain/src/view/ivug-slider-slideshow.c334
1 files changed, 0 insertions, 334 deletions
diff --git a/main/src/view/ivug-slider-slideshow.c b/main/src/view/ivug-slider-slideshow.c
deleted file mode 100755
index 3e2e7bb..0000000
--- a/main/src/view/ivug-slider-slideshow.c
+++ /dev/null
@@ -1,334 +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 "ivug-common.h"
-#include "ivug-main.h"
-
-#include "ivug-slider.h"
-#include "ivug-mouse-event.h"
-#include "ivug-slider-item.h"
-#include "ivug-anim.h"
-#include "ivug-effect.h"
-#include "ivug-slider-priv.h"
-#include "ivug-data.h"
-#include "ivug-data-shuffle.h"
-
-
-static const char *_get_ss_state(slideshow_state_t state)
-{
- const char *szMsg[] = {"Stopped", "Running", "Paused" };
-
- return szMsg[state];
-}
-
-
-void _ivug_slider_effect_finished(void *data)
-{
- struct Smart_Data* sd = (struct Smart_Data*) data;
- ivug_ret_if(!sd);
-
- MSG_SLIDER_HIGH("Slide Effect ended");
-
- if(sd->effect_engine)
- {
- ivug_effect_finalize(sd->effect_engine);
- sd->effect_engine = NULL;
- }
-
- if (sd->slide[NEXT_SLIDE]->mitem && sd->bSS_SlideFlag == EINA_FALSE)
- {
- _ivug_slider_slide_update_shift_right(sd);
- }
-
- // Update edge state
- sd->edge = _ivug_slider_edge_state_get(sd->slide[CENTER_SLIDE]);
-
- if(sd->bSS_StopFlag == EINA_TRUE)
- {
- sd->ss_state = SLIDE_SHOW_STOPPED;
- MSG_SLIDER_HIGH("effect_engine is finished");
- evas_object_smart_callback_call(sd->obj, "slider,slideshow,interrupted", (void *)sd->slide[CENTER_SLIDE]);
- ivug_slider_restore_window_list(sd->obj);
- sd->bSS_StopFlag = EINA_FALSE;
- }
-}
-
-
-// Slide Show related functions.
-static Eina_Bool
-_ivug_slider_slide_show_cb(void *data)
-{
- IV_ASSERT(data != NULL);
-
- struct Smart_Data* sd = (struct Smart_Data*) data;
-
- if(sd->ss_state == SLIDE_SHOW_STOPPED) /* stopped by other operation */
- {
- sd->ss_timer = NULL;
- return ECORE_CALLBACK_CANCEL;
- }
-
- Media_Item *item = NULL;
-
- if(sd->ss_mode & SLIDE_SHOW_MODE_SHUFFLE)
- {
- item = ivug_data_get_next_shuffle_item(sd->media_list);
- }
- else // shuffle slideshow is off
- {
- item = ivug_data_get_next(sd->slide[CENTER_SLIDE]->mitem);
- }
-
- //calc slide show
- if ( item != NULL || (sd->ss_mode & SLIDE_SHOW_MODE_REPEAT)) /* repeat is endless */
- {
- MSG_SLIDER_HIGH("ivug_effect_add Effect=%d", sd->effect_type);
-
- Effect_Engine *eng = ivug_effect_add(sd->effect_type);
-
- if(eng == NULL)
- {
- MSG_SLIDER_ERROR("Cannot create effect NULL");
- return ECORE_CALLBACK_CANCEL;
- }
-
- sd->effect_engine = eng;
- ivug_effect_init(sd->effect_engine, sd->slide[CENTER_SLIDE]->layout, sd->slide[NEXT_SLIDE]->layout, sd->w, sd->h, 0);
-
- ivug_effect_start(sd->effect_engine, _ivug_slider_effect_finished, sd);
-
- return ECORE_CALLBACK_RENEW;
- }
- else
- {
- MSG_SLIDER_HIGH("Reached end of images. Stop slide show");
-
- sd->ss_timer = NULL;
- evas_object_smart_callback_call(sd->obj, "slider,slideshow,finished", (void *)sd->slide[CENTER_SLIDE]);
- return ECORE_CALLBACK_CANCEL;
- }
-
-}
-
-
-static Eina_Bool
-_ivug_slider_slide_finish_cb(void *data)
-{
- IV_ASSERT(data != NULL);
-
- struct Smart_Data* sd = (struct Smart_Data*) data;
-
- sd->ss_timer = NULL;
-
- evas_object_smart_callback_call(sd->obj, "slider,slideshow,finished", (void *)sd->slide[CENTER_SLIDE]);
-
- return ECORE_CALLBACK_CANCEL;
-}
-
-
-static Effect_Type
-ivug_slider_get_trans_effect(ivug_effect_type type)
-{
- MSG_SLIDER_MED("type %d", type);
-
- switch(type)
- {
- case IVUG_EFFECT_TYPE_SLIDE:
- return EFFECT_SLIDE;
- break;
-
- default:
- break;
- }
-
- return EFFECT_NONE;
-}
-
-
-void
-ivug_slider_start_slide_show(Evas_Object* obj, Eina_Bool bSlideFirst)
-{
- IV_ASSERT(obj != NULL);
-
- struct Smart_Data *sd = (struct Smart_Data *)evas_object_smart_data_get(obj);
- IV_ASSERT(sd != NULL);
-
- ivug_effect_type ivug_effect = IVUG_EFFECT_TYPE_SLIDE;
-
- ivug_config_get_slideshow_setting(&(sd->ss_mode), &(sd->ss_interval_time), &ivug_effect);
-
- MSG_SLIDER_HIGH("Start slide show. Interval=%f Effect=%d", sd->ss_interval_time, ivug_effect);
-
- if(sd->ss_interval_time < 0)
- {
- MSG_SLIDER_HIGH("slide show interval time is invalid !!!");
- ivug_slider_stop_slide_show(obj);
- return ;
- }
-
-// sd->ss_interval_time = 6.0f; // Test
-
- if ( sd->ss_state == SLIDE_SHOW_RUNNING )
- {
- MSG_SLIDER_WARN("Slide show is running. remove previous one.");
- ivug_slider_stop_slide_show(obj);
- }
-
- if ( sd->effect_engine != NULL )
- {
- MSG_SLIDER_FATAL("Debug Me!!!");
- return ;
- }
-
- sd->bSS_SlideFlag = EINA_FALSE;
- sd->bSS_StopFlag = EINA_FALSE;
-
- sd->effect_type = ivug_slider_get_trans_effect(ivug_effect);
-
- ivug_data_set_window_size(sd->media_list, IV_WINDOW_SIZE_FOR_SLIDE_SHOW);
-
- ///////////////////////////////////////////////////////
- if(sd->ss_mode & SLIDE_SHOW_MODE_SHUFFLE)
- {
- {
- ivug_data_init_shuffle_slide_show(sd->media_list, sd->ss_mode, sd->cur_list_idx, sd->list_total_count);
- }
- }
-
- ivug_slider_item_data_unset(sd->slide[NEXT_SLIDE]);
-// TODO : parameter of ivug_data_get_current_slide_show_item() is too complex!!!!
- Media_Item *item = ivug_data_get_current_slide_show_item(sd->media_list, sd->ss_mode, sd->cur_list_idx, &(sd->next_list_idx), sd->list_total_count);
-
- if(item == NULL)
- {
- MSG_SLIDER_ERROR("Item is NULL. CurIndex=%d", sd->cur_list_idx);
-
- ivug_data_set_window_size(sd->media_list, IV_WINDOW_SIZE);
- if(sd->ss_timer) {
- ecore_timer_del(sd->ss_timer);
- sd->ss_timer = NULL;
- }
- sd->ss_timer = ecore_timer_add(sd->ss_interval_time, _ivug_slider_slide_finish_cb, sd);
- return;
- }
-
- ivug_data_append_media_item(sd->media_list, item);
- ivug_slider_item_data_set(sd->slide[NEXT_SLIDE], item); //set iterator
- ivug_slider_item_data_loading(sd->slide[NEXT_SLIDE]);
-
- /* set sd->slide[NEXT_SLIDE] 's next item*/
- ivug_data_set_next_slide_show_item(sd->media_list, sd->ss_mode, &(sd->next_list_idx), sd->list_total_count);
-
- sd->ss_state = SLIDE_SHOW_RUNNING;
- if(bSlideFirst == EINA_TRUE)
- {
- if ( _ivug_slider_slide_show_cb(sd) == ECORE_CALLBACK_CANCEL )
- {
- MSG_SLIDER_WARN("Slide ended????");
- ivug_data_set_window_size(sd->media_list, IV_WINDOW_SIZE);
- return;
- }
- }
- if(sd->ss_timer) {
- ecore_timer_del(sd->ss_timer);
- sd->ss_timer = NULL;
- }
- sd->ss_timer = ecore_timer_add(sd->ss_interval_time, _ivug_slider_slide_show_cb, sd);
-
- MSG_SLIDER_HIGH("Slide show started!");
-
-// if it is last slide, need hide menu bar
-}
-
-void
-ivug_slider_pause_slide_show(Evas_Object* obj)
-{
- IV_ASSERT(obj != NULL);
-
- struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
- IV_ASSERT(sd != NULL);
-
- MSG_SLIDER_HIGH("Pause slide show. state=%s", _get_ss_state(sd->ss_state));
-
- if(sd->ss_timer)
- {
- ecore_timer_freeze(sd->ss_timer);
- }
-
- sd->ss_state = SLIDE_SHOW_PAUSE;
-}
-
-void
-ivug_slider_resume_slide_show(Evas_Object* obj)
-{
- IV_ASSERT(obj != NULL);
-
- struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
- IV_ASSERT(sd != NULL);
-
- MSG_SLIDER_HIGH("Resume slide show. state=%s", _get_ss_state(sd->ss_state));
-
- if(sd->ss_timer)
- {
- ecore_timer_thaw(sd->ss_timer);
- }
-
- sd->ss_state = SLIDE_SHOW_RUNNING; // TODO : Buggy
-}
-
-void
-ivug_slider_stop_slide_show(Evas_Object* obj)
-{
- IV_ASSERT(obj != NULL);
-
- struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
- IV_ASSERT(sd != NULL);
-
- if ( sd->ss_state != SLIDE_SHOW_RUNNING )
- {
- MSG_SLIDER_WARN("Stop slide show. but not run state. state=%s", _get_ss_state(sd->ss_state) );
- return;
- }
-
- MSG_SLIDER_HIGH("Stop slide show. XY(%d,%d)", sd->x, sd->y);
- sd->bSS_StopFlag = EINA_TRUE;
-
- //delete timmer
- if(sd->ss_timer) {
- ecore_timer_del(sd->ss_timer);
- sd->ss_timer = NULL;
- }
-
- if(sd->ss_mode & SLIDE_SHOW_MODE_SHUFFLE)
- {
- ivug_data_deinit_shuffle_slide_show(sd->media_list,
- sd->list_total_count);
- }
-
- ivug_data_set_window_size(sd->media_list, IV_WINDOW_SIZE);
-
- if(sd->effect_engine == NULL)
- {
- sd->ss_state = SLIDE_SHOW_STOPPED;
- MSG_SLIDER_HIGH("effect_engine is NULL");
- evas_object_smart_callback_call(sd->obj, "slider,slideshow,interrupted", (void *)sd->slide[CENTER_SLIDE]);
- ivug_slider_restore_window_list(sd->obj);
- sd->bSS_StopFlag = EINA_FALSE;
- }
-}
-
-