show cropped file at list
authorJisung Ahn <jcastle.ahn@samsung.com>
Tue, 22 Jan 2013 10:46:32 +0000 (19:46 +0900)
committerJisung Ahn <jcastle.ahn@samsung.com>
Tue, 22 Jan 2013 11:12:14 +0000 (20:12 +0900)
Change-Id: I1dde8c1454388bd4c0048be219a5a6d8ffb34612

12 files changed:
main/src/include/ivug-main-view.h
main/src/include/ivug-slider.h
main/src/slider/ivug-slider-priv.h
main/src/slider/ivug-slider.cpp
main/src/view/ivug-main-view-menu.cpp
main/src/view/ivug-main-view-priv.h [new file with mode: 0755]
main/src/view/ivug-main-view-toolbar.cpp
main/src/view/ivug-main-view.cpp
medialist/include/ivug-medialist.h
medialist/src/ivug-data-list.c
medialist/src/ivug-data-list.h
medialist/src/ivug-medialist.c

index ba9f3ae..39e845d 100755 (executable)
@@ -90,97 +90,7 @@ typedef struct {
 
 typedef struct _SlideShow SlideShow;
 
-typedef struct {
-       Evas_Object *parent;
-       Evas_Object *layout;            /*Layout widget based on EDJ*/
-
-       Evas_Object *navi_bar;
-       Evas_Object *empty_layout;
-       Elm_Object_Item *navi_it;
-       Evas_Object* slider;                    //image viewer slider
-
-       Evas_Object *back_btn;
-
-       Evas_Object *area_obj;          //lcd area except indicator
-
-       Evas_Object* selectioninfo;
-
-       Evas_Object *zoom_slider;
-       int zoom_level;
-
-/*
-   |------------------|
-   | navi_bar            |
-   |------------------|
-   | tool_bar            |
-   |------------------|
-   |                             |
-   |                             |
-   |                             |
-   |                             |
-   |------------------|
-   | ctrl_bar            |
-   |------------------|
-*/
-
-// Toolbar
-       Evas_Object *tool_bar;
-       ivug_toolbar tool_bar_type;
-
-// Controlbar
-       Evas_Object *ctrl_bar;
-       ivug_ctrlbar ctrl_bar_type;
-
-       Evas_Object *btn_more;
-       Evas_Object *btn_share;
-       Evas_Object *btn_download;
-
-
-       bool bSetThmByUser;
-
-       Evas_Object* popup;                     //popup
-       Evas_Object* ctx_popup;                 //context popup 1depth
-       Evas_Object* ctx_popup2;                //context popup 2depth
-
-       Evas_Object* longpress_popup;           //long press popup
-       bool bLongpressEnd;
-
-// child view.
-       Ivug_NameView *pNameView;
-       Ivug_SetAsView *pSetAsView;
-
-       Ivug_DetailsView *pDetailsView;
-       IvugCropView *pCropView;
-
-
-// List
-       Media_List *mList;
-
-//flag
-       bool bShowMenu;
-
-       ivug_mode mode;
-       ivug_view_by view_by;
-
-       ui_gadget_h ext_ug;
-
-       Ecore_Event_Handler *keydown_handler;
-
-       Ecore_Timer *exit_timer;
-       Ecore_Timer *hide_timer;
-       int hide_count;
-
-       Ecore_Timer *popup_timer;
-
-       char *album_name;
-
-// Slide show;
-       SlideShow *ssHandle;
-
-
-       bool bClickPrevent;
-
-} Ivug_MainView;
+typedef struct _Ivug_MainView Ivug_MainView;
 
 #undef FIX_LAST_BLINK
 
index cabc8a4..5d2167b 100755 (executable)
@@ -53,6 +53,12 @@ typedef enum {
        LONGTAP_CANCELED,
 } longtap_state;
 
+typedef enum {
+       CENTER_SLIDE,
+       NEXT_SLIDE,
+       PREV_SLIDE,
+       MAX_SLIDE,
+} slide_index_t;
 
 /*
        Slider signal list.
@@ -91,6 +97,9 @@ ivug_slider_set_medialist(Evas_Object* obj, Media_List *mList, Media_Item *curre
 void
 ivug_slider_set_item(Evas_Object* obj, Media_Item *item, slide_dir_t dir);
 
+void
+ivug_slider_set_item_to_slide(Evas_Object* obj, slide_index_t where, Media_Item *newItem);
+
 /*
        Delete current media item
 */
index 158a588..36b92f4 100755 (executable)
@@ -62,15 +62,6 @@ typedef enum {
        SLIDE_SHIFT_TO_LEFT,            // Mouse--------------------->
 } shift_direction_t;
 
-
-//ENUM
-typedef enum {
-       CENTER_SLIDE,
-       NEXT_SLIDE,
-       PREV_SLIDE,
-       MAX_SLIDE,
-} slide_index_t;
-
 class ECoreAnimator;
 class CAnimator;
 
index 2364fb5..f342335 100755 (executable)
@@ -1081,6 +1081,30 @@ ivug_slider_set_item(Evas_Object* obj, Media_Item *newItem, slide_dir_t dir)
                        _ivug_slider_on_center_changed(sd->obj, sd->slide[NEXT_SLIDE] , sd->slide[CENTER_SLIDE]);
                        break;
        }
