[TSAM-8818] Widget cannot reoder 31/97131/1
authorYoungHun Cho <hoon.cho@samsung.com>
Fri, 11 Nov 2016 08:13:32 +0000 (17:13 +0900)
committerYoungHun Cho <hoon.cho@samsung.com>
Fri, 11 Nov 2016 08:13:32 +0000 (17:13 +0900)
Change-Id: I19fe23e8d2a6c3d1dc7e238c7346d9583be5b21c
Signed-off-by: YoungHun Cho <hoon.cho@samsung.com>
Build/basedef.mk
Build/build_edc.mk
Build/build_po.mk
Build/makefile.mk
Build/tooldef.mk
inc/cluster_page.h
project_def.prop
src/cluster_page.c
src/cluster_view.c
src/page_indicator.c

index 64fbf82..8812624 100755 (executable)
@@ -1,34 +1,24 @@
 # Add inputs and outputs from these tool invocations to the build variables
 
+C_DEPS +=
 
-OS_NAME := $(shell $(UNAME))
-
-
-#ifeq ($(origin BUILD_CONFIG), undefined)
-BUILD_CONFIG ?= Debug
-#endif
+USES_EFL = yes
+USES_USR_INC = yes
 
-#ifeq ($(origin ARCH), undefined)
-ARCH ?= i386
-#endif
+SYSROOT = $(SBI_SYSROOT)
 
-#ifeq ($(origin PROJPATH), undefined)
-PROJPATH ?= .
-#endif
+USR_INCS := $(addprefix -I $(SYSROOT),$(PLATFORM_INCS_EX))
+EFL_INCS = 
 
+ifeq ($(strip $(PLATFORM_LIB_PATHS)),)
+RS_LIB_PATHS := "$(SYSROOT)/usr/lib"
+else
+RS_LIB_PATHS := $(addprefix -L$(SYSROOT),$(PLATFORM_LIB_PATHS))
+endif
 
-#ifeq ($(origin PROJ_PATH), undefined)
-PROJ_PATH ?= $(PROJPATH)
-#endif
+RS_LIBRARIES := $(addprefix -l,$(RS_LIBRARIES_EX))
 
-#ifeq ($(strip $(OUTPUT_DIR)),)
-OUTPUT_DIR ?= $(PROJ_PATH)/$(BUILD_CONFIG)
-#endif
+PLATFORM_INCS = $(USR_INCS) $(EFL_INCS) \
+     -I"$(SDK_PATH)/library"
 
-#ifeq ($(strip $(BUILD_ARCH)),)
-BUILD_ARCH ?= $(ARCH)
-#endif
-
-#ifeq ($(strip $(ENVENTOR_PATH)),)
-ENVENTOR_PATH ?= $(SDK_TOOLPATH)/enventor
-#endif
+OS_NAME := $(shell $(UNAME))
index 6f85fdd..38e5598 100644 (file)
@@ -58,9 +58,9 @@ ifneq ($$(strip $$(_ALL_SRCS)),)
 
 _ENC_SRCS := $$(call ENCODE_4MAKE,$$(_ALL_SRCS)) 
 
-_COMPILER_FLAGS := -id "$$(ENVENTOR_SHARED_RES_PATH)/images"
-_COMPILER_FLAGS += -sd "$$(ENVENTOR_SHARED_RES_PATH)/sounds"
-_COMPILER_FLAGS += -fd "$$(ENVENTOR_SHARED_RES_PATH)/fonts"
+_COMPILER_FLAGS := -id "$$(SDK_TOOLPATH)/enventor/share/enventor/images"
+_COMPILER_FLAGS += -sd "$$(SDK_TOOLPATH)/enventor/share/enventor/sounds"
+_COMPILER_FLAGS += -fd "$$(SDK_TOOLPATH)/enventor/share/enventor/fonts"
 
 ifneq ($$(strip $$(_IMAGE_DIRS)),)
 _COMPILER_FLAGS += $$(addprefix -id ,$$(_IMAGE_DIRS))
index d88d71a..23eb0df 100644 (file)
@@ -37,7 +37,7 @@ endef
 
 define MO_PROC_RAW
 
-_OUTPUT_DIR := $(1)
+_PROJ_ROOT := $(1)
 _SRCS := $(2)
 _APPNAME := $(3)
 
index c95b4b4..7384d24 100644 (file)
@@ -1,8 +1,8 @@
+# 
+# Usege : make -f <proj_root>/Build/makefile -C <proj_root> 
 #
-# Usege : make -f <proj_root>/Build/makefile -C <proj_root>
-#
-
-BUILD_SCRIPT_VERSION := 1.2.3
+BUILD_SCRIPT_VERSION := 1.2.2
 
 .PHONY : app_version app_clean build_version
 
@@ -14,20 +14,18 @@ clean : app_clean
 version : build_version
 
 
-#PROJ_ROOT := $(call BSLASH2SLASH,$(PROJ_PATH))
+#PROJ_ROOT := $(call BSLASH2SLASH,$(PROJPATH))
 PROJ_ROOT := .
 BUILD_ROOT := $(PROJ_ROOT)/Build
 
-include $(BUILD_ROOT)/basedef.mk
-
 include $(PROJ_ROOT)/project_def.prop
 -include $(PROJ_ROOT)/build_def.prop
 
 include $(BUILD_ROOT)/funcs.mk
 
+-include $(BUILD_ROOT)/basedef.mk
 -include $(BUILD_ROOT)/tooldef.mk
 -include $(BUILD_ROOT)/flags.mk
--include $(BUILD_ROOT)/platform.mk
 
 
 APPTYPE := $(type)
