Fix B/S when scrolling in window SDK
authorHyunwoo Kim <hw4444.kim@samsung.com>
Wed, 31 Oct 2012 11:32:35 +0000 (20:32 +0900)
committerHyunwoo Kim <hw4444.kim@samsung.com>
Wed, 31 Oct 2012 11:32:35 +0000 (20:32 +0900)
Change-Id: I004307956e5e6a1f783a1f41cce047512990bc24

main/src/include/ivug-slider.h
main/src/slider/ivug-slider-item.cpp
main/src/slider/ivug-slider-mouse.cpp
main/src/slider/ivug-slider.cpp

index 26d33dd..47fc058 100755 (executable)
@@ -1,18 +1,18 @@
-/*\r
- * Copyright 2012  Samsung Electronics Co., Ltd\r
- *\r
- * Licensed under the Flora License, Version 1.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *       http://www.tizenopensource.org/license\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
+/*
+ * 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.
+ */
 
 #ifndef __IVUG_SLIDER_H__
 #define __IVUG_SLIDER_H__
@@ -35,6 +35,11 @@ typedef enum {
 // Error state
        SLIDE_STATE_NO_RIGHT,
        SLIDE_STATE_ERROR,
+/*
+       CAUTION.
+
+       If you change enumeration, plz modify function - const char *_GetStateString(slide_state_t state), too.
+*/
 } slide_state_t;
 
 
@@ -121,10 +126,10 @@ void
 ivug_slider_zoom_in(Evas_Object *obj);
 
 void
-ivug_slider_zoom_out(Evas_Object *obj);\r
-\r
-void\r
-ivug_slider_update(Evas_Object *obj, Media_Item *newItem);\r
+ivug_slider_zoom_out(Evas_Object *obj);
+
+void
+ivug_slider_update(Evas_Object *obj, Media_Item *newItem);
 
 #ifdef __cplusplus
 }