+
+}
+
+void
+ivug_slider_set_item_to_slide(Evas_Object* obj, slide_index_t where, Media_Item *newItem)
+{
+       IV_ASSERT(obj != NULL);
+       IV_ASSERT(newItem != NULL);
+
+       if(where >= MAX_SLIDE)
+       {
+               MSG_SLIDER_ERROR("where is invalid %d, where");
+               return;
+       }
+
+       struct Smart_Data *sd = (struct Smart_Data *) evas_object_smart_data_get(obj);
+
+       MSG_SLIDER_HIGH("ivug_slider_set_item_to_slide. where=%d", where);
+
+       Media_Item *mitem = NULL;
+
+       ivug_slider_item_data_set(sd->slide[where], newItem);
+
+       _do_load(sd);
 }
 
 
index 642ef5d..b2be400 100755 (executable)
@@ -18,6 +18,7 @@
 #include "ivug-main-view.h"
 #include "ivug-main-view-toolbar.h"
 #include "ivug-main-view-menu.h"
+#include "ivug-main-view-priv.h"
 
 #include "ivug-slider.h"
 #include "ivug-slider-item.h"
@@ -288,6 +289,8 @@ static void  _ivug_crop_view_destroyed_cb(void *data, Evas_Object *obj, void *ev
 
        elm_naviframe_item_title_visible_set(pMainView->navi_it, EINA_TRUE);
 
+       _update_title(pMainView);       // after crop index changed
+
        Evas_Object *conformant = (Evas_Object *)ug_get_conformant();
        elm_object_signal_emit(conformant, "elm,state,indicator,overlap", "");
 }
@@ -329,6 +332,18 @@ static void _ivug_crop_view_ok_clicked_cb(void *data, Evas_Object *obj, void *ev
        {
                ivug_db_destroy_file_handle(m_handle);
 }
+
+       Ivug_MainView *pMainView = (Ivug_MainView *)data;
+
+       Media_Item *mitem = ivug_medialist_prepend_item(pMainView->mList, path);
+
+       Media_Item *c_mitem = ivug_slider_get_item(pMainView->slider);
+       Media_Data *c_mdata = ivug_medialist_get_data(c_mitem);
+       if(c_mdata->index == 1) //left slide item added
+       {
+               MSG_MAIN_ERROR("add left slide item");
+               ivug_slider_set_item_to_slide(pMainView->slider, PREV_SLIDE, mitem);
+       }
 }
 
 static void _ivug_setas_view_ok_clicked_cb(void *data, Evas_Object *obj, void *event_info)
diff --git a/main/src/view/ivug-main-view-priv.h b/main/src/view/ivug-main-view-priv.h
new file mode 100755 (executable)
index 0000000..9f66860
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * 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_MAINVIEW_PRIV_H__
+#define __IVUG_MAINVIEW_PRIV_H__
+
+#include "ivug-define.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct _Ivug_MainView{
+       Evas_Object *parent;
+       Evas_Object *layout;            /*Layout widget based on EDJ*/
+
+       Evas_Object *navi_bar;
+       Evas_Object *empty_layout;
+       Elm_Object_Item *navi_it;
+       Evas_Object* slider;                    //image viewer slider
+
+       Evas_Object *back_btn;
+
+       Evas_Object *area_obj;          //lcd area except indicator
+
+       Evas_Object* selectioninfo;
+
+       Evas_Object *zoom_slider;
+       int zoom_level;
+
+/*
+   |------------------|
+   | navi_bar            |
+   |------------------|
+   | tool_bar            |
+   |------------------|
+   |                             |
+   |                             |
+   |                             |
+   |                             |
+   |------------------|
+   | ctrl_bar            |
+   |------------------|
+*/
+
+// Toolbar
+       Evas_Object *tool_bar;
+       ivug_toolbar tool_bar_type;
+
+// Controlbar
+       Evas_Object *ctrl_bar;
+       ivug_ctrlbar ctrl_bar_type;
+
+       Evas_Object *btn_more;
+       Evas_Object *btn_share;
+       Evas_Object *btn_download;
+
+       bool bSetThmByUser;
+
+       Evas_Object* popup;                     //popup
+       Evas_Object* ctx_popup;                 //context popup 1depth
+       Evas_Object* ctx_popup2;                //context popup 2depth
+
+       Evas_Object* longpress_popup;           //long press popup
+       bool bLongpressEnd;
+
+       Evas_Object *best_icon;
+
+// child view.
+       Ivug_NameView *pNameView;
+       Ivug_SetAsView *pSetAsView;
+
+       Ivug_DetailsView *pDetailsView;
+       IvugCropView *pCropView;
+
+// List
+       Media_List *mList;
+
+//flag
+       bool bShowMenu;
+
+       ivug_mode mode;
+       ivug_view_by view_by;
+
+       ui_gadget_h ext_ug;
+
+       Ecore_Event_Handler *keydown_handler;
+
+       Ecore_Timer *exit_timer;
+       Ecore_Timer *hide_timer;
+       int hide_count;
+
+       Ecore_Timer *popup_timer;
+
+       char *album_name;
+
+// Slide show;
+       SlideShow *ssHandle;
+
+       bool bClickPrevent;
+       bool bStandAlone;       //if true, it is process not ug
+};
+
+void _update_title(struct _Ivug_MainView *pMainView);
+
+bool ivug_is_agif(const char *filepath);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif                 // __IVUG_MAINVIEW_PRIV_H__
+
index e822510..b5b0a95 100755 (executable)
@@ -17,6 +17,7 @@
 #include "ivug-common.h"
 #include "ivug-main-view.h"
 #include "ivug-main-view-menu.h"