@@ -69,7 +67,7 @@ C_OPT := $(COMPILE_FLAGS) $(TC_COMPILER_MISC) $(RS_COMPILER_MISC) $(EXT_OP) --sy
 CPP_OPT := $(CPP_COMPILE_FLAGS) $(TC_COMPILER_MISC) $(RS_COMPILER_MISC) $(EXT_OP) --sysroot="$(SYSROOT)" -Werror-implicit-function-declaration $(M_OPT)
 C_OPT_FILE := $(PLATFORM_INCS_FILE)
 
-OBJS := #
+OBJS := # 
 
 # Global C/C++
 ifeq ($(strip $(USER_ROOT)),)
@@ -109,7 +107,7 @@ $(APPFILE) : $(OBJS) $(UOBJS)
        @echo '  Building target: $@'
        @echo '  Invoking: C/C++ Linker'
        $(call MAKEDIRS,$(@D))
-       $(CXX) -o $(APPFILE) $(OBJS) $(UOBJS) $(LIBPATHS) -Xlinker --as-needed $(LIBS) $(LINK_FLAGS) $(TC_LINKER_MISC) $(RS_LINKER_MISC) -pie -lpthread --sysroot="$(SYSROOT)" -Xlinker --version-script="$(PROJ_ROOT)/.exportMap" $(RS_LIB_PATHS) $(RS_LIBRARIES) -Xlinker -rpath="/opt/usr/apps/$(APPID)/lib" -Werror-implicit-function-declaration
+       $(CXX) -o $(APPFILE) $(OBJS) $(UOBJS) $(LIBPATHS) -Xlinker --as-needed $(LIBS) $(LINK_FLAGS) $(TC_LINKER_MISC) $(RS_LINKER_MISC) -pie -lpthread -Xlinker -rpath="/home/developer/sdk_tools/lib" --sysroot="$(SYSROOT)" -Xlinker --version-script="$(PROJ_ROOT)/.exportMap" $(RS_LIB_PATHS) $(RS_LIBRARIES) -Xlinker -rpath="/opt/usr/apps/$(APPID)/lib" -Werror-implicit-function-declaration
        @echo '  Finished building target: $@'
 endif
 ifeq ($(strip $(APPTYPE)),staticLib)
@@ -136,7 +134,7 @@ $(OBJ_OUTPUT) :
 $(OUTPUT_DIR) :
        $(call MAKEDIRS,$@)
 
-
+  
 ifneq ($(strip $(PLATFORM_INCS)),)
 $(PLATFORM_INCS_FILE) : $(OBJ_OUTPUT)
        @echo '  Building inc file: $@'
@@ -145,7 +143,7 @@ ifneq ($(findstring 3.82,$(MAKE_VERSION)),)
        $(file > $@,$(PLATFORM_INCS))
 else
        @echo $(PLATFORM_INCS) > $@
-endif
+endif    
 else
        @echo $(PLATFORM_INCS) > $@
 endif
@@ -153,11 +151,7 @@ endif
 
 
 include $(BUILD_ROOT)/build_edc.mk
-
-#ifeq ($(strip $(ENVENTOR_SHARED_RES_PATH)),)
-ENVENTOR_SHARED_RES_PATH ?= $(ENVENTOR_PATH)/share/enventor
-#endif
-
 EDJ_FILES :=
 
 # Global EDCs
index fded35b..9df2a39 100755 (executable)
@@ -1,5 +1,17 @@
 # Add inputs and outputs from these tool invocations to the build variables
 
+ifeq ($(strip $(BUILD_CONFIG)),)
+BUILD_CONFIG = Debug
+endif
+
+ifneq ($(strip $(PROJROOT)),)
+PROJPATH := $(PROJROOT)
+endif
+
+ifeq ($(strip $(OUTPUT_DIR)),)
+OUTPUT_DIR := $(PROJPATH)/$(BUILD_CONFIG)
+endif
+
 ifneq ($(strip $(SHELL_BIN)),)
 SHELL = $(SHELL_BIN)
 else
@@ -61,3 +73,4 @@ MSGFMT = $(MSGFMT_BIN)
 else
 MSGFMT = msgfmt
 endif
+
index c7205d5..930fe95 100755 (executable)
@@ -33,6 +33,7 @@ typedef struct {
        int highlight_pos_x;
        int highlight_pos_y;
 
+       widget_data_t *float_widget;
        Eina_List *widget_list;
 } cluster_page_t;
 
@@ -40,9 +41,9 @@ cluster_page_t *cluster_page_new(Evas_Object* parent);
 void cluster_page_delete(cluster_page_t *page);
 bool cluster_page_set_widget(cluster_page_t *page, widget_data_t *item);
 bool cluster_page_unset(cluster_page_t *page, widget_data_t *item);
-bool cluster_page_check_empty_space(cluster_page_t *page, widget_size_type_e type,
-               int pos_x, int pos_y, int *empty_x, int *empty_y);
-void cluster_page_check_empty_space_pos(cluster_page_t *page, widget_data_t *item, int *out_x, int *out_y);
+bool cluster_page_check_empty_space(cluster_page_t *page, widget_size_type_e type, int pos_x, int pos_y);
+bool cluster_page_find_empty_space(cluster_page_t *page, widget_size_type_e type, int *empty_x, int *empty_y);
+void cluster_page_get_widget_dest_pos(cluster_page_t *page, widget_data_t *item, int *dest_x, int *dest_y);
 Evas_Object *cluster_page_thumbnail(cluster_page_t *page);
 void cluster_page_drag_cancel(cluster_page_t *page);
 void cluster_page_drag_widget(cluster_page_t *page, widget_size_type_e type, int pos_x, int pos_y);