index 4dc7121..1d9b9e4 100755 (executable)
@@ -1,18 +1,18 @@
-/*\r
- * Copyright 2012  Samsung Electronics Co., Ltd\r
- *\r
- * Licensed under the Flora License, Version 1.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *       http://www.tizenopensource.org/license\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
+/*
+ * 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"
 
@@ -129,23 +129,23 @@ static void _hide_videoicon(Slide_Item *si)
 
 static bool _start_drm_consume(Slide_Item *si)
 {
-       return true;\r
+       return true;
 }
 
 static bool _stop_drm_consume(Slide_Item *si)
 {
-       return true;\r
+       return true;
 }
 
 static bool _pause_drm_consume(Slide_Item *si)
 {
-       return true;\r
+       return true;
 }
 
 static bool _resume_drm_consume(Slide_Item *si)
-{\r
-       return true;\r
-}\r
+{
+       return true;
+}
 
 
 static sitem_type_t _get_sitem_type(Media_Type mtype)
@@ -185,9 +185,9 @@ static void
 _photocam_loaded_cb(void *data, Evas_Object *obj, void *event_info)
 {
        IV_ASSERT(data != NULL);
-
        Slide_Item* si = static_cast<Slide_Item*>(data);
 
+       MSG_SITEM_HIGH("_photocam_loaded_cb");
 //hide progress.
        _hide_progressbar(si);
 
@@ -205,6 +205,12 @@ _photocam_loaded_cb(void *data, Evas_Object *obj, void *event_info)
                return;
        }
 
+       if ( si->state != SLIDE_STATE_LOADING )
+       {
+               MSG_SITEM_ERROR("Invalid slide state. %s", ivug_get_filename(mdata->filepath));
+               MSG_SITEM_FATAL("state=%d %s (%d,%d,%d,%d)", si->state, mdata->filepath, si->x, si->y, si->w, si->h);
+       }
+
 #if 0
        typedef enum _Evas_Load_Error
        {
@@ -279,10 +285,10 @@ static bool _set_mitem(Slide_Item* si, Media_Item *item)
 
        si->type = _get_sitem_type(mdata->slide_type);
 
-       evas_object_smart_callback_add(si->photocam, "loaded", _photocam_loaded_cb, si);
-
        if ( si->type == SITEM_TYPE_IMAGE )
        {
+               evas_object_smart_callback_add(si->photocam, "loaded", _photocam_loaded_cb, si);
+
                _hide_videoicon(si);
 
 #ifdef USE_IMAGE_THUMBNAIL
@@ -311,14 +317,14 @@ static bool _set_mitem(Slide_Item* si, Media_Item *item)
        switch(mdata->slide_type)
        {
                case SLIDE_TYPE_IMAGE:
-                       MSG_SITEM_HIGH("Set image. %s", ivug_get_filename(mdata->filepath));
-
-                       if(mdata->bIsDRMContent == EINA_FALSE)
+                       if(mdata->bIsDRMContent == false)
                        {
+                               MSG_SITEM_HIGH("Set image. %s", ivug_get_filename(mdata->filepath));
                                si->state = SLIDE_STATE_READY;
                        }
                        else
                        {
+                               MSG_SITEM_HIGH("Set DRM image. %s", ivug_get_filename(mdata->filepath));
                                si->state = SLIDE_STATE_DRM_CHECKING;
                        }
                break;
@@ -350,8 +356,8 @@ static bool _set_mitem(Slide_Item* si, Media_Item *item)
 
 
 static bool _unset_mitem(Slide_Item* si)
-{\r
-       si->state = SLIDE_STATE_NONE;\r
+{
+       si->state = SLIDE_STATE_NONE;
 
 // Unswallow photocam/videocam
        edje_object_part_unswallow(si->layout, edje_object_part_swallow_get(si->layout, "slider.contents"));
@@ -673,18 +679,18 @@ ivug_slider_item_load(Slide_Item *si)
 
        if ( mdata->bIsDRMContent == EINA_TRUE )
        {
-               _hide_progressbar(si);\r
-
-               MSG_SITEM_ERROR("Image loading failed. RO expired File=%s", mdata->filepath);\r
-               si->state = SLIDE_STATE_ERROR;\r
-\r
-               evas_object_hide(si->photocam);\r
-               _show_thumbnail(si, DRM_NO_RIGHT_IMAGE_PATH);\r
-\r
-               _call_user_callback(si);\r
-\r
-               return false;\r
-       }\r
+               _hide_progressbar(si);
+
+               MSG_SITEM_ERROR("Image loading failed. RO expired File=%s", mdata->filepath);
+               si->state = SLIDE_STATE_ERROR;
+
+               evas_object_hide(si->photocam);
+               _show_thumbnail(si, DRM_NO_RIGHT_IMAGE_PATH);
+
+               _call_user_callback(si);
+
+               return false;
+       }
        else
        {
                strncpy(path, mdata->filepath, sizeof(path));
index 78f9f04..3018523 100755 (executable)
@@ -1,18 +1,18 @@
-/*\r
- * Copyright 2012  Samsung Electronics Co., Ltd\r
- *\r
- * Licensed under the Flora License, Version 1.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *       http://www.tizenopensource.org/license\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
+/*
+ * 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-slider-item.h"
@@ -365,7 +365,7 @@ Evas_Event_Flags _momentum_move(void *data, void *event_info)
 
        if ( sd->edge == EDGE::SLIDE_FIT)
        {
-               MSG_HIGH("Case 1. edge=%d, X=%d dx=%d si->x=%d", sd->edge, dst_x, dx, si->x);
+               MSG_HIGH("Case 1. edge=%d, X=%d dx=%d si->x=%d state=%d", sd->edge, dst_x, dx, si->x, sd->slide[PREV_SLIDE]->state);
                _ivug_slider_pass_event_to_item(sd, EINA_FALSE);
 
                if ( dst_x >= 0 && sd->slide[PREV_SLIDE]->state == SLIDE_STATE_NONE)
index a49ce8a..cce0bdf 100755 (executable)
@@ -1,18 +1,18 @@
-/*\r
- * Copyright 2012  Samsung Electronics Co., Ltd\r
- *\r
- * Licensed under the Flora License, Version 1.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *       http://www.tizenopensource.org/license\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
+/*
+ * 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
 
@@ -123,8 +123,8 @@ static void _do_load(struct Smart_Data *sd)
                sd->load_idler = NULL;
        }
 
-       MSG_SLIDER_HIGH("Add idler for loading.");\r
-       sd->load_idler = ecore_idler_add(_idler_loading_func, sd);\r
+       MSG_SLIDER_HIGH("Add idler for loading.");
+       sd->load_idler = ecore_idler_add(_idler_loading_func, sd);
 }
 
 static void _ivug_slider_on_center_changed(Evas_Object *obj, Slide_Item *old, Slide_Item *cur)
@@ -149,7 +149,13 @@ static void _ivug_slider_on_center_changed(Evas_Object *obj, Slide_Item *old, Sl
                MSG_SLIDER_ERROR("Invalid state : %s", _GetStateString(cur->state));
        }
 
-       MSG_SLIDER_HIGH("Center item changed. State=%s", _GetStateString(cur->state));
+       Media_Item *mitem = NULL;
+
+       mitem = cur->mitem;
+
+       Media_Data *pData = ivug_medialist_get_data(mitem);
+
+       MSG_SLIDER_HIGH("Center item changed. %s State=%s", ivug_get_filename(pData->filepath), _GetStateString(cur->state));
 
        evas_object_smart_callback_call(sd->obj, "slider,item,changed", cur);
 }
@@ -1198,26 +1204,26 @@ ivug_slider_zoom_out(Evas_Object *obj)
 
        sd->zoom_level--;
 }
-\r
-void\r
-ivug_slider_update(Evas_Object *obj, Media_Item *newItem)\r
-{\r
-       if (obj == NULL) {\r
-               MSG_SLIDER_HIGH("Slider is NULL");\r
-               return;\r
-       }\r
-       struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);\r
-\r
-       MSG_SLIDER_HIGH("Slider update");\r
-\r
-       Slide_Item *si = sd->slide[CENTER_SLIDE];\r
-\r
-       ivug_slider_item_zoom_reset(si, EINA_FALSE, 0, 0);\r
-\r
-       ivug_slider_item_stop(si);\r
-\r
-       ivug_slider_item_data_set(si, newItem);\r
-\r
-       _do_load(sd);\r
-}\r
-\r
+
+void
+ivug_slider_update(Evas_Object *obj, Media_Item *newItem)
+{
+       if (obj == NULL) {
+               MSG_SLIDER_HIGH("Slider is NULL");
+               return;
+       }
+       struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
+
+       MSG_SLIDER_HIGH("Slider update");
+
+       Slide_Item *si = sd->slide[CENTER_SLIDE];
+
+       ivug_slider_item_zoom_reset(si, EINA_FALSE, 0, 0);
+
+       ivug_slider_item_stop(si);
+
+       ivug_slider_item_data_set(si, newItem);
+
+       _do_load(sd);
+}
+