+#include "ivug-main-view-priv.h"
 
 #include "ivug-slider.h"
 
index 63a5e5a..853942d 100755 (executable)
@@ -56,7 +56,7 @@
 
 #include "ivug-image.h"
 
-
+#include "ivug-main-view-priv.h"
 
 #undef HIDE_INDICATOR          // For testing.
 #define TEST_MOUSE_EVENT
@@ -73,7 +73,7 @@
 static bool _destory_slideshow_and_ug(Ivug_MainView *pMainView, int state, bool bMmc_out);
 static void _on_slideshow_finished(void *data, Evas_Object *obj, void *event_info);
 
-static void _update_title(Ivug_MainView *pMainView)
+void _update_title(Ivug_MainView *pMainView)
 {
 #define MAX_TITLE_LEN  256
 
index 25bee99..566a6c3 100755 (executable)
@@ -72,7 +72,8 @@ Media_Item *ivug_medialist_get_shuffle_item(Media_List *mList, Media_Item *item)
 Media_Item *ivug_medialist_find_item_by_index(Media_List *mList, int index);
 Media_Item * ivug_medialist_find_item_by_filename(Media_List *mList, const char* filepath);
 
-
+Media_Item *ivug_medialist_append_item(Media_List *mList, const char *filepath);
+Media_Item *ivug_medialist_prepend_item(Media_List *mList, const char *filepath);
 
 
 #ifdef __cplusplus
index 4029bc7..96d6512 100755 (executable)
@@ -476,4 +476,19 @@ ivug_list_load_dir_items(const char *basedir)
 }
 
 
+Eina_List *ivug_list_append_item(Eina_List *list, const char *filepath)
+{
+       Media_Data *mData = ivug_alloc_mediadata_from_filepath(filepath);
+
+       list = eina_list_append(list, mData);
+       return list;
+}
+
+Eina_List *ivug_list_prepend_item(Eina_List *list, const char *filepath)
+{
+       Media_Data *mData = ivug_alloc_mediadata_from_filepath(filepath);
+
+       list = eina_list_prepend(list, mData);
+       return list;
+}
 
index c96653c..7fdfa4d 100755 (executable)
@@ -41,6 +41,9 @@ int ivug_list_get_dir_cnt(const char *basedir);
 
 Eina_List *ivug_list_load_dir_items(const char *basedir);
 
+Eina_List *ivug_list_append_item(Eina_List *list, const char *filepath);
+
+Eina_List *ivug_list_prepend_item(Eina_List *list, const char *filepath);
 
 #ifdef __cplusplus
 }
index 7df023e..9fcb73e 100755 (executable)
@@ -840,4 +840,45 @@ ivug_medialist_find_item_by_index(Media_List *mList, int index)
        return NULL;
 }
 
+Media_Item * ivug_medialist_append_item(Media_List *mList, const char *filepath)
+{
+       IV_ASSERT(mList != NULL);
+
+       _Media_List *_mList = (_Media_List *)mList;
+
+       _mList->header = ivug_list_append_item(_mList->header, filepath);
+
+       _mList->count++;
+
+       int index = 0;
+       Eina_List *l;
+       Media_Data *data;
+       EINA_LIST_FOREACH(_mList->header, l, data)
+       {
+               data->index = index++;
+       }
+
+       return (Media_Item *)eina_list_last(_mList->header);
+}
+
+Media_Item * ivug_medialist_prepend_item(Media_List *mList, const char *filepath)
+{
+       IV_ASSERT(mList != NULL);
+
+       _Media_List *_mList = (_Media_List *)mList;
+
+       _mList->header = ivug_list_prepend_item(_mList->header, filepath);
+
+       _mList->count++;
+
+       int index = 0;
+       Eina_List *l;
+       Media_Data *data;
+       EINA_LIST_FOREACH(_mList->header, l, data)
+       {
+               data->index = index++;
+       }
+
+       return (Media_Item *)_mList->header;
+}