index 349effb..6989a8d 100755 (executable)
@@ -8,14 +8,15 @@ type = app
 # Project Profile
 profile = mobile-3.0
 
-# C/CPP Sources
-USER_SRCS = src/apps_data.c src/apps_view.c src/menu.c src/homescreen-efl.c src/hw_key.c src/popup.c src/cluster_page.c src/cluster_db.c src/cluster_view.c src/add_widget_viewer/add_widget_viewer.c src/widget_viewer.c src/apps_db.c src/page_indicator.c src/cluster_data.c src/apps_package_manager.c src/util.c src/add_widget_viewer/add_widget_data.c src/conf.c 
+# C Sources
+USER_SRCS = src/apps_data.c src/homescreen-efl.c src/popup.c src/cluster_page.c src/cluster_db.c src/cluster_view.c src/widget_viewer.c src/page_indicator.c src/cluster_data.c src/conf.c src/add_widget_viewer/add_widget_data.c src/apps_view.c src/menu.c src/hw_key.c src/add_widget_viewer/add_widget_viewer.c src/apps_db.c src/apps_package_manager.c src/util.c 
+USER_SRCS_ABS = 
 
 # EDC Sources
 USER_EDCS =  
 
 # PO Sources
-USER_POS = res/po/ca.po res/po/fr.po res/po/nl.po res/po/pt_BR.po res/po/sk.po res/po/sv.po res/po/uz.po res/po/ko_KR.po res/po/is.po res/po/ka.po res/po/ro.po res/po/it_IT.po res/po/en_PH.po res/po/lt.po res/po/mk.po res/po/nb.po res/po/ru_RU.po res/po/el_GR.po res/po/zh_TW.po res/po/az.po res/po/hr.po res/po/uk.po res/po/zh_CN.po res/po/de.po res/po/es_US.po res/po/eu.po res/po/kk.po res/po/sl.po res/po/et.po res/po/fr_CA.po res/po/ga.po res/po/gl.po res/po/hy.po res/po/lv.po res/po/ja_JP.po res/po/es_ES.po res/po/bg.po res/po/cs.po res/po/pl.po res/po/pt_PT.po res/po/sr.po res/po/hu.po res/po/ar.po res/po/en_US.po res/po/fi.po res/po/da.po res/po/en.po res/po/zh_HK.po res/po/tr_TR.po 
+USER_POS = res/po/pt_BR.po res/po/ro.po res/po/ko_KR.po res/po/ka.po res/po/is.po res/po/ru_RU.po res/po/en_PH.po res/po/it_IT.po res/po/el_GR.po res/po/uk.po res/po/hr.po res/po/az.po res/po/zh_CN.po res/po/es_US.po res/po/kk.po res/po/eu.po res/po/et.po res/po/lv.po res/po/hy.po res/po/ga.po res/po/ja_JP.po res/po/bg.po res/po/es_ES.po res/po/pt_PT.po res/po/pl.po res/po/hu.po res/po/en_US.po res/po/da.po res/po/tr_TR.po res/po/uz.po res/po/sv.po res/po/sk.po res/po/nl.po res/po/fr.po res/po/ca.po res/po/nb.po res/po/mk.po res/po/lt.po res/po/zh_TW.po res/po/de.po res/po/sl.po res/po/fr_CA.po res/po/gl.po res/po/sr.po res/po/cs.po res/po/ar.po res/po/fi.po res/po/en.po res/po/zh_HK.po 
 
 # User Defines
 USER_DEFS = 
@@ -30,32 +31,42 @@ USER_LIBS =
 
 # User Objects
 USER_OBJS = 
+USER_OBJS_ABS = 
 
 # User Includes
 ## C Compiler
-USER_C_INC_DIRS = inc 
+USER_INC_DIRS = inc 
+USER_INC_DIRS_ABS = 
 USER_INC_FILES = 
+USER_INC_FILES_ABS = 
 ## C++ Compiler
 USER_CPP_INC_DIRS = 
+USER_CPP_INC_DIRS_ABS = 
 USER_CPP_INC_FILES = 
-
-USER_INC_DIRS = $(USER_C_INC_DIRS) $(USER_CPP_INC_DIRS)
+USER_CPP_INC_FILES_ABS = 
 
 # User Library Path
 USER_LIB_DIRS = 
+USER_LIB_DIRS_ABS = 
 
 # EDC Resource Path
-USER_EDCS_IMAGE_DIRS = ${OUTPUT_DIR} edje/images res/images 
-USER_EDCS_SOUND_DIRS = ${OUTPUT_DIR} edje/sounds 
-USER_EDCS_FONT_DIRS = ${OUTPUT_DIR} edje/fonts 
+USER_EDCS_IMAGE_DIRS = edje/images res/images 
+USER_EDCS_IMAGE_DIRS_ABS = 
+USER_EDCS_SOUND_DIRS = edje/sounds 
+USER_EDCS_SOUND_DIRS_ABS = 
+USER_EDCS_FONT_DIRS = edje/fonts 
+USER_EDCS_FONT_DIRS_ABS = 
 
 # EDC Flags
 USER_EXT_EDC_KEYS = EDC0 
 
-USER_EXT_EDC0_EDCS = res/edje/cluster_allpage_thumbnail.edc res/edje/home_btn.edc res/edje/home.edc res/edje/widget.edc res/edje/add_widget_viewer.edc res/edje/apps_folder_icon.edc res/edje/apps_chooser_btn.edc res/edje/apps_folder_popup.edc res/edje/app_icon.edc res/edje/cluster_page.edc res/edje/apps_view.edc res/edje/page_indicator_unit.edc res/edje/apps_view_bg.edc res/edje/cluster_allpage.edc 
-USER_EXT_EDC0_EDCS_IMAGE_DIRS = ${OUTPUT_DIR} edje/images res/images 
-USER_EXT_EDC0_EDCS_SOUND_DIRS = ${OUTPUT_DIR} edje/sounds 
-USER_EXT_EDC0_EDCS_FONT_DIRS = ${OUTPUT_DIR} edje/fonts 
+USER_EXT_EDC0_EDCS = res/edje/widget.edc res/edje/apps_folder_icon.edc res/edje/apps_folder_popup.edc res/edje/apps_view.edc res/edje/page_indicator_unit.edc res/edje/apps_view_bg.edc res/edje/cluster_allpage_thumbnail.edc res/edje/home_btn.edc res/edje/home.edc res/edje/apps_chooser_btn.edc res/edje/add_widget_viewer.edc res/edje/app_icon.edc res/edje/cluster_page.edc res/edje/cluster_allpage.edc 
+USER_EXT_EDC0_EDCS_IMAGE_DIRS = edje/images res/images 
+USER_EXT_EDC0_EDCS_IMAGE_DIRS_ABS = 
+USER_EXT_EDC0_EDCS_SOUND_DIRS = edje/sounds 
+USER_EXT_EDC0_EDCS_SOUND_DIRS_ABS = 
+USER_EXT_EDC0_EDCS_FONT_DIRS = edje/fonts 
+USER_EXT_EDC0_EDCS_FONT_DIRS_ABS = 
 
 # Resource Filter
 USER_RES_INCLUDE = 
index 128fd74..09ab3cf 100755 (executable)
 #include "widget_viewer.h"
 #include "cluster_view.h"
 
+#define FLOAT_TIME 0.15
+
+static struct {
+       int float_y;
+       Ecore_Animator *float_animator;
+} s_info = {
+       .float_y = 0,
+       .float_animator = NULL,
+};
+
 static void __cluster_page_set(cluster_page_t *page, widget_data_t *item);
 static void __cluster_page_print_space(cluster_page_t *page);
 static void __cluster_page_get_widget_size(widget_size_type_e type, int *w, int *h);
@@ -28,6 +38,10 @@ static void __cluster_page_get_widget_size(widget_size_type_e type, int *w, int
 static void __cluster_page_edit_on_done(void *data, Evas_Object *obj, const char *emission, const char *source);
 static void __cluster_page_edit_off_done(void *data, Evas_Object *obj, const char *emission, const char *source);
 
+static bool __cluster_page_check_extra_space(cluster_page_t *page, widget_size_type_e type, int pos_x, int pos_y);
+static void __cluster_page_return_floating_widget(cluster_page_t *page);
+static void __cluster_page_push_floating_widget(cluster_page_t *page, int pos_x, int pos_y);
+static Eina_Bool __cluster_page_float_anim(void *data, double pos);
 
 cluster_page_t *cluster_page_new(Evas_Object* parent)
 {
@@ -61,6 +75,7 @@ cluster_page_t *cluster_page_new(Evas_Object* parent)
        elm_object_signal_callback_add(page_t->page_layout, SIGNAL_EDIT_MODE_OFF_DONE, SIGNAL_SOURCE,
                        __cluster_page_edit_off_done, (void *)page_t);
 
+       page_t->float_widget = NULL;
        return page_t;
 }
 
@@ -79,13 +94,17 @@ bool cluster_page_set_widget(cluster_page_t *page, widget_data_t *item)
        }
 
        int x, y;
-       if (cluster_page_check_empty_space(page, item->type, item->pos_x, item->pos_y, &x, &y)) {
-               item->page_idx = page->page_index;
-               item->pos_x = x;
-               item->pos_y = y;
+       if (cluster_page_find_empty_space(page, item->type, &x, &y)) {
+               if (!cluster_page_check_empty_space(page, item->type, item->pos_x, item->pos_y)) {
+                       item->page_idx = page->page_index;
+                       item->pos_x = x;
+                       item->pos_y = y;
+               }
+
                __cluster_page_set(page, item);
                return true;
        }
+
        return false;
 }
 
@@ -106,75 +125,61 @@ bool cluster_page_unset(cluster_page_t *page, widget_data_t *item)
        return true;
 }
 
-bool cluster_page_check_empty_space(cluster_page_t *page, widget_size_type_e type,
-               int pos_x, int pos_y, int *empty_x, int *empty_y)
+bool cluster_page_check_empty_space(cluster_page_t *page, widget_size_type_e type, int pos_x, int pos_y)
 {
-       LOGD("%d %d", pos_x, pos_y);
        int w, h;
-       int from_x, to_x, from_y, to_y;
-       int x, y, i, j;
+       int i, j;
        __cluster_page_get_widget_size(type, &w, &h);
 
-       if (pos_x == INIT_VALUE || pos_y == INIT_VALUE) {
-               from_x = from_y = 0;
-               to_x = to_y = 3;
-       } else if (pos_x < 0 || pos_y < 0 || pos_x >= CLUSTER_COL || pos_y >= CLUSTER_ROW) {
+       if (!(pos_x >= 0 && pos_x <=CLUSTER_COL && pos_y >=0 && pos_y <=CLUSTER_ROW))
                return false;
-       } else {
-               from_x = to_x = pos_x;
-               from_y = to_y = pos_y;
-       }
-       LOGD("from %d %d", from_x, from_y);
-
-       for (y = from_y; y <= to_y; y++) {
-               for (x = from_x; x <= to_x; x++) {
-                       bool find = true;
-                       for (i = 0; i < h; i++) {
-                               for (j = 0; j < w; j++) {
-                                       if (y + i >= 4 || x + j >= 4 || page->space[y + i][x + j] == 1) {
-                                               find = false;
-                                               break;
-                                       }
-                                       if (!find)
-                                               break;
-                               }
+
+       for (i = 0; i < h; i++) {
+               for (j = 0; j < w; j++) {
+                       if (pos_y + i >= CLUSTER_ROW || pos_x + j >= CLUSTER_COL || page->space[pos_y + i][pos_x + j] == 1) {
+                               return false;
                        }
-                       if (find) {
-                               if (empty_x)
-                                       *empty_x = x;
-                               if (empty_y)
-                                       *empty_y = y;
-                               LOGD("empty");
+               }
+       }
+
+       return true;
+}
+
+bool cluster_page_find_empty_space(cluster_page_t *page, widget_size_type_e type, int *empty_x, int *empty_y)
+{
+       int w, h;
+       int x, y;
+       __cluster_page_get_widget_size(type, &w, &h);
+
+       for (y = 0; y < CLUSTER_ROW; y++) {
+               for (x = 0; x < CLUSTER_COL; x++) {
+                       if (cluster_page_check_empty_space(page, type, x, y)) {
+                               *empty_y = y;
+                               *empty_x = x;
                                return true;
                        }
                }
        }
 
-       if (empty_x)
-               *empty_x = INIT_VALUE;
-       if (empty_y)
-               *empty_y = INIT_VALUE;
-       LOGD("NOT empty");
+       *empty_x = INIT_VALUE;
+       *empty_y = INIT_VALUE;
+
        return false;
 }
 
-void cluster_page_check_empty_space_pos(cluster_page_t *page, widget_data_t *item, int *out_x, int *out_y)
+void cluster_page_get_widget_dest_pos(cluster_page_t *page, widget_data_t *item, int *dest_x, int *dest_y)
 {
-       int x, y;
-       *out_x = INIT_VALUE;
-       *out_y = INIT_VALUE;
-
        int gx, gy, w, h;
        evas_object_geometry_get(page->grid, &gx, &gy, &w, &h);
-       if (cluster_page_check_empty_space(page, item->type, item->pos_x, item->pos_y, &x, &y)) {
-               *out_x = gx + x * (w / CLUSTER_COL);
-               *out_y = gy + y * (h / CLUSTER_ROW);
-       } else if (cluster_page_check_empty_space(page, item->type, INIT_VALUE, INIT_VALUE, &x, &y)) {
-               *out_x = gx + x * (w / CLUSTER_COL);
-               *out_y = gy + y * (h / CLUSTER_ROW);
-       } else {
-               *out_x = gx + item->pos_x * (w / CLUSTER_COL);
-               *out_y = gy + item->pos_y * (h / CLUSTER_ROW);
+       *dest_x = gx + item->pos_x * (w / CLUSTER_COL);
+       *dest_y = gy + item->pos_y * (h / CLUSTER_ROW);
+
+       if (!cluster_page_check_empty_space(page, item->type, item->pos_x, item->pos_y)) {
+               int x, y;
+               if (cluster_page_find_empty_space(page, item->type, &x, &y)) {
+                       *dest_x = gx + x * (w / CLUSTER_COL);
+                       *dest_y = gy + y * (h / CLUSTER_ROW);
+               }
        }
 }
 
@@ -191,23 +196,6 @@ void cluster_page_get_highlight_xy(cluster_page_t *page, int *x, int *y)
        }
 }
 
-static void __cluster_page_set(cluster_page_t *page, widget_data_t *item)
-{
-       int w, h;
-       int i, j;
-       __cluster_page_get_widget_size(item->type, &w, &h);
-
-       for (i = 0; i < h; i++) {
-               for (j = 0; j < w; j++) {
-                       page->space[item->pos_y + i][item->pos_x + j] = 1;
-               }
-       }
-
-       elm_grid_pack(page->grid, item->widget_layout, item->pos_x, item->pos_y, w, h);
-       cluster_data_update(item);
-       page->widget_list = eina_list_append(page->widget_list, item);
-}
-
 Evas_Object *cluster_page_thumbnail(cluster_page_t *page_t)
 {
        Evas_Object *image = NULL;
@@ -241,6 +229,18 @@ void cluster_page_drag_cancel(cluster_page_t *page)
                page->highlight_pos_x = INIT_VALUE;
                page->highlight_pos_y = INIT_VALUE;
        }
+
+       if (page->float_widget) {
+               int gx, gy, gw, gh;
+               evas_object_geometry_get(page->grid, &gx, &gy, &gw, &gh);
+
+               int to_x = gx;
+               int to_y = gy + page->float_widget->pos_y * (gh / CLUSTER_ROW);
+
+               evas_object_move(page->float_widget->widget_layout, to_x, to_y);
+
+               page->float_widget = NULL;
+       }
 }
 
 void cluster_page_drag_widget(cluster_page_t *page, widget_size_type_e type, int pos_x, int pos_y)
@@ -258,8 +258,22 @@ void cluster_page_drag_widget(cluster_page_t *page, widget_size_type_e type, int
                evas_object_color_set(page->highlight, 255 , 255, 255, 100);
        }
 
-       if (cluster_page_check_empty_space(page, type, pos_x, pos_y, NULL, NULL)) {
+       if (cluster_page_check_empty_space(page, type, pos_x, pos_y)) {
+               if (pos_x != page->highlight_pos_x || pos_y != page->highlight_pos_y) {
+                       __cluster_page_return_floating_widget(page);
+
+                       int w, h;
+                       page->highlight_pos_x = pos_x;
+                       page->highlight_pos_y = pos_y;
+                       elm_grid_unpack(page->grid, page->highlight);
+                       __cluster_page_get_widget_size(type, &w, &h);
+                       elm_grid_pack(page->grid, page->highlight, pos_x, pos_y, w, h);
+                       evas_object_show(page->highlight);
+               }
+       } else if (__cluster_page_check_extra_space(page, type, pos_x, pos_y)) {
                if (pos_x != page->highlight_pos_x || pos_y != page->highlight_pos_y) {
+                       __cluster_page_push_floating_widget(page, pos_x, pos_y);
+
                        int w, h;
                        page->highlight_pos_x = pos_x;
                        page->highlight_pos_y = pos_y;
@@ -269,6 +283,9 @@ void cluster_page_drag_widget(cluster_page_t *page, widget_size_type_e type, int
                        evas_object_show(page->highlight);
                }
        } else {
+               if (page->highlight_pos_x != INIT_VALUE)
+                       __cluster_page_return_floating_widget(page);
+
                page->highlight_pos_x = INIT_VALUE;
                page->highlight_pos_y = INIT_VALUE;
                elm_grid_unpack(page->grid, page->highlight);
@@ -279,15 +296,6 @@ void cluster_page_drag_widget(cluster_page_t *page, widget_size_type_e type, int
 bool cluster_page_drop_widget(cluster_page_t *page, widget_data_t *widget)
 {
        if (!page->highlight || page->highlight_pos_x == INIT_VALUE || page->highlight_pos_y == INIT_VALUE) {
-               int x, y;
-               if (cluster_page_check_empty_space(page, widget->type, widget->pos_x, widget->pos_y, &x, &y) ||
-                               cluster_page_check_empty_space(page, widget->type, INIT_VALUE, INIT_VALUE, &x, &y)) {
-                       widget->page_idx = page->page_index;
-                       widget->pos_x = x;
-                       widget->pos_y = y;
-                       __cluster_page_set(page, widget);
-                       return true;
-               }
                return false;
        }
 
@@ -295,6 +303,14 @@ bool cluster_page_drop_widget(cluster_page_t *page, widget_data_t *widget)
        evas_object_del(page->highlight);
        page->highlight = NULL;
 
+       if (page->float_widget) {
+               cluster_page_unset(page, page->float_widget);
+               page->float_widget->pos_x = page->highlight_pos_x;
+               page->float_widget->pos_y = page->highlight_pos_y == 0 ? 2 : 0;
+               __cluster_page_set(page, page->float_widget);
+               page->float_widget = NULL;
+       }
+
        widget->page_idx = page->page_index;
        widget->pos_x = page->highlight_pos_x;
        widget->pos_y = page->highlight_pos_y;
@@ -305,6 +321,23 @@ bool cluster_page_drop_widget(cluster_page_t *page, widget_data_t *widget)
        return true;
 }
 
+static void __cluster_page_set(cluster_page_t *page, widget_data_t *item)
+{
+       int w, h;
+       int i, j;
+       __cluster_page_get_widget_size(item->type, &w, &h);
+
+       for (i = 0; i < h; i++) {
+               for (j = 0; j < w; j++) {
+                       page->space[item->pos_y + i][item->pos_x + j] = 1;
+               }
+       }
+
+       elm_grid_pack(page->grid, item->widget_layout, item->pos_x, item->pos_y, w, h);
+       cluster_data_update(item);
+       page->widget_list = eina_list_append(page->widget_list, item);
+}
+
 static void __cluster_page_print_space(cluster_page_t *page)
 {
        LOGD("=========================================");
@@ -342,10 +375,95 @@ static void __cluster_page_edit_on_done(void *data, Evas_Object *obj, const char
 static void __cluster_page_edit_off_done(void *data, Evas_Object *obj, const char *emission, const char *source)
 {
        cluster_page_t *page_t = (cluster_page_t *)data;
-       Eina_List *find_list;
-       widget_data_t *item;
+       Eina_List *find_list = NULL;
+       widget_data_t *item = NULL;
 
        EINA_LIST_FOREACH(page_t->widget_list, find_list, item) {
                widget_viewer_thumbnail_delete(item);
        }
 }
+
+static bool __cluster_page_check_extra_space(cluster_page_t *page, widget_size_type_e type, int pos_x, int pos_y)
+{
+       int w, h;
+       __cluster_page_get_widget_size(type, &w, &h);
+
+       if (type == WIDGET_SIZE_TYPE_4x4)
+               return false;
+
+       if (pos_x != 0 || !(pos_y == 0 || pos_y == 2))
+               return false;
+
+       if (!page || eina_list_count(page->widget_list) != 1)
+               return false;
+
+       widget_data_t *item = eina_list_data_get(page->widget_list);
+       if (!item || item->type == WIDGET_SIZE_TYPE_4x4)
+               return false;
+
+       page->float_widget = item;
+
+       return true;
+}
+
+static void __cluster_page_return_floating_widget(cluster_page_t *page)
+{
+       if (!page || page->float_widget == NULL)
+               return ;
+
+       if (s_info.float_animator) {
+               ecore_animator_del(s_info.float_animator);
+               s_info.float_animator = NULL;
+       }
+
+
+       widget_data_t *item = eina_list_data_get(page->widget_list);
+       s_info.float_y = item->pos_y;
+
+       s_info.float_animator = ecore_animator_timeline_add(FLOAT_TIME, __cluster_page_float_anim, page);
+}
+
+static void __cluster_page_push_floating_widget(cluster_page_t *page, int pos_x, int pos_y)
+{
+       if (!page || page->float_widget == NULL)
+               return ;
+
+       if (s_info.float_animator) {
+               ecore_animator_del(s_info.float_animator);
+               s_info.float_animator = NULL;
+       }
+
+       s_info.float_y = pos_y == 0 ? 2 : 0;
+
+       s_info.float_animator = ecore_animator_timeline_add(FLOAT_TIME, __cluster_page_float_anim, page);
+}
+
+static Eina_Bool __cluster_page_float_anim(void *data, double pos)
+{
+       cluster_page_t *page = (cluster_page_t *)data;
+
+       int gx, gy, gw, gh;
+       evas_object_geometry_get(page->grid, &gx, &gy, &gw, &gh);
+
+       int to_x = gx;
+       int to_y = gy + s_info.float_y * (gh / CLUSTER_ROW);
+
+       evas_object_geometry_get(page->float_widget->widget_layout, &gx, &gy, &gw, &gh);
+
+       int cur_x = gx;
+       int cur_y = gy;
+
+       evas_object_move(page->float_widget->widget_layout,
+                       to_x + (cur_x - to_x) * (1.0 - pos),
+                       to_y + (cur_y - to_y) * (1.0 - pos));
+
+       if (pos >= 1.0 - (1e-10)) {
+               evas_object_move(page->float_widget->widget_layout, to_x, to_y);
+
+               s_info.float_animator = NULL;
+
+               return ECORE_CALLBACK_DONE;
+       }
+
+       return ECORE_CALLBACK_RENEW;
+}
index 8e8a569..39c607d 100755 (executable)
@@ -431,9 +431,18 @@ bool cluster_view_set_state(view_state_t state)
                if (cluster_view_s.view_state == VIEW_STATE_EDIT) {
                        homescreen_efl_btn_show(HOMESCREEN_VIEW_HOME);
 
+                       if (cluster_view_s.picked_widget) {
+                               cluster_page_t *page = (cluster_page_t *)eina_list_nth(cluster_view_s.page_list, cluster_view_s.picked_widget->page_idx);
+                               cluster_page_set_widget(page, cluster_view_s.picked_widget);
+
+                               cluster_view_s.picked_widget = NULL;
+
+                               page = (cluster_page_t *)eina_list_nth(cluster_view_s.page_list, cluster_view_s.current_page);
+                               cluster_page_drag_cancel(page);
+                       }
+
                        Eina_List *data_list = cluster_data_get_widget_list();
                        Eina_List *find_list = NULL;
-
                        cluster_page_t *page_item = NULL;
                        EINA_LIST_FOREACH(cluster_view_s.page_list, find_list, page_item) {
                                if (page_item->page_layout) {
@@ -507,30 +516,23 @@ bool cluster_view_set_state(view_state_t state)
 
 bool cluster_view_add_widget(widget_data_t *item, bool scroll)
 {
-       int page_idx = INIT_VALUE;
        bool set_on = false;
 
-       if (item->page_idx >= 0) {
-               page_idx = item->page_idx;
-       } else {
-               page_idx = cluster_view_s.current_page;
+       cluster_page_t *page = (cluster_page_t *)eina_list_nth(cluster_view_s.page_list, cluster_view_s.current_page);
+       if (cluster_page_find_empty_space(page, item->type, &item->pos_x, &item->pos_y)) {
+               item->page_idx = cluster_view_s.current_page;
+               set_on = true;
        }
 
-       cluster_page_t *page = (cluster_page_t *)eina_list_nth(cluster_view_s.page_list, page_idx);
-       set_on = cluster_page_check_empty_space(page, item->type, item->pos_x, item->pos_y, NULL, NULL);
-
        if (!set_on) {
                Eina_List *find_list = NULL;
                cluster_page_t *page_item = NULL;
                EINA_LIST_FOREACH(cluster_view_s.page_list, find_list, page_item) {
-                       if (page_item == NULL) {
-                               LOGE("page is NULL");
-                       } else {
-                               set_on = cluster_page_check_empty_space(page_item, item->type, item->pos_x, item->pos_y, NULL, NULL);
-                               if (set_on) {
-                                       page = page_item;
-                                       break;
-                               }
+                       if (cluster_page_find_empty_space(page_item, item->type, &item->pos_x, &item->pos_y)) {
+                               item->page_idx = page_item->page_index;
+                               set_on = true;
+                               page = page_item;
+                               break;
                        }
                }
        }
@@ -557,14 +559,21 @@ bool cluster_view_add_widget(widget_data_t *item, bool scroll)
                        return false;
                }
 
+               if (!cluster_page_find_empty_space(page_t, item->type, &item->pos_x, &item->pos_y)) {
+                       return false;
+               }
+
+               item->page_idx = page_t->page_index;
                page = page_t;
        }
 
-       if (!item->widget_layout)
+       if (!item->widget_layout) {
                __cluster_view_add_widget_content(item);
+       }
 
        if (!cluster_page_set_widget(page, item)) {
                LOGE("cluster_page_set_widget is failed!!!");
+               return false;
        }
 
        if (scroll) {
@@ -1297,9 +1306,6 @@ static void __cluster_view_edit_pick_up_widget(void *data)
 
 static void __cluster_view_edit_drag_widget(void *data)
 {
-       int page_x, page_y;
-       int bg_x, bg_y, bg_w, bg_h;
-       int widget_x, widget_y;
        cluster_view_s.picked_widget = (widget_data_t *)data;
 
        if (!cluster_view_s.picked_widget)
@@ -1309,30 +1315,35 @@ static void __cluster_view_edit_drag_widget(void *data)
        evas_object_move(widget_layout, cluster_mouse_info.move_x - cluster_mouse_info.offset_x,
                        cluster_mouse_info.move_y - cluster_mouse_info.offset_y);
 
-       cluster_page_t *page = (cluster_page_t *)eina_list_nth(cluster_view_s.page_list, cluster_view_s.current_page);
-       evas_object_geometry_get(page->page_layout, &page_x, &page_y, NULL, NULL);
-       edje_object_part_geometry_get(elm_layout_edje_get(page->page_layout), CLUSTER_BG, &bg_x, &bg_y, &bg_w, &bg_h);
-       evas_object_geometry_get(widget_layout, &widget_x, &widget_y, NULL, NULL);
-
        if ((cluster_mouse_info.move_x > CLUSTER_EDIT_RIGHT_SCROLL_REGION) && (cluster_view_s.page_count > 1)) {
-               LOGD("Move to next page");
                if (!cluster_view_s.edit_mode_scroll_timer)
                        cluster_view_s.edit_mode_scroll_timer = ecore_timer_add(HOME_EDIT_SCROLL_MOVE_TIME, __cluster_view_scroll_timer_cb, NULL);
 
        } else if ((cluster_mouse_info.move_x < CLUSTER_EDIT_LEFT_SCROLL_REGION) && (cluster_view_s.page_count > 1)) {
-               LOGD("Move to prev page");
                if (!cluster_view_s.edit_mode_scroll_timer)
                        cluster_view_s.edit_mode_scroll_timer = ecore_timer_add(HOME_EDIT_SCROLL_MOVE_TIME, __cluster_view_scroll_timer_cb, NULL);
        } else {
-               widget_x -= (page_x + bg_x);
-               widget_y -= (page_y + bg_y);
+               int page_x, page_y, page_w, page_h;
+               int widget_x, widget_y;
+
+               cluster_page_t *page = (cluster_page_t *)eina_list_nth(cluster_view_s.page_list, cluster_view_s.current_page);
+               evas_object_geometry_get(page->grid, &page_x, &page_y, &page_w, &page_h);
+               evas_object_geometry_get(widget_layout, &widget_x, &widget_y, NULL, NULL);
+
+               widget_x -= page_x;
+               widget_y -= page_y;
                if (cluster_view_s.edit_mode_scroll_timer) {
                        ecore_timer_del(cluster_view_s.edit_mode_scroll_timer);
                        cluster_view_s.edit_mode_scroll_timer = NULL;
                }
 
                if (!cluster_view_s.is_srolling) {
-                       cluster_page_drag_widget(page, cluster_view_s.picked_widget->type, widget_x / (bg_w / CLUSTER_COL), widget_y / (bg_h / CLUSTER_ROW));
+                       int block_w = (page_w / CLUSTER_COL);
+                       int block_h = (page_h / CLUSTER_ROW);
+                       double pos_x = (double)widget_x / block_w + 0.5;
+                       double pos_y = (double)widget_y / block_h + 0.5;
+
+                       cluster_page_drag_widget(page, cluster_view_s.picked_widget->type, pos_x < 0.0 ? -1 : (int)pos_x, pos_y < 0.0 ? -1 : (int)pos_y);
                }
        }
 }
@@ -1359,7 +1370,10 @@ static void __cluster_view_edit_drop_widget(void *data)
        page = (cluster_page_t *)eina_list_nth(cluster_view_s.page_list, cluster_view_s.current_page);
        cluster_page_get_highlight_xy(page, &to_x, &to_y);
        if (to_x == INIT_VALUE || to_y == INIT_VALUE) {
-               cluster_page_check_empty_space_pos(page, cluster_view_s.picked_widget, &to_x, &to_y);
+               int gx, gy, w, h;
+               evas_object_geometry_get(page->grid, &gx, &gy, &w, &h);
+               to_x = gx + cluster_view_s.picked_widget->pos_x * (w / CLUSTER_COL);
+               to_y = gy + cluster_view_s.picked_widget->pos_y * (h / CLUSTER_ROW);
        }
 
        cluster_view_s.animation_to_x = to_x;
@@ -1396,10 +1410,15 @@ static void __cluster_view_edit_move_anim_done(void *data)
        cluster_page_t *page = (cluster_page_t *)eina_list_nth(cluster_view_s.page_list, cluster_view_s.current_page);
 
        if (!cluster_page_drop_widget(page, cluster_view_s.picked_widget)) {
-               cluster_view_s.current_page = cluster_view_s.picked_widget->page_idx;
-               __cluster_view_scroll_to_page(cluster_view_s.current_page, true);
+               if (cluster_view_s.picked_widget->page_idx != cluster_view_s.current_page) {
+                       cluster_view_s.current_page = cluster_view_s.picked_widget->page_idx;
+                       __cluster_view_scroll_to_page(cluster_view_s.current_page, true);
+               }
 
-               cluster_view_add_widget(cluster_view_s.picked_widget, true);
+               page = (cluster_page_t *)eina_list_nth(cluster_view_s.page_list, cluster_view_s.current_page);
+               if (!cluster_page_set_widget(page, cluster_view_s.picked_widget)) {
+                       cluster_view_add_widget(cluster_view_s.picked_widget, true);
+               }
        }
 
        cluster_view_s.picked_widget = NULL;
index 41e5c8a..d4b8d9d 100755 (executable)
@@ -157,7 +157,6 @@ void page_indicator_set_current_page(page_indicator_t *page_indicator, int page_
 static int __page_indicator_get_indicator_unit(int page_count, int page)
 {
        int indicator = 0;
-       LOGD("Page count : %d, page index: %d", page_count, page);
 
        if (page_count > PAGE_INDICATOR_MAX_PAGE_COUNT) {
                int center_left = PAGE_INDICATOR_CENTER_PAGE_INDEX;